######################################################################
# Build all examples in this directory: "make -f makefile.clients"
######################################################################

PY    = /home/mark/python1.5.2-ddjcd/Python-1.5.2
PYLIB = $(PY)/libpython1.5.a
PYINC = -I$(PY)/Include -I$(PY)

APIDIR = ../HighLevelApi
APILIB = $(APIDIR)/libppembed.a

CLIBS  = -L/usr/lib -L/usr/X11R6/lib -lgdbm -ltk8.0 -ltcl8.0 -lX11 -lm -ldl
CFLAGS = -c -g $(PYINC)

# targets
EXECS = objects1 objects1err objects2 \
        codestring1 codestring2 

all: $(EXECS)

# objects1: call objects
objects1: objects1.o
	cc objects1.o $(PYLIB) $(CLIBS) -g -export-dynamic -o $@

objects1.o: objects1.c
	cc objects1.c $(CFLAGS)

# objects1err: objects1 + error checking
objects1err: objects1err.o
	cc objects1err.o $(PYLIB) $(CLIBS) -g -export-dynamic -o $@

objects1err.o: objects1err.c
	cc objects1err.c $(CFLAGS)

# objects2: call objects via api
objects2: objects2.o $(APILIB)
	cc objects2.o $(APILIB) $(PYLIB) $(CLIBS) -g -export-dynamic -o $@

objects2.o: objects2.c $(APIDIR)/ppembed.h
	cc objects2.c $(CFLAGS) -I$(APIDIR)

# codestring1: run strings
codestring1: codestring1.o
	cc codestring1.o $(PYLIB) $(CLIBS) -g -export-dynamic -o $@

codestring1.o: codestring1.c
	cc codestring1.c $(CFLAGS)

# codestring2: run strings via api
codestring2: codestring2.o $(APILIB)
	cc codestring2.o $(APILIB) $(PYLIB) $(CLIBS) -g -export-dynamic -o $@

codestring2.o: codestring2.c $(APIDIR)/ppembed.h
	cc codestring2.c $(CFLAGS) -I$(APIDIR)

# extended api lib
$(APILIB):
	cd $(APIDIR); make -f makefile.api

clean: 
	rm -f *.o *.pyc $(EXECS)

