OBJ = xrand.o gs_main.o
CFLAGS = -O
LIBS = -ll -lm
CC = cc

#
# The BIN directory will contain all files necessary to build an simulator
#
#BIN = /usr/agn/bin
# changed PAF 4/16/89
BIN = /fish/fish/petrisim/bin
#
# To install the stuff do a 'make install'
#
# The installed files are:
#
#    gs_pp  : preprocessor to convert net-descriptions (*.n) files to an
#             include file (sim.h)
#    net2n  : converts GreatSPN *.net files to *.n files
#    def2n  : likewise, but deals with *.def files
#    GS.o   : precompiled simulator modules
#    gs.h   : include file to build the simulator
#    gs.c   : compiles into static simulator structures
#    mk_sim : a shell-script to put it all together
#

all:	gs_pp GS.o net2n def2n

net2n:	net2n.c
	$(CC) $(CFLAGS) -o net2n net2n.c

def2n:	def2n.c
	$(CC) $(CFLAGS) -o def2n def2n.c -ll

gs_pp:	gs_pp.c gs_pp.h gs_pp_lex.c gs_pp_par.c
	$(CC) $(CFLAGS) -o gs_pp gs_pp_par.c $(LIBS)

GS.o:	gs.h gs.c $(OBJ)
	ld -r -o GS.o $(OBJ) -lm

install:
	cp def2n net2n GS.o gs.c gs.h gs_pp $(BIN)
	sed 's+DISTR-DIR+$(BIN)+g' < mk_sim > $(BIN)/mk_sim
	chmod 755 $(BIN)/mk_sim

#
# This is used only for debugging gs
#
test:	sim.h gs.h gs_main.c xrand.o gs.c
	cc -o test -g gs.c gs_main.c xrand.o -lm

sim.h:	gs_pp q.n
	gs_pp < q.n > sim.h
