#**********************************
# XPRD examples makefile          *
#                                 *
# (c) 2012 Fair Isaac Corporation *
#     author: Y. Colombani, 2012  *
#**********************************
.SUFFIXES: .java .class

CFLAGS-linux=-m32 -D_REENTRANT
CFLAGS-linux-gnu=$(CFLAGS-linux)
CFLAGS-solaris=-D_REENTRANT
CFLAGS-hpux=+Z +DAportable -D_POSIX_C_SOURCE=199506L
CFLAGS-aix=-q32 -D_THREAD_SAFE
CFLAGS-darwin=-m32
CFLAGS=$(CFLAGS-$(OSTYPE)) -I$(XPRESSDIR)/include

LDFLAGS-hpux=-Wl,+s
LDFLAGS-aix=-brtl
LDFLAGS-solaris=-lrt -lsocket -lnsl
LDFLAGS-sun_x86=-lrt -lsocket -lnsl
LDFLAGS=$(LDFLAGS-$(OSTYPE)) -L$(XPRESSDIR)/lib

all: allC allJ

allC:runelsd runrtdistr runrtpardistr runfoliodistr runrtparqueued distfolio distfoliopar distfoliocbioev findservers
allJ:mandelbrot.class runelsd.class runrtdistr.class runrtpardistr.class runfoliodistr.class runrtparqueued.class distfolio.class distfoliopar.class distfoliocbioev.class findservers.class

.java.class:
	javac -classpath $(XPRESSDIR)/lib/xprd.jar:$(XPRESSDIR)/lib/bindrv.jar:. $<

runelsd: runelsd.c
	$(CC) $(CFLAGS) $(LDFLAGS) $< -lxprd -lxprnls -lbindrv -lpthread -o $@

runrtdistr: runrtdistr.c
	$(CC) $(CFLAGS) $(LDFLAGS) $< -lxprd -lxprnls -lpthread -o $@

runrtpardistr: runrtpardistr.c
	$(CC) $(CFLAGS) $(LDFLAGS) $< -lxprd -lxprnls -lpthread -o $@

runfoliodistr: runfoliodistr.c
	$(CC) $(CFLAGS) $(LDFLAGS) $< -lxprd -lxprnls -lbindrv -lpthread -o $@

runrtparqueued: runrtparqueued.c
	$(CC) $(CFLAGS) $(LDFLAGS) $< -lxprd -lxprnls -lpthread -o $@

distfolio: distfolio.c
	$(CC) $(CFLAGS) $(LDFLAGS) $< -lxprd -lxprnls -lbindrv -lpthread -o $@

distfoliopar: distfoliopar.c
	$(CC) $(CFLAGS) $(LDFLAGS) $< -lxprd -lxprnls -lbindrv -lpthread -o $@

distfoliocbioev: distfoliocbioev.c
	$(CC) $(CFLAGS) $(LDFLAGS) $< -lxprd -lxprnls -lbindrv -lpthread -o $@

findservers: findservers.c
	$(CC) $(CFLAGS) $(LDFLAGS) $< -lxprd -lxprnls -lpthread -o $@

clean:
	rm -f runelsd runrtdistr runrtpardistr runfoliodistr runrtparqueued distfolio distfoliopar distfoliocbioev findservers *.bim *.class

