###########################################
# System dependent options
# include one of the following files
#include makefile.include.hpux
#include makefile.include.solaris
include makefile.include.linux
#include makefile.include.os390
#include makefile.include.aix


###########################################
# make all
tests: stanlibtest1 stanlibtest2 paflibtest1 paflibtest2 \
 multistan reportlibtest1 reportlibtest2 extracttables dpiddemo

# individual makes
stanlibtest1: StanLibTest1.o
	$(CPP) -o $@ StanLibTest1.o $(LINKSTAN)

stanlibtest2: StanLibTest2.o
	$(CPP) -o $@ StanLibTest2.o $(LINKSTAN)

stanlibmulti: StanLibMulti.o
	$(CPP) -o $@ StanLibMulti.o $(LINKSTAN) $(LINKMULTITHREAD)

multistan: multistan.o
	$(CPP) -o $@ multistan.o $(LINKSTAN) $(LINKMULTITHREAD)

extracttables: ExtractTables.o
	$(CPP) -o $@ ExtractTables.o $(LINKSTAN)

paflibtest1: PafLibTest1.o
	$(CPP) -o $@ PafLibTest1.o $(LINKPAF)

paflibtest2: PafLibTest2.o
	$(CPP) -o $@ PafLibTest2.o $(LINKPAF)

reportlibtest1: ReportLibTest1.o
	$(CPP) -o $@ ReportLibTest1.o $(LINKREPORT)

reportlibtest2: ReportLibTest2.o
	$(CPP) -o $@ ReportLibTest2.o $(LINKREPORT)

dpiddemo: DpidDemo.o
	$(CPP) -o $@ DpidDemo.o $(LINKPAF)


###########################################
# file dependencies
DpidDemo.o: DpidDemo.c PafLib.h
	$(CC) $(CFLAGS) $(CLIENTFLAGS) -c -o $@ $*.c
ExtractTables.o: ExtractTables.c StanLib.h
	$(CC) $(CFLAGS) $(CLIENTFLAGS) -c -o $@ $*.c
Multistan.o: Multistan.c StanLib.h
	$(CC) $(CFLAGS) $(CLIENTFLAGS) -c -o $@ $*.c
PafLibTest1.o: PafLibTest1.c PafLib.h
	$(CC) $(CFLAGS) $(CLIENTFLAGS) -c -o $@ $*.c
PafLibTest2.o: PafLibTest2.c PafLib.h
	$(CC) $(CFLAGS) $(CLIENTFLAGS) -c -o $@ $*.c
ReportLibTest1.o: ReportLibTest1.c ReportLib.h
	$(CC) $(CFLAGS) $(CLIENTFLAGS) -c -o $@ $*.c
ReportLibTest2.o: ReportLibTest2.c ReportLib.h
	$(CC) $(CFLAGS) $(CLIENTFLAGS) -c -o $@ $*.c
StanLibMulti.o: StanLibMulti.c StanLib.h
	$(CC) $(CFLAGS) $(CLIENTFLAGS) -c -o $@ $*.c
StanLibMulti2.o: StanLibMulti2.c StanLib.h
	$(CC) $(CFLAGS) $(CLIENTFLAGS) -c -o $@ $*.c
StanLibTest1.o: StanLibTest1.c StanLib.h
	$(CC) $(CFLAGS) $(CLIENTFLAGS) -c -o $@ $*.c
StanLibTest2.o: StanLibTest2.c StanLib.h
	$(CC) $(CFLAGS) $(CLIENTFLAGS) -c -o $@ $*.c
multistan.o: multistan.c StanLib.h
	$(CC) $(CFLAGS) $(CLIENTFLAGS) -c -o $@ $*.c

#####################
clean:
	rm -f *.o core
	rm -f stanlibtest1 stanlibtest2 paflibtest1 paflibtest2 multistan \
     reportlibtest1 reportlibtest2 extracttables dpiddemo

