#
#ident	"$Id: Makefile,v 1.6 2005/01/04 22:03:15 mikew Exp $"
#
# Connectathon Tests for automounting
#
# to make tests, use 'make'
#

include tests.init

#
# CC, CFLAGS and LILBS to be modified through 'tests.init'
#
EXECS	= autoparse mopendir opendir
TESTS = test1 test2 test3 test4 test5 badnames trailing_space net net1 parser \
	parser-n vers_check proto_check
OTHER = runtests setup autotest
INSTALLDIR = ../bin

INCLUDES=test.h

CFLAGS += -D_FILE_OFFSET_BITS=64

CFLAGS += $(USE_MNTTAB)
CFLAGS += $(USE_STATVFS)
CFLAGS += -DMOUNT_TABLE=\"$(MOUNT_TABLE)\"
CFLAGS += -DUSE_TMPFS_SCAFFOLDING=$(USE_TMPFS_SCAFFOLDING)

all: $(EXECS)

subr.o: subr.c $(INCLUDES)

opendir: opendir.c $(INCLUDES) subr.o mounttable.o
	$(CC) $(CFLAGS) -o $@ $@.c subr.o mounttable.o $(LIBS)

mopendir: mopendir.c $(INCLUDES) subr.o mounttable.o
	$(CC) $(CFLAGS) -o $@ $@.c subr.o mounttable.o $(LIBS)

autoparse: autoparse.c
	$(CC) $(CFLAGS) -o $@ $@.c

domount: domount.c
	$(CC) $(CFLAGS) -o $@ $@.c
	chown root domount
	chmod u+s domount

doautomount: doautomount.c
	$(CC) $(CFLAGS) -o $@ $@.c
	chown root doautomount
	chmod u+s doautomount

install: $(EXECS)
	cp -p $(EXECS) $(TESTS) $(OTHER) $(INSTALLDIR)
	chmod +x $(INSTALLDIR)/runtests
	chmod +x $(INSTALLDIR)/setup
	chmod +x $(INSTALLDIR)/autotest
	chmod +x $(INSTALLDIR)/parser
	chmod +x $(INSTALLDIR)/parser-n
	chmod +x $(INSTALLDIR)/test*
	chmod +x $(INSTALLDIR)/net*
	chmod +x $(INSTALLDIR)/trailing_space
	chmod +x $(INSTALLDIR)/vers_check
	chmod +x $(INSTALLDIR)/proto_check
	chmod +x $(INSTALLDIR)/badnames

clean:
	rm -f *.o $(EXECS) domount doautomount

clobber:
	rm -f *.o $(EXECS) domount doautomount
	rm -f $(INSTALLDIR)/*
