#
# 5799-WZQ (C) COPYRIGHT IBM CORPORATION 1986,1987,1988
# LICENSED MATERIALS - PROPERTY OF IBM
# REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
#
# $Header: /sys/rtdist/etc/RCS/Makefile,v 1.6 1993/05/20 21:01:07 md Exp $ 
# $ACIS:Makefile 12.0$ 
# $Source: /sys/rtdist/etc/RCS/Makefile,v $ 
#
# makefile for miniroot tools
#
LDFLAGS= -N
ALL = onechar syscall
RTSTAND = /usr/src/sys/rtstand

all: ${ALL}

# START-of-big-glob-program

NEWFS_OBJ = mkfs.o newfs.o ifconfig.o route.o mount.o xxxfs.o

newfs: ${NEWFS_OBJ}
	${CC} ${LDFLAGS} -o newfs ${NEWFS_OBJ}

mkfs.o: /usr/src/sbin/newfs/mkfs.c
	${CC} -DMFS -c ${CFLAGS} /usr/src/sbin/newfs/mkfs.c

newfs.o: /usr/src/sbin/newfs/newfs.c
	${CC} -DMFS -Dmain=main_newfs -Dcopyright=copyright_newfs -c \
	${CFLAGS} /usr/src/sbin/newfs/newfs.c

ifconfig.o: /usr/src/sbin/ifconfig/ifconfig.c
	${CC} -Dmain=main_ifconfig -Dcopyright=copyright_ifconfig -c \
		/usr/src/sbin/ifconfig/ifconfig.c

#xxxfs.o: xxxfs.c
#	${CC} -c xxxfs.c

route.o: keywords.h /usr/src/sbin/route/route.c
	${CC} -I${.CURDIR} -Dmain=main_route -Dcopyright=copyright_route \
		-Dusage=usage_route -c /usr/src/sbin/route/route.c

keywords.h: /usr/src/sbin/route/keywords
	sed -e '/^#/d' -e '/^$$/d' /usr/src/sbin/route/keywords > _keywords.tmp
	tr a-z A-Z < _keywords.tmp | paste _keywords.tmp - | \
	    awk '{ \
		if (NF > 1) \
			printf "#define\tK_%s\t%d\n\t{\"%s\", K_%s},\n", \
			    $$2, NR, $$1, $$2 }' \
	    > ${.TARGET}
	rm -f _keywords.tmp

# a non-nfs version.
mount.o: /usr/src/sbin/mount/mount.c
	${CC} -Dmain=main_mount -Dcopyright=copyright_mount \
		-Dusage=usage_mount -c /usr/src/sbin/mount/mount.c

# END-of-big-glob-program

onechar: onechar.o
	${CC} ${LDFLAGS} -o $@ $@.o
	strip $@

syscall.o: syscall.c
	${CC} -DPRINTF -DCTIME -c syscall.c

${RTSTAND}/obj/printf.o:.
	cd $(RTSTAND);make printf.o

${RTSTAND}/obj/parse.o:.
	cd $(RTSTAND);make parse.o

syscall: syscall.o ${RTSTAND}/obj/parse.o ${RTSTAND}/obj/printf.o
	${CC} -N -o syscall syscall.o ${RTSTAND}/obj/parse.o ${RTSTAND}/obj/printf.o
	strip syscall

clean:
	rm -f *.o ${ALL} a.out core
