#### CONFIGURATION

# Which directory to use as root directory during installation. Use only if
# you are packaging.
ifndef DESTDIR
DESTDIR=/
endif

# Where in the system to put the tunneler files.
ifndef PREFIX
PREFIX=/usr/local
endif
ifndef BINDIR
BINDIR=$(PREFIX)/bin
endif
ifndef SYSCONFDIR
SYSCONFDIR=/etc/tunneler
endif
ifndef DATADIR
DATADIR=$(PREFIX)/share/tunneler
endif

# Don't set CC here. Default is fine for most people and I need to override it
# for my system. --pasky
CFLAGS=-Wall -ggdb -DEBUG -DSYSCONFDIR="\"$(SYSCONFDIR)\"" -DDATADIR="\"$(DATADIR)\"" -I..
LD=ld
AR=ar

### CONFIGURATION END

export


SUBDIRS = common server client gameio

COMPILE = $(CC) $(CFLAGS)


all: all-recursive tunserver tunclient

tunserver: server/server.a common/common.a
	$(call cmd,link)

tunclient: client/client.a gameio/gameio.a common/common.a
	$(call cmd,link)


clean: clean-recursive
	rm -rf tunclient tunserver *.so *.o *.log

install: all tunserver tunclient client.cfg server.cfg
	# Yes, we should use /sbin/install, but that's autoconf job to find out
	# whether we can ;-) --joe
	mkdir -p $(DESTDIR)$(BINDIR)
	mkdir -p $(DESTDIR)$(SYSCONFDIR)
	mkdir -p $(DESTDIR)$(DATADIR)
	cp tunserver tunclient $(DESTDIR)$(BINDIR)
	cp client.cfg server.cfg $(DESTDIR)$(SYSCONFDIR)
	cp -a sprites/ $(DESTDIR)$(DATADIR)

-include Makefile.lib
