#
#  Makefile  for system-call tracer program for DEC OSF/1 (nee, Digital UNIX)
#  made in fashion of various similar tools -- SunOS 4.1.x trace, Sun Solaris
#  truss, Linux strace, ...   For some reason Digital does not have this kind
#  of tool...
#
#  Originally by: (1993 or thereabouts..)
#	Anthony Baxter <anthony@aaii.oz.au>
#	Australian Artificial Intelligence Institute, 
#	1 Grattan St, 
#	Carlton, Victoria
#	Australia  3053.
#
#  Latter on developed by Matti Aarnio <mea@nic.funet.fi>
#  at  FUNET archive server (1995-1996)
#

MAINSRCS = 	trace.c sysname.c
PRINTSRCS = 	print_gen.c print_time.c print_signals.c \
		print_mmap.c print_table.c print_io.c print_net.c
HEADERS = 	trace.h signame.h sysname.h ioctltable.h
EXTRAS = 	trace.1 README Makefile ChangeLog ToDo
MAINOBJS = 	trace.o sysname.o
PRINTOBJS = 	print_gen.o print_time.o print_signals.o \
		print_mmap.o print_table.o print_io.o print_net.o \
		print_ioctl.o ioctltable.o

OBJS	= $(MAINOBJS) $(PRINTOBJS)
SRCS	= $(MAINSRCS) $(PRINTSRCS)
PROGS	= trace buildioctl
CC	= cc -migrate -std1
CFLAGS	= -inline speed -O4 -g3
#CC	= gcc -Wall -ansi
#CFLAGS	= -O -g
LDFLAGS	= -g3

all: trace

trace:	$(OBJS)
	$(CC) $(LDFLAGS) $(OBJS) -o $@

dist:
	DIRNAME=`basename \`/bin/pwd\`` && cd .. && tar cvvf $$DIRNAME.tar $$DIRNAME

.c.o:
	$(CC) $(CFLAGS) -c $<

# Fix for the Alpha's broken make utility which doesn't like underscores.
%.c:

print_ioctl.o: print_ioctl.c
ioctltable.o: ioctltable.c ioctltable.h

ioctltable.h: buildioctl
	./buildioctl > ioctltable.h

buildioctl: buildioctl.o
	$(CC) -o buildioctl buildioctl.o

clean:
	-rm -f *.o $(PROGS) core ioctltable.h *~

clobber: clean
	-rm -f trace

depend: $(HEADERS) $(SRCS)
	makedepend $(SRCS)

tar: $(MAINSRCS) $(PRINTSRCS) $(HEADERS) $(EXTRAS)
	tar -cf alpha-trace-1.01.tar $(MAINSRCS) $(PRINTSRCS) $(HEADERS) $(EXTRAS)

ftp: tar
	-rm -f alpha-trace-1.01.tar.gz alpha-trace-1.01.tar.Z
	cp alpha-trace-1.01.tar alpha-trace-1.01.tar-Z
	compress alpha-trace-1.01.tar-Z
	mv alpha-trace-1.01.tar-Z.Z alpha-trace-1.01.tar.Z
	gzip -9 alpha-trace-1.01.tar
	cp alpha-trace-1.01.tar.gz alpha-trace-1.01.tar.Z .Archive/external-ftp/gatekeeper/

# DO NOT DELETE THIS LINE -- make depend depends on it.

