# $Id: Makefile.in,v 1.39 1999/07/14 20:35:29 assar Exp $

srcdir		= @srcdir@
VPATH		= @srcdir@

SHELL		= /bin/sh

CC		= @CC@
CFLAGS		= @CFLAGS@
REALCFLAGS	= -I../include @KRB_INC_FLAGS@ $(CFLAGS)
CPPFLAGS	= @CPPFLAGS@
DEFS		= @DEFS@
LDFLAGS		= @LDFLAGS@
LIBS		= -L../lib/roken -lroken @LIBS@
KAFS_LIBS	= @AFS_EXTRA_LIBS@ @KAFS_LIBS@
KRB_LIBS	= @KRB_LIB_FLAGS@

prefix		= @prefix@
exec_prefix	= @exec_prefix@
bindir		= @bindir@

TEST_PROGRAMS = write-ro-file hello-world read-vs-mmap read-vs-mmap2 \
		mmap-and-read large-dir large-dir2 large-dir3 mountpoint \
		test-setgroups test-setpag hardlink1 hardlink2 mkdir2 \
		create-files create-symlinks create-dirs
TEST_OBJS     = write-ro-file.o read-vs-mmap.o read-vs-mmap2.o \
		mmap-and-read.o large-dir.o large-dir2.o large-dir3.o \
		test-setgroups.o test-setpag.o hardlink1.o hardlink2.o \
		mkdir2.o create-files.o create-symlinks.o create-dirs.o
TEST_SRCS     = write-ro-file.c read-vs-mmap.c read-vs-mmap2.c \
		mmap-and-read.c large-dir.c large-dir2.c large-dir3.o \
		test-setgroups.c test-setpag.c hardlink1.c hardlink2.c \
		mkdir2.c create-files.c create-symlinks.c create-dirs.c

all: run-tests $(TEST_PROGRAMS)

run-tests: run-tests.in
	cd ..; CONFIG_FILES=tests/run-tests CONFIG_HEADERS= $(SHELL) config.status
	@chmod +x run-tests

write-ro-file: write-ro-file.o
	$(CC) $(LDFLAGS) -o $@ write-ro-file.o $(LIBS)

read-vs-mmap: read-vs-mmap.o
	$(CC) $(LDFLAGS) -o $@ read-vs-mmap.o $(LIBS)

read-vs-mmap2: read-vs-mmap2.o
	$(CC) $(LDFLAGS) -o $@ read-vs-mmap2.o $(LIBS)

mmap-and-read: mmap-and-read.o
	$(CC) $(LDFLAGS) -o $@ mmap-and-read.o $(LIBS)

large-dir: large-dir.o
	$(CC) $(LDFLAGS) -o $@ large-dir.o $(LIBS)

large-dir2: large-dir2.o
	$(CC) $(LDFLAGS) -o $@ large-dir2.o $(LIBS)

large-dir3: large-dir3.o
	$(CC) $(LDFLAGS) -o $@ large-dir3.o $(LIBS)

test-setgroups: test-setgroups.o
	$(CC) $(LDFLAGS) -o $@ test-setgroups.o $(KAFS_LIBS) $(KRB_LIBS) $(LIBS)

test-setpag: test-setpag.o
	$(CC) $(LDFLAGS) -o $@ test-setpag.o $(KAFS_LIBS) $(KRB_LIBS) $(LIBS)

hardlink1: hardlink1.o
	$(CC) $(LDFLAGS) -o $@ hardlink1.o $(KAFS_LIBS) $(KRB_LIBS) $(LIBS)

hardlink2: hardlink2.o
	$(CC) $(LDFLAGS) -o $@ hardlink2.o $(KAFS_LIBS) $(KRB_LIBS) $(LIBS)

mkdir2: mkdir2.o
	$(CC) $(LDFLAGS) -o $@ mkdir2.o $(KAFS_LIBS) $(KRB_LIBS) $(LIBS)

create-files: create-files.o
	$(CC) $(LDFLAGS) -o $@ create-files.o $(KAFS_LIBS) $(KRB_LIBS) $(LIBS)

create-symlinks: create-symlinks.o
	$(CC) $(LDFLAGS) -o $@ create-symlinks.o $(KAFS_LIBS) $(KRB_LIBS) $(LIBS)

create-dirs: create-dirs.o
	$(CC) $(LDFLAGS) -o $@ create-dirs.o $(KAFS_LIBS) $(KRB_LIBS) $(LIBS)

.c.o:
	$(CC) -c $(CPPFLAGS) $(DEFS) -I$(srcdir) -I. $(REALCFLAGS) $<

hello-world:   hello-world.in
	sed -e "s!%CC%!$(CC)!" $(srcdir)/hello-world.in > $@
	chmod +x hello-world

mountpoint:   mountpoint.in
	sed -e "s!%bindir%!$(bindir)!" $(srcdir)/mountpoint.in > $@
	chmod +x mountpoint

clean:
	rm -f $(TEST_PROGRAMS) *.o *~

realclean:

distclean:

mostlyclean:

install:

uninstall:


TAGS:	$(TEST_SRCS)
	etags $(TEST_SRCS)

check: run-tests $(TEST_PROGRAMS)
	./run-tests -all

check-fast: run-tests $(TEST_PROGRAMS)
	./run-tests -all -fast

Makefile:	Makefile.in ../config.status
		cd ..; CONFIG_FILES=tests/Makefile CONFIG_HEADERS= $(SHELL) config.status

.PHONY:		all install clean realclean distclean mostlyclean install uninstall check
