bug report 4.2BSD/ucb/196
[unix-history] / usr / src / lib / Makefile
index e964cf1..0179a45 100644 (file)
@@ -3,7 +3,7 @@
 # All rights reserved.  The Berkeley software License Agreement
 # specifies the terms and conditions for redistribution.
 #
 # All rights reserved.  The Berkeley software License Agreement
 # specifies the terms and conditions for redistribution.
 #
-#      @(#)Makefile    5.5 (Berkeley) %G%
+#      @(#)Makefile    5.10 (Berkeley) %G%
 #
 DESTDIR=
 CFLAGS=        -O
 #
 DESTDIR=
 CFLAGS=        -O
@@ -17,8 +17,8 @@ TAGSDIR=libcurses libdbm libln libm libmp libpc libtermlib
 
 # Programs that live in subdirectories, and have makefiles of their own.
 #
 
 # Programs that live in subdirectories, and have makefiles of their own.
 #
-SUBDIR=        lib2648 libF77 libI77 libU77 libcurses libdbm libg libln \
-       libom libm libmp libpc libplot libtermlib lpr me sendmail
+SUBDIR=        learn lib2648 libF77 libI77 libU77 libcurses libdbm libg libln \
+       libom libm libmp libpc libplot libtermlib liby lpr me sendmail
 
 # Shell scripts that need only be installed and are never removed.
 #
 
 # Shell scripts that need only be installed and are never removed.
 #
@@ -35,9 +35,11 @@ NSTD=
 
 all:   ${SUBDIR} ${STD} ${NSTD}
 
 
 all:   ${SUBDIR} ${STD} ${NSTD}
 
-${SUBDIR}: /tmp
+${SUBDIR}: FRC
        cd $@; make ${MFLAGS}
 
        cd $@; make ${MFLAGS}
 
+FRC:
+
 ${STD}:
        cc ${CFLAGS} -o $@ $@.c
 
 ${STD}:
        cc ${CFLAGS} -o $@ $@.c
 
@@ -45,7 +47,7 @@ install:
        -for i in ${SUBDIR}; do \
                (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
        -for i in ${SCRIPT}; do (install -c $$i.sh ${DESTDIR}/usr/lib/$$i); done
        -for i in ${SUBDIR}; do \
                (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
        -for i in ${SCRIPT}; do (install -c $$i.sh ${DESTDIR}/usr/lib/$$i); done
-       -for i in ${STD} ${NSTD}; do (install $$i ${DESTDIR}/usr/lib/$$i); done
+       -for i in ${STD} ${NSTD}; do (install -s $$i ${DESTDIR}/usr/lib/$$i); done
        install -c lib.b ${DESTDIR}/usr/lib/lib.b
 
 tags:
        install -c lib.b ${DESTDIR}/usr/lib/lib.b
 
 tags:
@@ -59,20 +61,19 @@ clean:
        rm -f ${STD} ${NSTD}
 
 depend:
        rm -f ${STD} ${NSTD}
 
 depend:
-       cat </dev/null >x.c
-       -for i in ${STD} ${NSTD}; do \
-               (echo $$i: $$i.c >>makedep; \
-               /bin/grep '^#[  ]*include' x.c $$i.c | sed \
-                       -e '/\.\.\/h/d' \
-                       -e 's,<\(.*\)>,"/usr/include/\1",' \
-                       -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
-                       -e 's/\.c//' >>makedep); done
+       for i in ${STD} ${NSTD}; do \
+           cc -M ${INCPATH} $$i.c | sed 's/\.o//' | \
+           awk ' { if ($$1 != prev) \
+               { if (rec != "") print rec; rec = $$0; prev = $$1; } \
+               else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
+               else rec = rec " " $$2 } } \
+               END { print rec } ' >> makedep; done
        echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
        echo '$$r makedep' >>eddep
        echo 'w' >>eddep
        cp Makefile Makefile.bak
        ed - Makefile < eddep
        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 x.c
+       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
        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
@@ -81,8 +82,7 @@ depend:
 
 # DO NOT DELETE THIS LINE -- make depend uses it
 
 
 # DO NOT DELETE THIS LINE -- make depend uses it
 
-getNAME: getNAME.c
-getNAME: /usr/include/stdio.h
+getNAME: getNAME.c /usr/include/strings.h /usr/include/stdio.h
 makekey: makekey.c
 # DEPENDENCIES MUST END AT END OF FILE
 # IF YOU PUT STUFF HERE IT WILL GO AWAY
 makekey: makekey.c
 # DEPENDENCIES MUST END AT END OF FILE
 # IF YOU PUT STUFF HERE IT WILL GO AWAY