BINPATH=$(HOME)/bin
WORKDIR=$(HOME)/work
BACKUPPATH=$(WORKDIR)/backup
LIB=-L/usr/local/lib -L. -lglib-2.0
INC=-I/usr/local/include/glib-2.0 -I/usr/local/include/python2.3 -I/usr/local/include/php/Zend \
-I/usr/local/include/php/main -I/usr/local/include/php/regex
CC=gcc
SWIG=swig
PKGNAME=roo-1.0-beta1-`date "+%Y%m%d"`

all: ctest subdir libroo.so

clean:
	rm -rf *.o *.so ctest
	cd python;make clean;
	cd php4;make clean;

subdir:
	cd python;make
	cd php4;make

install:ctest
	strip ctest
	copy ctest $(BINPATH)

distBSD: ctest subdir libroo.so
	rm -f $(PKGNAME).tar
	mkdir roo
	mkdir roo/python
	mkdir roo/php4
	cp ../bin/* roo
	strip ctest libroo.so python/*.so php4/*.so
	cp ctest libroo.so roo.h ctest.c shmq.ini r roo
	cp python/_roo.so python/pytest.py python/roo.py roo/python
	cp php4/php_roo.so php4/phptest.php php4/roo.php roo/php4
	tar cvf $(PKGNAME).tar roo
	rm -rf roo
        

#ctest: roo.o spsem.o shmqueue.o spshm.o ctest.o
#	$(CC) -o ctest ctest.o roo.o shmqueue.o spshm.o spsem.o
ctest: ctest.o libroo.so
	$(CC) -o ctest ctest.o -L. -lroo

main: main.o libroo.so
	$(CC) -o main main.o -L. -lroo

libroo.so: roo.o spsem.o shmqueue.o spshm.o utils.o
	$(CC) -shared -o libroo.so roo.o shmqueue.o spshm.o spsem.o utils.o

ctest.o: ctest.c
	$(CC) -g -c ctest.c

roo.o: roo.c
	$(CC) -g -c roo.c

shmqueue.o: shmqueue.c
	$(CC) -g -c shmqueue.c

spshm.o: spshm.c
	$(CC) -g -c spshm.c

spsem.o: spsem.c
	$(CC) -g -c spsem.c

utils.o: utils.c
	$(CC) -g -D__GUNC__ -c utils.c

