#	Change CONFIG to your .mk file

CONFIG = system.mk

include ../$(CONFIG)

#	Do not edit below here. Everything should be setup in config

#	ntserv object files

R_OBJS =    cluecheck.o  coup.o  data.o  death.o  detonate.o  enter.o \
	    findslot.o  getentry.o  getname.o  getship.o  input.o \
	    interface.o  main.o  orbit.o  phaser.o  plasma.o  redraw.o \
	    reserved.o  sintab.o  socket.o  smessage.o  startrobot.o \
	    sysdefaults.o  timecheck.o  torp.o  util.o  warning.o \
	    $(RSA_OBJS)  ping.o $(RANDOMO) getpath.o $(STRDUPO) features.o \
	    distress.o transwarp.o commands.o openmem.o feature.o queue.o \
            slotmaint.o


#	daemonII object files

D_OBJS =    daemonII.o  sintab.o  sysdefaults.o  data.o  slotmaint.o \
	    util.o  $(RANDOMO) getpath.o getship.o smessage.o  queue.o \
	    wander2.o openmem.o

#	Src files

R_FILES =   cluecheck.c coup.c  data.c  death.c  detonate.c  enter.c \
	    findslot.c  getentry.c  getname.c  getship.c  input.c \
	    interface.c  main.c  orbit.c  phaser.c  plasma.c \
	    redraw.c  reserved.c  sintab.c  socket.c  smessage.c \
	    startrobot.c  timecheck.c  torp.c  util.c  warning.c \
	    $(RANDOMC)  ping.c getpath.c $(STRDUPC) $(RSA_SRC) features.c \
	    distress.c transwarp.c commands.c openmem.c feature.c queue.c \
            slotmaint.c wander2.c


SRC = 	    $(R_FILES)  data.h  defs.h  planets.h  struct.h \
	    packets.h  copyright.h 

LIBS = $(RSA_LIBS) $(EXTRALIBS)

INCS = $(RSA_INCS) $(EXTRAINCS) $(DIRS)

CFLAGS = $(OPT) $(FLAGS) $(INCS)

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


all: $(PMAKE) ntserv daemonII 

ntserv: $(PMAKE) $(R_OBJS) tags
	$(CC) $(CFLAGS)  -o ntserv   $(R_OBJS) $(LIBS)

daemonII: $(PMAKE) $(D_OBJS)
	$(CC) $(CFLAGS)  -o daemonII $(D_OBJS) $(EXTRALIBS)

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

cflags:
	echo "static char cflags[]=\"$(CFLAGS) $(LIBS)\";" >../cflags.h

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

lintall: $(SRC)
	ling $(LINTFLAGS) $(SRC)

clean: rmdependencies
	/bin/rm -f *.o *.ln make.out core

reallyclean:  clean
	rm -f ntserv daemonII .motd *~ #*#


uninstall:
	-cd $(XTREKDIR); rm -f daemonII .motd .sysdef; rm -rf slots
	-cd $(LIBDIR); rm -f ntserv ; rm -rf slots

# parallel compiling in DYNIX:
# uncomment and then /bin/make -P21 parallel
#parallel: c.o.parallel ntserv daemonII nuke xtkill

#c.o.parallel: & $(R_OBJS) $(D_OBJS) nuke.c xtkill.c


# why are these installed SUID? jmn- removed suid
installbin: ntserv daemonII 
	-@if [ ! -d $(LIBDIR) ]; then \
	  /bin/mkdir $(LIBDIR); \
	fi
	$(INSTALL) $(INSTALLOPTS) ntserv $(LIBDIR)/ntserv
	$(INSTALL) $(INSTALLOPTS) daemonII $(LIBDIR)/daemonII
	touch $(LIBDIR)/.planets
	chmod 600 $(LIBDIR)/.planets
	touch $(LIBDIR)/.global


depend:
	makedepend $(CFLAGS) -f Makefile $(SRC) $(D_SRC) $(RSA_SRC) #(M_SRC)

rmdependencies:
	makedepend

tags:
	ctags $(SRC)

#####
# DO NOT DELETE THIS LINE -- make depend depends on it.
