# /usr/src/etc/etc.mac2/Makefile for MacMach

include /usr/src/COPYRIGHTS

DESTDIR=
CFLAGS=	-O -n
LIBC=	/lib/libc.a

# Programs that live in subdirectories, and have makefiles of their own.
SUBDIR=	newconfig

# Shell scripts that need only be installed and are never removed.
SCRIPT=	newsys

# C sources that live in the current directory
SRCS=	mac2part.c

# C programs that live in the current directory and do not need
# explicit make lines.
STD=	mac2part

all:	.depend ${SUBDIR} ${STD}

${SUBDIR}: FRC
	cd $@; make ${MFLAGS}

${STD}: ${LIBC}
	${CC} ${CFLAGS} -o $@ $@.c

install: FRC
	-for i in ${SUBDIR}; do \
	  (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); \
	done
	-for i in ${SCRIPT}; do \
	  (install -c -o bin -g bin -m 755 $$i.sh ${DESTDIR}/etc/$$i); \
	done
	install -c -s -o bin -g bin -m 755 ${STD} ${DESTDIR}/etc

clean:	FRC
	-for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
	rm -f a.out core *.s *.o ${STD}

compress: clean
	find . -type f ! -name Makefile ! -name '*.Z' -exec compress {} \;

uncompress: FRC
	find . -type f ! -name Makefile -name '*.Z' -exec uncompress {} \;

.depend: ${SRCS}
	@echo "#`date`" >.depend
	mkdep -f .depend ${CFLAGS} ${SRCS}

-include .depend

FRC:
