# Change CONFIG to the .mk file that matches your system

CONFIG = system.mk


# Do Not Change anything below this line. It should be setup in config

include ../$(CONFIG)

# this is for revised ntserv/struct.h

#OPT = -g

#CC = cc
CFLAGS = -I../robots $(OPT) $(EXTRAINCS) $(DIRS) $(FLAGS) -DROBOT

LIBS = $(EXTRALIBS)

TOOLDIR= $(LIBDIR)/tools

GETPATH = getpath.o ../ntserv/data.o

LINTFLAGS = -habxc $(EXTRAINCS) $(FLAGS)

#	Common Objects

C_OBJS = ../ntserv/data.o detonate.o  enter.o ../ntserv/getship.o interface.o \
	../ntserv/orbit.o ../ntserv/phaser.o ../ntserv/sintab.o \
	../ntserv/openmem.o  sysdefaults.o ../ntserv/torp.o  \
	../ntserv/util.o $(RANDOMO) ../ntserv/getpath.o ../ntserv/smessage.o \
	roboshar.o ../ntserv/slotmaint.o ../ntserv/distress.o ../ntserv/ltd_stats.o

#	Puck Objects

P_OBJS = puck.o  puckmove.o commands_puck.o $(C_OBJS)

#	Mars (dogfighter) Objects

M_OBJS = mars.o marsmove.o commands_mars.o $(C_OBJS)

#	Robot Objects

R_OBJS = robotII.o rmove.o commands.o $(C_OBJS)

#       basepractice object files

B_OBJS = basep.o commands_basep.o $(C_OBJS)  

#	INL Objects

I_OBJS = inl.o inlcomm.o inlcmds.o gencmds.o $(C_OBJS)


SRCS = puck.c puckmove.c mars.c marsmove.c robotII.c rmove.c \
	../ntserv/getpath.c \
	../ntserv/data.c  detonate.c  ../ntserv/enter.c  \
	../ntserv/getship.c  \
	../ntserv/interface.c \
	../ntserv/orbit.c  ../ntserv/phaser.c ../ntserv/sintab.c \
	../ntserv/openmem.c \
	../ntserv/sysdefaults.c ../ntserv/torp.c \
	../ntserv/util.c $(RANDOMC) ../ntserv/commands.c \
	../ntserv/smessage.c \
	basep.c ../ntserv/wander2.c \
	inl.c inlcomm.c ../ntserv/slotmaint.c inlcmds.c ../ntserv/gencmds.c

EXECS =	puck mars robotII basep inl

all: $(PMAKE) $(EXECS)

puck: $(PMAKE) $(P_OBJS)
	$(CC) $(CFLAGS)  -o puck $(P_OBJS) $(EXTRALIBS) -lm

mars: $(PMAKE) $(M_OBJS)
	$(CC) $(CFLAGS)  -o mars $(M_OBJS) $(EXTRALIBS) -lm

robotII: $(PMAKE) $(R_OBJS)
	$(CC) $(CFLAGS)  -o robotII  $(R_OBJS) $(EXTRALIBS) -lm

basep: $(PMAKE) $(B_OBJS)
	$(CC) $(CFLAGS)  -o basep $(B_OBJS) $(EXTRALIBS) -lm

inl: $(PMAKE) $(I_OBJS)
	$(CC) $(CFLAGS)  -o inl $(I_OBJS) $(EXTRALIBS) -lm

commands_mars.o: $(PMAKE) ../ntserv/commands.c
	$(CC) $(CFLAGS) $(DEP) -DDOG -c ../ntserv/commands.c -o commands_mars.o

commands_puck.o: $(PMAKE) ../ntserv/commands.c
	$(CC) $(CFLAGS) $(DEP) -DPUCK -c ../ntserv/commands.c -o commands_puck.o

gencmds.o: $(PMAKE) ../ntserv/gencmds.c
	$(CC) $(CFLAGS) $(DEP) -c ../ntserv/gencmds.c

sysdefaults.o: $(PMAKE) ../ntserv/sysdefaults.c
	$(CC) $(CFLAGS) $(DEP) -c ../ntserv/sysdefaults.c

interface.o: $(PMAKE) ../ntserv/interface.c
	$(CC) $(CFLAGS) $(DEP) -c ../ntserv/interface.c

enter.o: $(PMAKE) ../ntserv/enter.c
	$(CC) $(CFLAGS) $(DEP) -c ../ntserv/enter.c

commands.o: $(PMAKE) ../ntserv/commands.c
	$(CC) $(CFLAGS) $(DEP) -c ../ntserv/commands.c -o commands.o

commands_basep.o: $(PMAKE) ../ntserv/commands.c
	$(CC) $(CFLAGS) $(DEP) -DBASEP -c ../ntserv/commands.c -o commands_basep.o

clean:: 
	@rm -f *.o *.ln

reallyclean:: clean
	@rm -f $(EXECS) *~ #*# .depend


install: $(EXECS) 
	$(INSTALL) $(INSTALLOPTS) puck $(LIBDIR)/puck
	$(INSTALL) $(INSTALLOPTS) mars $(LIBDIR)/mars
	$(INSTALL) $(INSTALLOPTS) robotII $(LIBDIR)/robotII
	$(INSTALL) $(INSTALLOPTS) basep $(LIBDIR)/basep
	$(INSTALL) $(INSTALLOPTS) inl $(LIBDIR)/inl
	$(INSTALL) $(INSTALLOPTS) end_tourney.pl $(LIBDIR)/end_tourney.pl

updated: update.o ../ntserv/data.o getpath.o
	$(CC) $(CFLAGS) -o updated  update.o data.o getpath.o $(EXTRALIBS)

lint: $(SRCS)
	lint $(LINTFLAGS) -u $?
	touch lint

rmdependencies:
	makedepend

depend::
	touch .depend
	makedepend -f.depend  $(CFLAGS) $(SRCS)

tags::
	@etags $(SRCS)

sinclude .depend
# DO NOT DELETE
