[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: minimilistic KDE makefile
From:       Kurt Granroth <granroth () suse ! com>
Date:       2001-10-17 15:53:24
[Download RAW message or body]

On Wednesday 17 October 2001 08:34 am, Josef Spillner wrote:
> On Wednesday 17 October 2001 16:47, Mark W. Webb wrote:
> > Could someone point me to a minimilistic KDE based makefile?  I just want
> > to write a program with one or two .cpp files and matching .h files.  I
> > only have experience creating projects using KDevelop, and those
> > makefiles are more complex than the program that I want to write.  The
> > program is only a simple program that I will just throw together for
> > testing.
>
> The makefiles are complex because they're generated from templates. The
> only file you have to write is Makefile.am. Look in KDE's CVS how the other
> apps do it, it's normally not more than 5-10 lines of code, plus some data
> or special files like .desktop files or icons. The perl script am_edit does
> even simplify this.
> Take whatever external KDE package to see how to create a standalone
> package.

Yes, but those templates *are* overkill for a simple test app.  When I am
writing a minimalistic app to test just one little bug in one widget, I
don't use the full autoconf/automake system!

I use a Makefile similar to this:
----------------------------------------------------------------
CFLAGS=-I$(QTDIR)/include -I$(KDEDIR)/include
LFLAGS=-L$(QTDIR)/lib -L$(KDEDIR)/lib -lkdeui -lkdecore -lqt-mt

SRC=main.cpp widget.cpp widget.moc.cpp

all: widget.moc.cpp
	g++ -o widgettest $(CFLAGS) $(LFLAGS) $(SRC)

widget.moc.cpp: widget.h
	$(QTDIR)/bin/moc widget.h -o widget.moc.cpp
------------------------------------------------------------------

This works fine for very small test apps since it just recompiles 
everything everytime.  If you have a few more files, then you might want
to have some rules like:

  OBJECTS=main.o widget.o
  .cpp.o:
    g++ $(CFLAGS) -c $<
  all:
    g++ $(OBJECTS) $(LFLAGS)
-- 
Kurt Granroth            | http://www.granroth.org
KDE Developer/Evangelist | SuSE Labs Open Source Developer
granroth@kde.org         | granroth@suse.com
            KDE -- Conquer Your Desktop

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic