#	Where is the SnapPea kernel source code on your computer?
SNAPPEA_KERNEL = /home/jeff/SnapPea/kernel

#	Where is Python.h on your computer?
#	If you don't know, try typing "locate Python.h"
#	(without the quotation marks) at the shell prompt.
PYTHON_DIRECTORY = /usr/include/python1.5

#	Compiler options.
#		-g	debugging code
#		-O	optimize
CFLAGS = -g -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations 

#	This tells the compiler where to look for the header files.
HEADER_PATH =	-I$(SNAPPEA_KERNEL)/headers/	\
				-I$(SNAPPEA_KERNEL)/unix_kit/	\
				-I$(PYTHON_DIRECTORY)


SnapPeaC.so:	SnapPeaC.o KernelObjects/BuildDate

	gcc -shared -o SnapPeaC.so $(CFLAGS)	\
		SnapPeaC.o							\
		KernelObjects/*.o					\
		-lm
	
SnapPeaC.o: SnapPeaC.c
	gcc -c $(CFLAGS) $(HEADER_PATH) SnapPeaC.c

KernelObjects/BuildDate:	$(SNAPPEA_KERNEL)/code/*.c		\
							$(SNAPPEA_KERNEL)/headers/*.h	\
							$(SNAPPEA_KERNEL)/unix_kit/*

	mkdir -p KernelObjects
	cd KernelObjects;									\
	gcc -c $(CFLAGS) $(HEADER_PATH)						\
		$(SNAPPEA_KERNEL)/code/*.c						\
		$(SNAPPEA_KERNEL)/unix_kit/unix_UI.c			\
		$(SNAPPEA_KERNEL)/unix_kit/unix_cusped_census.c	\
		$(SNAPPEA_KERNEL)/unix_kit/unix_file_io.c
	date > KernelObjects/BuildDate

clean:
	rm -f  SnapPeaC.o
	rm -rf KernelObjects
	rm -f  *.pyc
