########## PYTHON-QT MAKEFILE

########## User configurable stuff

## This is the directory containing Python.h et al.
PYTHONINCLUDE = /usr/local/Python-1.4/Include

## This is the directory containing Python's config.h
PYTHONCONFIG = /usr/local/lib/python1.4/config

## This is the directory containing qt's include files
QTINCLUDE = /usr/local/qt/include

## This is the directory containing qt's library files
QTLIB = /usr/local/qt/lib



###########################################################################
# DON'T CHANGE THIS BIT!
#
# If you don't have GNU make then you'll need to rewrite IFILES, HEADERS etc
# adding whatever comes after addsuffix to each class name.
#
CLASSES=Object \
         Application \
	 Layout \
          BoxLayout GridLayout\
	 Widget \
	  Button \
	   CheckBox PushButton RadioButton \
          ComboBox \
	  Dialog \
           TabDialog \
	  LineEdit \
	  Frame \
	   GroupBox \
            ButtonGroup \
           Label \
           TableView \
            ListBox \
	    MultiLineEdit \
	  ScrollBar

IFILES=$(addsuffix .i, $(CLASSES)) *.i 
HEADERS=$(addsuffix .h, $(CLASSES)) 
SOURCES=$(addsuffix .cc, $(CLASSES))
OBJECTS=$(addsuffix .o, $(CLASSES))
MSRCS=$(addsuffix .moc.cc, $(CLASSES))
MOBJS=$(addsuffix .moc.o, $(CLASSES))


all: pythonqtcmodule.so
	@echo
	@echo
	@echo Make sure that pythonqtcmodule.so and pythonqt.py are
	@echo in a directory in PYTHONPATH

clean:
	rm -f *.pyc *.o

pythonqt.py pythonqt_wrap.c: pythonqt.i $(HEADERS) $(IFILES) 
	swig -python -shadow -c++ pythonqt.i

%.moc.cc: %.h
	moc $< -o $@

.cc.o:
	@echo Compiling $<
	@g++ -O -I$(PYTHONINCLUDE) \
		-I$(PYTHONCONFIG) \
		-I$(QTINCLUDE) \
		-c $< -o $@

.c.o:
	@echo Compiling $<
	@g++ -O -I$(PYTHONINCLUDE) \
		-I$(PYTHONCONFIG) \
		-I$(QTINCLUDE) \
		-c $< -o $@

######## If you have problems you may need to change the
######## ld arguments

pythonqtcmodule.so: $(OBJECTS) $(MOBJS) pythonqt_wrap.o 
	@echo Generating shared module
	#	ld -L$(QTLIB) -lqt -G \
	#		$(OBJECTS) $(MOBJS) \
	#		pythonqt_wrap.o \
	#		-o pythonqtcmodule.so
	gcc -shared $(OBJECTS) $(MOBJS) -o pythonqtcmodule.so \
		    pythonqt_wrap.o -L$(QTLIB) -lqt

