BSD 4_3_Net_2 release
[unix-history] / usr / src / usr.bin / tn3270 / makefile
index 82360ba..2fc95a8 100644 (file)
@@ -1,19 +1,17 @@
+#      @(#)makefile    4.9 (Berkeley) 5/8/91
+
 # Makefile for tn3270 and friends...
 # Makefile for tn3270 and friends...
-# @(#)makefile 3.1  10/29/86
 #
 #
-#      This is the makefile for tn3270.  Note that we use ../telnet.c
+#      This is the makefile for tn3270.  Note that we use the 4.3+ telnet
 # (compiled with special options; see below) to provide the telnet
 # support we need.
 #
 #      The following are the defines that may be passed (via the cc
 # -D option) to the compiler.
 #
 # (compiled with special options; see below) to provide the telnet
 # support we need.
 #
 #      The following are the defines that may be passed (via the cc
 # -D option) to the compiler.
 #
-#      The first group relate only to ../telnet.c:
-#
 #      TN3270          -       This is to be linked with tn3270.  Necessary
 #      TN3270          -       This is to be linked with tn3270.  Necessary
-#                              for creating tn3270.
-#
-#      DEBUG           -       Allow for some extra debugging operations.
+#                              for creating tn3270.  Only for compiling
+#                              telnet.
 #
 #      NOT43           -       Allows the program to compile and run on
 #                              a 4.2BSD system.
 #
 #      NOT43           -       Allows the program to compile and run on
 #                              a 4.2BSD system.
 #                              in the tty structure.
 #
 #
 #                              in the tty structure.
 #
 #
-#      Here are some which are used throughout the system:
 #
 #
-#      SLOWSCREEN      -       If SLOWSCREEN is defined, we generate code
-#                              that attempts to optimize the line between
-#                              the computer (on which tn3270 runs) and the
-#                              user's terminal (which line may be 1200 baud,
-#                              or some such) at the cost of CPU time on
-#                              the above referenced computer.
+#      TERMCAP         -       Define this if your system is termcap based,
+#                              otherwise a terminfo based system is assumed.
+#
+#      SRCRT           -       Includes code to allow you to specify
+#                              source routes.
+#                              Format is:
+#                                      [!]@hop1@hop2...[@|:]dst
+#                              Leading ! means strict source route.
+#
+#      NOSTRNCASECMP   -       Define this if you do not have strncasecmp() in
+#                              your C libarary.
+#
+#      USE_TERMIO      -       Define this if you have System V termio
+#                              structures.  What is here is how things
+#                              are on Cray computers.
+#
+#      KLUDGELINEMODE  -       Define this to get the kludged up version
+#                              of linemode that was in 4.3BSD.  This is a
+#                              good thing to have around for talking to
+#                              older systems.
+#
+#
+#      Here are some which are used throughout the system:
 #
 #      unix            -       Compiles in unix specific stuff.
 #
 #      msdos           -       Compiles in msdos specific stuff.
 #
 
 #
 #      unix            -       Compiles in unix specific stuff.
 #
 #      msdos           -       Compiles in msdos specific stuff.
 #
 
+# msdos versus unix defines
+O      = .o
+#PC_O  = .obj
+
+X      =
+#PC_X  = .exe
+
+L      =
+#PC_L  = -link
+
 CC     = cc
 CC     = cc
+#PC_CC = cl
+
+MV     = mv
+#PC_MV = rename
+
+RM     = rm -f
+#PC_RM= erase
+
+LINT_ARGS =
+#PC_LINT_ARGS = -DLINT_ARGS
+
+DEBUG_FLAGS = -g
+#PC_DEBUG_FLAGS = -Zi -Od
+
+AR     = ar
+AR1    = cr
+AR2    =
+AR3    =
+#PC_AR = lib
+#PC_AR1        =
+#PC_AR2        = +
+#PC_AR3        = ";"
+
+RANLIB = ranlib
+#PC_RANLIB = echo "Done with "
+
+
 PRINT  = print
 PRINT  = print
+ACTION = @sccs tell
 
 
-DEFINES = -DSLOWSCREEN
-DEFINES = -DSLOWSCREEN -DDEBUG
+DEFINES= ${LINT_ARGS} -DTERMCAP -DSRCRT -DKLUDGELINEMODE -DUSE_TERMIO
 
 
-INCLUDES = -I.
+INCLUDES = -I. -I..
 
 OPTIMIZE = -O
 
 OPTIMIZE = -O
-OPTIMIZE = -g
+OPTIMIZE = ${DEBUG_FLAGS}
 
 CFLAGS = $(OPTIMIZE) $(INCLUDES) $(DEFINES)
 
 
 CFLAGS = $(OPTIMIZE) $(INCLUDES) $(DEFINES)
 
@@ -70,94 +121,150 @@ LINTFLAGS = -hbxaz
 
 DESTDIR=
 
 
 DESTDIR=
 
-BINDIR         = $(DESTDIR)/usr/ucb
-ETCDIR         = $(DESTDIR)/etc
-MANDIR         = $(DESTDIR)/usr/man/man
+BINDIR         = $(DESTDIR)/usr/bin
+MAN1DIR                = $(DESTDIR)/usr/man/cat1
+MAN5DIR                = $(DESTDIR)/usr/man/cat5
 
 # Names for the terminal libraries...
 LIBCURSES      = -lcurses
 LIBTERM                = -ltermlib
 
 
 # Names for the terminal libraries...
 LIBCURSES      = -lcurses
 LIBTERM                = -ltermlib
 
+#PC_LIBCURSES  =
+#PC_LIBTERM    =
+
 # The source files...
 # The source files...
-ALLH = general.h
+ALLH = telextrn.h
 
 
-TNMAIN = ../telnet.c
-TNMAIN = telnet.c
-MSMAIN = keyboard/mset.c
+MSMAIN = ${.CURDIR}/ascii/mset.c
 
 
-# The places where the various components live...
-SUBDIR =       ascii ctlr keyboard screen system
-SUBLIB =       ascii/asciilib ctlr/ctlrlib keyboard/keyboardlib \
-                       screen/screenlib system/systemlib
+ALLC =
 
 
+ALLO   = mset$O
 
 
-ALLC = ${TNMAIN} ${MSMAIN}
+ALLHC= ${ALLH} ${ALLC}
+ALLPRINT =     ${ALLHC}
 
 
-ALLO   = telnet.o mset.o
+ALLSOURCE =    ${ALLPRINT} makefile makefile.mak makefile_4.2 README \
+               mset.1 tn3270.1 map3270.5
 
 
-.s.o:
-       /lib/cpp -E $< | as -o $@
+SYS    = sys_curses
+#PC_SYS        = sys_dos
 
 
-all:   ${SUBDIR} tn3270.a tn3270 mset
+# The places where the various components live...
 
 
-tn3270.a: ${SUBLIB}
-       -mkdir tmp
-       for i in ${SUBDIR}; do (cd tmp; ar x ../$$i/$${i}lib); done
-       ls tmp/*.o | sort -t/ +1 > t1
-       ar cr tn3270.a `lorder \`cat t1\` | tsort`
-       rm -f t1 tmp/*
-       ranlib tn3270.a
-#      for i in ${SUBDIR}; do (cd tmp; ar x ../$$i/$${i}lib_p); done
-#      ls tmp/*.o | sort -t/ +1 > t1
-#      ar cr tn3270_p.a `lorder \`cat t1\` | tsort`
-#      rm -rf t1 tmp
+SUBDIR =       ${.CURDIR}/api ${.CURDIR}/ascii ${.CURDIR}/ctlr \
+               ${.CURDIR}/general ${.CURDIR}/${SYS} ${.CURDIR}/telnet
 
 
-${SUBDIR}: FRC
-       cd $@; make ${MFLAGS} "CFLAGS=${CFLAGS}"
+# The following are directories we don't do regular make's in, but
+# we do make everywhere, print, and sourcelist in.
 
 
-FRC:
+EXTRADIR =     ${.CURDIR}/tools
 
 
-tn3270:        telnet.o tn3270.a
-       ${CC} ${CFLAGS} -o tn3270 telnet.o tn3270.a $(LIBCURSES) $(LIBTERM)
+# The libraries we use.  The order here is important.
+# syslib.a and ctlrlib.a should come first, then the rest.
+SUBLIB =       ${SYS}/syslib.a ctlr/ctlrlib.a \
+               ascii/asciilib.a general/generallib.a
 
 
-mset:  mset.o tn3270.a
-       ${CC} ${CFLAGS} -o mset mset.o keyboard/map3270.o $(LIBCURSES)
+.s.o:
+       /lib/cpp -E $< | as -o $@
+
+#.c.obj:
+#      ${CC} ${CFLAGS} -c $<
 
 
-telnet.o:      $(TNMAIN)
-       $(CC) $(CFLAGS) -DTN3270 -c $(TNMAIN)
+all:   FRC tn3270$X mset$X
 
 
-mset.o:        $(MSMAIN)
+FRC:
+       for i in ${SUBDIR}; \
+               do (cd $$i; make ${MFLAGS} "CFLAGS=${CFLAGS}"); done
+
+tn3270$X:      telnet/telprog.o ${SUBLIB} api/libapi.a
+       ${CC} ${CFLAGS} -o tn3270 telnet/telprog.o \
+               $L ${SUBLIB} api/libapi.a $(LIBCURSES) $(LIBTERM) \
+               -lcompat
+
+#PC_tn3270$X:
+#PC_   link <@<
+#PC_   telnet
+#PC_   tn3270
+#PC_   nul
+#PC_   ${SUBLIB} api/libapi.a+
+#PC_   \lib\ublib\ubtcp
+#PC_   _PC_<
+
+mset$X:        mset$O ascii/map3270$O
+       ${CC} ${CFLAGS} -o mset mset$O ascii/map3270$O $L api/libapi.a
+
+mset$O:        $(MSMAIN)
        $(CC) $(CFLAGS) -c $(MSMAIN)
 
        $(CC) $(CFLAGS) -c $(MSMAIN)
 
-install:
-       install -s tn3270 $(BINDIR)
-       install -s mset $(BINDIR)
-       if [ ! -f ${ETCDIR}/map3270 ]; then \
-               install -c -m 444 map3270.dat ${ETCDIR}/map3270; \
-       fi
-#      install -c -m 444 man/tn3270.1 $(MANDIR)1/tn3270.1
-#      install -c -m 444 man/mset.1 $(MANDIR)1/mset.1
-#      install -c -m 444 man/map3270.5 $(MANDIR)5/map3270.5
-
-clean:
-       rm -f $(ALLO) mset tn3270 errs makefile.bak tn3270.a
-       for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
-       rm -f t1 tmp/*.o
-       -rmdir tmp
+install:       tn3270$X mset$X tn3270.0 mset.0 map3270.0
+       install -m 755 -o bin -g bin -s tn3270 $(BINDIR)
+       install -m 755 -o bin -g bin -s mset $(BINDIR)
+       install -c -o bin -g bin -m 444 tn3270.0 mset.0 $(MAN1DIR)
+       install -c -o bin -g bin -m 444 map3270.0 $(MAN5DIR)
+
+action:
+       ${ACTION}
+
+clist: ${ALLHC}
+       @for i in ${SUBDIR}; \
+               do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
+                                                           clist); done
+
+hclist:        ${ALLHC}
+       @for i in ${SUBDIR}; \
+               do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
+                                                           hclist); done
+
+everywhere:    action
+       for i in ${SUBDIR} ${EXTRADIR}; \
+               do (echo "[$$i]"; cd $$i; make ${MFLAGS} action \
+                                               "ACTION=${ACTION}"); done
+
+cleandir clean:
+       for i in $(ALLO) mset tn3270 errs makefile.bak; \
+                       do (${RM} $$i); done
+       for i in ${SUBDIR} ${EXTRADIR}; \
+                       do (cd $$i; make ${MFLAGS} clean); done
+
+sccsclean:
+       -sccs clean
+       -sccs get makefile
+       for i in ${SUBDIR} ${EXTRADIR}; \
+                       do (cd $$i; make ${MFLAGS} sccsclean); done
 
 print:
 
 print:
-       ${PRINT} ${ALLH} ${MSMAIN} ${TNMAIN}
-       for i in ${SUBDIR}; \
+       ${PRINT} ${ALLPRINT}
+       for i in ${SUBDIR} ${EXTRADIR}; \
                        do (cd $$i; make ${MFLAGS} "PRINT=${PRINT}" print); done
                        do (cd $$i; make ${MFLAGS} "PRINT=${PRINT}" print); done
-       cd tools; make ${MFLAGS} "PRINT=${PRINT}" print
 
 tags:  ${ALLC} ${ALLH}
 
 tags:  ${ALLC} ${ALLH}
-       ctags -t ${ALLC} ${ALLH}
+       ctags -t `make ${MFLAGS} hclist`
+
+sourcelist:    ${ALLSOURCE}
+       @for i in ${ALLSOURCE}; \
+               do (echo ${DIRPATH}$$i); done
+       @for i in ${SUBDIR} ${EXTRADIR}; \
+               do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
+                                                           sourcelist); done
 
 lint:
 
 lint:
-       lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} -DTN3270 \
-                               ${TNMAIN} -lcurses
-       lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} ${MSMAIN} map3270.c -lcurses
+       lint ${LINTFLAGS} -Itelnet ${INCLUDES} ${DEFINES} -DTN3270 \
+                               `make clist` -lcurses
+
+lintmset:
+       lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} ${MSMAIN} \
+                               ascii/map3270.c -lcurses
+
+makefiles.pc:  tools/mkmake
+       for i in . ${SUBDIR} ${EXTRADIR}; \
+       do (sed -e "s/lib\.a/.lib/g" -e "s/^#PC_//" < $$i/makefile | \
+               ./tools/mkmake | \
+               sed -e "sx/x\\\\xg" -e "s/[     ]*_PC_//" > $$i/makefile.mak); \
+           done
+
+tools/mkmake:
+       (cd tools; make mkmake)
 
 .DEFAULT:
        sccs get $<
 
 .DEFAULT:
        sccs get $<
@@ -166,9 +273,10 @@ depend:    thisdepend
        for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done
 
 thisdepend:
        for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done
 
 thisdepend:
-       grep '^#include' ${ALLC} | grep -v '<' | \
+       echo > eddep.c
+       grep '^#include' ${ALLC} eddep.c | grep -v '<' | \
        sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
        sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
-           -e 's/\.c/.o/' | \
+           -e 's/\.c/$$O/' | \
        awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                       else rec = rec " " $$2 } } \
        awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
                else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
                       else rec = rec " " $$2 } } \
@@ -177,13 +285,10 @@ thisdepend:
        echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
        echo '$$r makedep' >>eddep
        echo 'w' >>eddep
        echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
        echo '$$r makedep' >>eddep
        echo 'w' >>eddep
+       -rm -f makefile.bak
        cp makefile makefile.bak
        ed - makefile < eddep
        cp makefile makefile.bak
        ed - makefile < eddep
-       rm eddep makedep
+       rm eddep makedep eddep.c
 
 # DO NOT DELETE THIS LINE
 
 
 # DO NOT DELETE THIS LINE
 
-telnet.o: ctlr/screen.h system/globals.h telnet.ext ctlr/options.ext
-telnet.o: ctlr/outbound.ext keyboard/termin.ext
-keyboard/mset.o: keyboard/state.h keyboard/m4.out ../system/globals.h
-keyboard/mset.o: keyboard/map3270.ext