# The path of the qt library (for the linker) 
libpath = /usr/lib/
#at home, this might work instead: 
#libpath = $(QTDIR)/lib/

# The path of the qt header files to include (for the compiler)  
incpath = /usr/include/qt3/
#at home, this might work instead: 
#incpath = $(QTDIR)/include/

#meta object compiler (moc), compile the gui header files into c++ code.
moc = /usr/share/qt3/bin/moc
#at home, this might work instead:
#moc = $(QTDIR)/bin/moc

CC = g++ 
CMP = $(CC) -c -Wall 

OBJ = gui.o App.o moc_gui.o 

.cpp.o:
	g++ -Wall -c $<

demo: $(OBJ)
	$(CC) -L $(libpath) $(OBJ) -lqt -o $@

App.o: App.h App.cpp
	$(CC) -I $(incpath) -Wall -c App.cpp

# the moc turns the header file into a C++ file
moc_gui.cpp: gui.h
	$(moc) gui.h -o moc_gui.cpp

# the output of the moc is compiled in the ordinary way
moc_gui.o: moc_gui.cpp
	$(CC) -I $(incpath) -Wall -c moc_gui.cpp

gui.o: gui.h gui.cpp App.h   # <-- this is the correction 
	$(CC) -I $(incpath) -Wall -c gui.cpp

clean:
	rm -f *.o moc_* *~




