#
# Makfile for ps. -- includes kernel options passed via
#	'make COPTS="${COPTS}" ps'
#

# Load ps as a demand paged object.
CFLAGS	=-O ${COPTS} -UKERNEL -DBSD42 -I../..

CFILES	=	ps.c vmnlist.c

PS_OBJS	=	ps.o vmnlist.o

LIBS	=	/lib/libm.a

#
#	Mathlib and stdio lib
#
LDLIBS	=-lm

INCLUDES=/usr/include/*.h /usr/include/*/*.h

ps:	${PS_OBJS} ${LIBS}
	-rm -f ps;
	${CC} $(CFLAGS) -o ps ps.o vmnlist.o ${LDLIBS}
	-chmod 775 ps

vmnlist.o:	vmnlist.c

ps.o:		ps.c

pstat.o:	pstat.c
	
clean:
	rm -f *.o ps makedep ,err makeout mkout errmsgs

depend:
	rm -f makedep eddep		junk.fileList
	grep '^#include' ${CFILES} >	junk.fileList
	grep '^#include' ${INCLUDES} >>	junk.fileList
	grep -v '<'		  <	junk.fileList | \
	sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
	    -e 's/\.c/.o/' \
	    -e 's,^../[a-zA-Z0-9]*/[a-zA-Z0-9]*\.h,./&,' \
	    -e 's,^../[a-zA-Z0-9]*/,,' \
	    -e 's,\./\.\./,../,' | \
	awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
		       else rec = rec " " $$2 } } \
	      END { print rec } ' > makedep
	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	rm -f makefile.bak
	mv makefile makefile.bak
	cp makefile.bak makefile
	chmod u+w makefile
	ex - makefile < eddep
	rm eddep makedep junk.fileList


# DO NOT DELETE THIS LINE -- make depend uses it

/usr/include/dfs/dfs.h: ../h/errno.h
/usr/include/machine/necuart.h: ../s32/nec7201.h
/usr/include/s32/necuart.h: ../s32/nec7201.h
/usr/include/s32dev/vpreg.h: ../h/ioctl.h
/usr/include/sys/ioctl.h: ../h/ttychars.h ../h/ttydev.h ../white/mouse.h
/usr/include/sys/ioctl.h: ../h/sgtty.h
/usr/include/sys/map.h: ../machine/cpu.h
/usr/include/sys/param.h: ../machine/param.h ../h/signal.h ../h/types.h
/usr/include/sys/sgtty.h: ../h/ioctl.h
/usr/include/sys/stat.h: ../h/types.h
/usr/include/sys/tty.h: ../h/ttychars.h ../h/ttydev.h
/usr/include/sys/user.h: ../machine/pcb.h ../h/dmap.h ../h/time.h
/usr/include/sys/user.h: ../h/resource.h ../h/errno.h
/usr/include/sys/vm.h: ../h/vmparam.h ../h/vmmac.h ../h/vmmeter.h
/usr/include/sys/vm.h: ../h/vmsystm.h
/usr/include/sys/vmparam.h: ../machine/vmparam.h
/usr/include/white/cvreg.h: ../white/config.h
