# $Id: Makefile.in,v 1.64 2000/07/30 17:29:23 assar Exp $

srcdir		= @srcdir@
VPATH		= @srcdir@

SHELL		= /bin/sh

CC		= @CC@
CFLAGS		= @CFLAGS@
REALCFLAGS	= -I../include -I$(srcdir)/../include @KRB4_INC_FLAGS@ $(CFLAGS) \
		  -I../rxdef -I$(srcdir)/../appl/lib
CPPFLAGS	= @CPPFLAGS@
DEFS		= @DEFS@
LDFLAGS		= @LDFLAGS@
LIBS		= -L../lib/roken -lroken @LIBS@
KAFS_LIBS	= @AFS_EXTRA_LIBS@ @KAFS_LIBS@
KRB_LIBS	= @KRB4_LIB_FLAGS@
APPL_LIB	= -L../appl/lib -larlalib -L../lib/ko -lko

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 dup2-and-unlog	 \
		readdir-vs-lstat read-write ga-test create-remove	 \
		symlink echo-n test-parallel1 test-parallel2 create-stat \
		kill-softly kill-softer rm-rf apwd exit-wo-close	 \
		mmap-vs-read mmap-vs-read2 strange-characters-c pine	 \
		append-over-page write-ucc utime-dir mmap-shared-write	 \
		rename5 rename-under-feet

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	   \
		dup2-and-unlog.o readdir-vs-lstat.o read-write.o ga-test.o \
		create-remove.o symlink.o echo-n.o test-parallel1.o	   \
		test-parallel1.o					   \
		create-stat.o kill-softly.o kill-softer.o rm-rf.o apwd.o   \
		exit-wo-close.o mmap-vs-read.o mmap-vs-read2.o		   \
		strange-characters-c.o pine.o append-over-page.o	   \
		write-ucc.o utime-dir.o mmap-shared-write.o rename5.o	   \
		rename-under-feet.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	   \
		dup2-and-unlog.c readdir-vs-lstat.c read-write.c ga-test.c \
		create-remove.c symlink.c echo-n.c test-parallel1.c	   \
		test-parallel2.c	   \				   \
		create-stat.c kill-softly.c kill-softer.c rm-rf.c apwd.c   \
		exit-wo-close.c mmap-vs-read.c mmap-vs-read2.c		   \
		strange-characters-c.c pine.c append-over-page.c	   \
		write-ucc.c utime-dir.c mmap-shared-write.c rename5.c	   \
		rename-under-feet.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-vs-read: mmap-vs-read.o
	$(CC) $(LDFLAGS) -o $@ mmap-vs-read.o $(LIBS)

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

read-write: read-write.o
	$(CC) $(LDFLAGS) -o $@ read-write.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)

ga-test: ga-test.o
	$(CC) $(LDFLAGS) -o $@ ga-test.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)

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


dup2-and-unlog: dup2-and-unlog.o
	$(CC) $(LDFLAGS) -o $@ dup2-and-unlog.o $(KAFS_LIBS) $(KRB_LIBS) $(LIBS)

readdir-vs-lstat: readdir-vs-lstat.o
	$(CC) $(LDFLAGS) -o $@ readdir-vs-lstat.o $(KAFS_LIBS) $(KRB_LIBS) $(LIBS)

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

echo-n: echo-n.o
	$(CC) $(LDFLAGS) -o $@ echo-n.o

test-parallel1: test-parallel1.o
	$(CC) $(LDFLAGS) -o $@ test-parallel1.o  $(LIBS)

test-parallel2: test-parallel2.o
	$(CC) $(LDFLAGS) -o $@ test-parallel2.o  $(LIBS)

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

kill-softly: kill-softly.o
	$(CC) $(LDFLAGS) -o $@ kill-softly.o $(APPL_LIB) $(KAFS_LIBS) $(KRB_LIBS) $(LIBS)

kill-softer: kill-softer.o
	$(CC) $(LDFLAGS) -o $@ kill-softer.o $(APPL_LIB) $(KAFS_LIBS) $(KRB_LIBS) $(LIBS)

rm-rf: rm-rf.o
	$(CC) $(LDFLAGS) -o $@ rm-rf.o $(APPL_LIB) $(KAFS_LIBS) $(KRB_LIBS) $(LIBS)

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

exit-wo-close: exit-wo-close.o
	$(CC) $(LDFLAGS) -o $@ exit-wo-close.o $(APPL_LIB) $(KAFS_LIBS) $(KRB_LIBS) $(LIBS)

strange-characters-c: strange-characters-c.o
	$(CC) $(LDFLAGS) -o $@ strange-characters-c.o $(KRB_LIBS) $(LIBS)

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

append-over-page: append-over-page.o
	$(CC) $(LDFLAGS) -o $@ append-over-page.o $(KRB_LIBS) $(LIBS)

write-ucc: write-ucc.o
	$(CC) $(LDFLAGS) -o $@ write-ucc.o $(KRB_LIBS) $(LIBS)

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

mmap-shared-write: mmap-shared-write.o
	$(CC) $(LDFLAGS) -o $@ mmap-shared-write.o $(KRB_LIBS) $(LIBS)

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

rename-under-feet: rename-under-feet.o
	$(CC) $(LDFLAGS) -o $@ rename-under-feet.o $(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 run-tests $(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
