srcdir = @srcdir@
prefix = @prefix@
bindir = $(prefix)/bin
 VPATH = @srcdir@
 SHELL = /bin/sh
  
  OBJS = simxd.o server.o sites.o db.o
  SRCS = simxd.c server.c sites.c db.c
 OBJS2 = dis_relay.o
    CC = @CC@
CFLAGS = -I$(srcdir)/.. -I.. -I../lib -I$(srcdir) -I. @SIMX_INCLUDES@ @CFLAGS@ @DEFS@
LDFLAGS = @LDFLAGS@
  LIBS = -L../lib -ldis @DBM@
RPCGEN = rpcgen

# Programs to make tags files.
  ETAGS = etags -tw
  CTAGS = ctags -tw
tagsrcs = $(SRCS)

all:	simxd	dis_relay

simxd.c: ../lib/simmgr.h ../lib/simmgr.x
	rm -f $@
	$(RPCGEN) -s udp -o $@ $(srcdir)/../lib/simmgr.x
	mv $@ tmp.c
	perl -p -e 's/\#include .*simmgr.h"$$/#include "simmgr.h"/' <tmp.c >$@
	rm -f tmp.c

simxd: $(OBJS) ../lib/libdis.a 
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

dis_relay: $(OBJS2) ../lib/libdis.a
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS2) $(LIBS)

clean:
	rm -rf simxd *.o core simxd.c ../lib/simmgr.h TAGS tags *.bak dis_relay

distclean: clean
	rm -f Makefile

depend:
	makedepend $(CFLAGS) $(SRCS)

TAGS:	$(tagsrcs)
	$(ETAGS) $(tagsrcs)

tags:	$(tagsrcs)
	$(CTAGS) $(tagsrcs)

check test:

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