# autoconf Makefile.in for aatar


SHELL = /bin/sh


PACKAGE_NAME= aatar
PACKAGE_VERSION= 20050730

srcdir = .

prefix = /usr/pkg
exec_prefix = ${prefix}

bindir = ${exec_prefix}/bin
mandir = ${prefix}/man
top_builddir = .

AUTOCONF = ./missing --run autoconf
AUTOHEADER = ./missing --run autoheader
mkinstalldirs = $(SHELL) $(srcdir)/mkinstalldirs
install_sh = $(SHELL) $(srcdir)/install-sh

INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_SCRIPT = ${INSTALL}
INSTALL_HEADER = $(INSTALL_DATA)
transform = s,x,x,
host_alias = 
host_triplet = i386-unknown-netbsdelf3.99.7
CANONICAL_HOST = i386-unknown-netbsdelf3.99.7

PREFIX= /usr/pkg
CFLAGS= -g -O2

CC = gcc
CCLD= $(CC)
LIBS= 
CPPFLAGS= 
DEFS= -DHAVE_CONFIG_H -I. -I. -DHOST=\"$(CANONICAL_HOST)\" -DVERSION=\"$(PACKAGE_VERSION)\"
CFLAGS= -g -O2
LDFLAGS= 

LINK= $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@
COMPILE= $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS)

PROG= aatar
SRCS= aa.c missing.c main.c
OBJS= aa.o missing.o main.o

WARNINGS= -Wall 
CPPFLAGS+= ${WARNINGS} -DPREFIX=\""${PREFIX}\""
LDADD+= -lz -lbz2
MAN= aatar.1

.c.o:   
	$(COMPILE) -c $< -o $@

all: ${PROG}

${PROG}: ${OBJS}
	${CC} ${LDFLAGS} ${OBJS} ${LDADD} -o ${PROG}

clean cleandir:
	rm -f *.o
	rm -f a.out [Ee]rrs mklog core *.core .gdbinit ${PROG}
	rm -f .depend aa.d main.d tags 

install: ${PROG}
	${INSTALL} ${PROG} ${PREFIX}/bin
	${INSTALL} ${MAN} ${PREFIX}/man/man1/

dist:
	cd .. && tar cvzf archangel.tar.gz archangel0
	cd .. && archangel0/aatar cvf archangel.aa archangel0

test: ${PROG}
	@echo "No news is good news"
	@cd tests && rm -f arch.aa O && ln -s Overview O
	@chmod 600 tests/Overview
	@echo "1. Creating archive"
	@cd tests && ../${PROG} -cf arch.aa Makefile Overview O > out.1 2>&1
	@-diff tests/expected.1 tests/out.1
	@echo "2. Listing archive"
	@cd tests && ../${PROG} -tf arch.aa > out.2 2>&1
	@-diff tests/expected.2 tests/out.2
	@echo "3. Verbosely listing archive"
	@cd tests && ../${PROG} -tvf arch.aa | awk '{ print $$1 " " $$2 " " $$3 " " $$4 " " $$5 " " $$9}' > out.3 2>&1
	@-diff tests/expected.3 tests/out.3
	@echo "4. Extracting from archive"
	@cd tests && mkdir t1 && cd t1 && ../../${PROG} -xvf ../arch.aa > ../out.4 2>&1
	@-diff tests/expected.4 tests/out.4
	@echo "5. Listing extraction from archive"
	@cd tests/t1 && ls -al | awk '$$1 == "total" { next }{ print $$1 " " $$2 " " $$3 " " $$4 " " $$9}' > ../out.5 2>&1
	@-diff tests/expected.5 tests/out.5
	@cd tests && rm -rf t1
	@echo "6. Listing archive from stdin"
	@cd tests && ../${PROG} -tvf - < arch.aa | awk '{ print $$1 " " $$2 " " $$3 " " $$4 " " $$5 " " $$9}' > out.6 2>&1
	@-diff tests/expected.6 tests/out.6
	@echo "7. Listing archive with no '-' for options from stdin"
	@cd tests && ../${PROG} tvf - < arch.aa | awk '{ print $$1 " " $$2 " " $$3 " " $$4 " " $$5 " " $$9}' > out.7 2>&1
	@-diff tests/expected.7 tests/out.7
	@echo "8. Taking file list from a file"
	@echo "tests/Makefile" > tests/T
	@echo "tests/O" >> tests/T
	@./${PROG} -cf tests/arch2.aa -T tests/T
	@./${PROG} tvf tests/arch2.aa | awk '{ print $$1 " " $$2 " " $$3 " " $$4 " " $$5 " " $$9}' > tests/out.8 2>&1
	@-diff tests/expected.8 tests/out.8
	@echo "9. Testing list from file and stdin"
	@cp tests/Makefile tests/M2
	@cd tests && ../${PROG} -cf arch3.aa CVS M2 Makefile Overview
	@./${PROG} tvvf tests/arch3.aa > tests/expected.9 2>&1
	@./${PROG} tvvf - < tests/arch3.aa > tests/out.9 2>&1
	@diff tests/expected.9 tests/out.9
	@echo "10. Testing -C arg"
	@cd tests && ../${PROG} -cf arch3.aa CVS M2 Makefile Overview
	@./${PROG} cf tests/arch4.aa -C tests CVS M2 Makefile Overview
	@./${PROG} tvvf tests/arch4.aa > tests/expected.A 2>&1
	@./${PROG} tvvf - < tests/arch4.aa > tests/out.A 2>&1
	@diff tests/expected.A tests/out.A
	@echo "11. Testing zero length file"
	@touch tests/empty
	@./${PROG} cf tests/arch5.aa tests/empty
	@./${PROG} tvf tests/arch5.aa | awk '{ if ($$5 != 0) { printf("bad size %s\n", $$5) } }'
	@rm tests/empty
	@rm -f tests/expected.[9A] tests/out.* tests/arch.aa tests/O tests/T tests/arch?.aa
	@echo "All tests completed"
