-depend:
- ls *.c | sed 's;^\([a-zA-Z0-9.]*\)\.c;\1.o: &;' >makedep
- cd ${SRCDIR}; ls ${SRCSRC} | sed \
- -e 's;^\([a-zA-Z0-9.]*\)\.c;\1.o: ${SRCDIR}/&;' \
- >>${BINDIR}/makedep
- /bin/grep '^#[ ]*include' *.h ${SRCDIR}/*.h | sed \
- -e '/<.*>/d' \
- -e 's;\(.*\):[^"]*"\([^"]*\)".*;\1: \2;' >>makedep
- cd ${SRCDIR}; /bin/grep '^#[ ]*include' ${SRCSRC} | sed \
- -e '/<.*>/d' \
- -e 's;:[^"]*"\([^"]*\)".*;: ${SRCDIR}/\1;' \
- -e 's;^\([a-zA-Z0-9.]*\)\.c;\1.o;' \
- -e 's;: ${SRCDIR}/0.h;: 0.h;' \
- -e 's;: ${SRCDIR}/whoami.h;: whoami.h;' \
- -e 's;: ${SRCDIR}/opcode.h;: opcode.h;' >>${BINDIR}/makedep
- /bin/grep '^#[ ]*include' *.c | sed \
- -e '/<.*>/d' \
- -e 's;:[^"]*"\([^"]*\)".*;: ${SRCDIR}/\1;' \
- -e 's;^\([a-zA-Z0-9.]*\)\.c;\1.o;' \
- -e 's;: ${SRCDIR}/0.h;: 0.h;' \
- -e 's;: ${SRCDIR}/whoami.h;: whoami.h;' \
- -e 's;: ${SRCDIR}/opcode.h;: opcode.h;' >>makedep
- echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
- echo '$$r makedep' >>eddep
- echo 'w' >>eddep
- cp Makefile Makefile.bak
- ed - Makefile < eddep
- rm eddep makedep
- echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
- echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
- echo '# see make depend above' >> Makefile