# Makefile for the Santa Fe Stock Market (without the frontend)

BATCH_PRODUCT = market

CC = gcc
CFLAGS = -Wall -g

# Libraries: use -lobjc except under NeXTSTEP
LIBS = -lobjc -lm

default: $(BATCH_PRODUCT)

.SUFFIXES: .m

# Compilation rules:
.m.o:
	$(CC) $(CFLAGS) -c $< 

# The next few lines, down to ALWAYS:, run the newversion script at each
# compilation to update the version number in version.m.  You can delete
# these lines if that gives you any problem.
version.m: ALWAYS
	@newversion

ALWAYS:

BATCH_MAIN = main.o

BATCH_OFILES = agent.o amanager.o bfagent.o bsagent.o control.o dividend.o \
               duagent.o error.o ffagent.o nametree.o output.o random.o \
               schedule.o speclist.o util.o world.o version.o

# Dependencies, generated by gcc -MM with .m's removed
main.o: global.h config.h control.h error.h
agent.o: global.h config.h agent.h amanager.h util.h error.h
amanager.o: global.h config.h agent.h amanager.h procols.h \
 nametree.h output.h random.h error.h util.h
bfagent.o: global.h config.h bfagent.h agent.h amanager.h \
 world.h random.h error.h util.h
bsagent.o: global.h config.h bsagent.h agent.h amanager.h \
 world.h random.h error.h util.h
control.o: global.h config.h control.h amanager.h agent.h dividend.h \
 schedule.h speclist.h world.h output.h random.h error.h util.h version.h
dividend.o: global.h config.h dividend.h procols.h random.h \
 error.h util.h
duagent.o: global.h config.h duagent.h agent.h world.h util.h error.h
error.o: global.h config.h error.h agent.h util.h
ffagent.o: global.h config.h ffagent.h agent.h random.h error.h util.h
nametree.o: config.h nametree.h
output.o: global.h config.h output.h amanager.h agent.h \
 dividend.h speclist.h world.h error.h util.h version.h
random.o: random.h
schedule.o: global.h config.h schedule.h error.h util.h
speclist.o: global.h config.h speclist.h amanager.h agent.h \
 procols.h world.h error.h util.h
util.o: global.h config.h util.h world.h error.h version.h
version.o: global.h config.h version.h
world.o: global.h config.h world.h random.h error.h util.h

$(BATCH_PRODUCT): $(BATCH_MAIN) $(BATCH_OFILES)
	$(CC) $(CFLAGS) -ObjC $(LDFLAGS) $(OTHER_LDFLAGS) -o $(BATCH_PRODUCT) \
	$(BATCH_OFILES) $(BATCH_MAIN) $(OTHER_LIBS) $(LIBS)

clean:
	rm -rf *.o core *~ $(BATCH_PRODUCT) gmon.out log* prices*

