backward compatible processing for "+/pattern"
[unix-history] / usr / src / usr.bin / learn / Makefile
index 12132fb..fb7cc15 100644 (file)
@@ -1,62 +1,82 @@
-#      @(#)Makefile    4.1     (Berkeley)      83/02/24
 #
 #
-DESTDIR=
-
-LESSONS = files editor morefiles macros eqn C
-
-FILES = lrnref.h \
-       copy.c dounit.c learn.c list.c \
-       makpipe.c maktee.c mem.c mysys.c selsub.c selunit.c \
-       start.c whatnow.c wrapup.c \
-       lcount.c tee.c \
-       makefile
+# Copyright (c) 1987 The Regents of the University of California.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms are permitted
+# provided that the above copyright notice and this paragraph are
+# duplicated in all such forms and that any documentation,
+# advertising materials, and other materials related to such
+# distribution and use acknowledge that the software was developed
+# by the University of California, Berkeley.  The name of the
+# University may not be used to endorse or promote products derived
+# from this software without specific prior written permission.
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+#
+#      @(#)Makefile    4.10 (Berkeley) %G%
+#
+# Flag BSD4_2 means 4.2 or later.
+CFLAGS=        -O -DBSD4_2
+LIBC=  /lib/libc.a
+LLIB=  ${DESTDIR}/usr/lib/learn/bin
+SRCS=  copy.c dounit.c getlesson.c learn.c list.c mem.c makpipe.c maktee.c \
+       mysys.c selsub.c selunit.c start.c whatnow.c wrapup.c
+OBJS=  copy.o dounit.o getlesson.o learn.o list.o mem.o makpipe.o maktee.o \
+       mysys.o selsub.o selunit.o start.o whatnow.o wrapup.o
+LESSONS=C editor eqn files macros morefiles
+MAN=   learn.0
 
 
-OBJECTS = copy.o dounit.o learn.o list.o mem.o \
-       makpipe.o maktee.o mysys.o selsub.o selunit.o \
-       start.o whatnow.o wrapup.o
+all: learn lrntee lcount getline.o getnum.o
 
 
-CFLAGS = -O
-LIBRARY =
-LLIB   = $(DESTDIR)/usr/lib/learn
+learn: ${OBJS} ${LIBC}
+       ${CC} -o $@ ${CFLAGS} ${OBJS}
 
 
-all:   learn tee lcount
-       
-install:       all
-       install -s learn $(DESTDIR)/usr/bin
-       install -s tee $(LLIB)
-       install -s lcount $(LLIB)
-       @echo "Then do 'make play; make log' to make playpen and log directories"
+lcount lrntee: ${LIBC}
+       ${CC} ${CFLAGS} -o $@ $@.c
 
 clean:
 
 clean:
-       rm -f *.o learn tee lcount errs
-
-cmp:   all
-       cmp learn $(DESTDIR)/bin/learn
-       cmp tee $(LLIB)/tee
-       cmp lcount $(LLIB)/lcount
-       rm learn tee lcount *.o
-
-learn: $(OBJECTS)
-       cc -o learn $(CFLAGS) $(OBJECTS) $(LIBRARY)
-
-$(OBJECTS): lrnref.h
+       rm -f ${OBJS} core learn lrntee lcount getline.o getnum.o
 
 
-lcount tee:
-       cc $(CFLAGS) $@.c -o $@ $(LIBRARY)
+cleandir: clean
+       rm -f ${MAN} tags .depend
 
 
-lessons:       $(LESSONS)
+depend: ${SRCS}
+       mkdep -p ${CFLAGS} lcount.c lrntee.c
+       mkdep -a ${CFLAGS} ${SRCS} getline.c getnum.c
 
 
-$(LESSONS):
-       -rm -r $(LLIB)/$@
-       mkdir $(LLIB)/$@
-       (cd $(LLIB)/$@; ar x ../$@.a)
+install: ${MAN}
+       install -c -s -o bin -g bin -m 755 learn ${DESTDIR}/usr/bin/learn
+       install -s -o bin -g bin -m 755 learn ${LLIB}/learn
+       install -s -o bin -g bin -m 755 lrntee ${LLIB}/lrntee
+       install -s -o bin -g bin -m 755 lcount ${LLIB}/lcount
+       install -o bin -g bin -m 644 getline.o ${LLIB}/getline.o
+       install -o bin -g bin -m 644 getnum.o ${LLIB}/getnum.o
+       cd ${LLIB}; rm -f ../C/get*.o; ln getline.o getnum.o ../C
+       install -c -o bin -g bin -m 644 getline.c ${LLIB}/../C/getline.c
+       install -c -o bin -g bin -m 644 getnum.c ${LLIB}/../C/getnum.c
+       chmod 755 ${LLIB}/../*/Init
+       -[ -d ${DESTDIR}/usr/lib/learn ] || mkdir ${DESTDIR}/usr/lib/learn
+       -[ -d ${DESTDIR}/usr/lib/learn/log ] || mkdir ${DESTDIR}/usr/lib/learn/log
+       -[ -d ${DESTDIR}/usr/lib/learn/bin ] || mkdir ${DESTDIR}/usr/lib/learn/bin
+       chmod 755 ${DESTDIR}/usr/lib/learn ${DESTDIR}/usr/lib/learn/log \
+               ${DESTDIR}/usr/lib/learn/bin
+       chown root.staff ${DESTDIR}/usr/lib/learn ${DESTDIR}/usr/lib/learn/log \
+               ${DESTDIR}/usr/lib/learn/bin
+       install -c -o bin -g bin -m 644 learnlib/Linfo ${DESTDIR}/usr/lib/learn/Linfo
+       install -c -o bin -g bin -m 644 learnlib/Xinfo ${DESTDIR}/usr/lib/learn/Xinfo
+       cd learnlib; tar cf - ${LESSONS} | (cd ${DESTDIR}/usr/lib/learn; tar xpf -);
+       install -c -o bin -g bin -m 444 ${MAN} ${DESTDIR}/usr/man/cat1
 
 
-play log:
-       -rm -r $(LLIB)/$@; mkdir $(LLIB)/$@; chmod +w $(LLIB)/$@
+lint: ${SRCS}
+       lint ${CFLAGS} ${SRCS}
+       lint ${CFLAGS} lcount.c
+       lint ${CFLAGS} lrntee.c
+       lint ${CFLAGS} getline.c getnum.c
 
 
-check:
-       -@test -r $(LLIB)/tee || echo 'tee not present; make tee'
-       -@test -r $(LLIB)/lcount || echo 'lcount not present; make lcount'
-       -@test -r $(LLIB)/play || echo 'play directory not present; make play'
-       -@test -r $(LLIB)/log || echo 'log directory not present; make log'
-       -@for i in $(LESSONS); do test -r $(LLIB)/$$i/L0 || echo $$i not unarchived, make $$i; done
+tags: ${SRCS}
+       ctags ${SRCS}
+       ctags -a lcount.c
+       ctags -a lrntee.c
+       ctags -a getline.c getnum.c
+       sort -o tags tags