Add in PC stuff.
[unix-history] / usr / src / usr.bin / tn3270 / makefile
index 3a11b3d..d5314bc 100644 (file)
 #
 #      Here are some which are used throughout the system:
 #
 #
 #      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.
-#
 #      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
 ACTION = sccs tell
 
 PRINT  = print
 ACTION = sccs tell
 
-DEFINES = -DSLOWSCREEN
-DEFINES = -DSLOWSCREEN
+DEFINES = ${LINT_ARGS}
 
 INCLUDES = -I. -I..
 
 OPTIMIZE = -O
 
 INCLUDES = -I. -I..
 
 OPTIMIZE = -O
-OPTIMIZE = -g
+OPTIMIZE = ${DEBUG_FLAGS}
 
 CFLAGS = $(OPTIMIZE) $(INCLUDES) $(DEFINES)
 
 
 CFLAGS = $(OPTIMIZE) $(INCLUDES) $(DEFINES)
 
@@ -67,7 +96,6 @@ CFLAGS        = $(OPTIMIZE) $(INCLUDES) $(DEFINES)
 LINTFLAGS      = -hbxaz
 # How to install the bloody thing...
 
 LINTFLAGS      = -hbxaz
 # How to install the bloody thing...
 
-DIRPATH=.
 DESTDIR=
 
 BINDIR         = $(DESTDIR)/usr/ucb
 DESTDIR=
 
 BINDIR         = $(DESTDIR)/usr/ucb
@@ -78,6 +106,9 @@ MANDIR               = $(DESTDIR)/usr/man/man
 LIBCURSES      = -lcurses
 LIBTERM                = -ltermlib
 
 LIBCURSES      = -lcurses
 LIBTERM                = -ltermlib
 
+#PC_LIBCURSES  =
+#PC_LIBTERM    =
+
 # The source files...
 ALLH = telnet.ext
 
 # The source files...
 ALLH = telnet.ext
 
@@ -87,48 +118,63 @@ MSMAIN = ascii/mset.c
 
 ALLC = ${TNMAIN}
 
 
 ALLC = ${TNMAIN}
 
-ALLO   = telnet.o mset.o
+ALLO   = telnet$O mset$O
 
 ALLPRINT =     ${ALLH} ${ALLC}
 
 ALLSOURCE =    ${ALLPRINT} makefile makefile.mak README
 
 
 ALLPRINT =     ${ALLH} ${ALLC}
 
 ALLSOURCE =    ${ALLPRINT} makefile makefile.mak README
 
+SYS    = sys_curses
+#PC_SYS        = sys_dos
+
 # The places where the various components live...
 # The places where the various components live...
-SUBDIR =       ascii ctlr sys general api
+
+SUBDIR =       api apilib ascii ctlr general ${SYS}
 
 # The following are directories we don't do regular make's in, but
 # we do make everywhere, print, and sourcelist in.
 
 # The following are directories we don't do regular make's in, but
 # we do make everywhere, print, and sourcelist in.
-EXTRADIR =     apilib sys_dos tools
+
+EXTRADIR =     arpa sys_dos tools utilities
 
 # The libraries we use.  The order here is important.
 
 # The libraries we use.  The order here is important.
-# ctlr.lib and sys.lib should come first, then api.lib
+# ctlrlib.a and syslib.a should come first, then apiliblib.a
 # then the rest.
 # then the rest.
-SUBLIB =       ctlr/ctlr.lib sys/sys.lib \
-               api/api.lib \
-               ascii/ascii.lib general/general.lib
-
+SUBLIB =       ctlr/ctlrlib.a ${SYS}/syslib.a \
+               api/apilib.a \
+               ascii/asciilib.a general/generallib.a
 
 .s.o:
        /lib/cpp -E $< | as -o $@
 
 
 .s.o:
        /lib/cpp -E $< | as -o $@
 
-all:   ${SUBDIR} tn3270 mset
+.c.obj:
+       ${CC} ${CFLAGS} -c $<
 
 
-${SUBDIR}: FRC
-       cd $@; make ${MFLAGS} "CFLAGS=${CFLAGS}"
+all:   FRC tn3270$X mset$X
 
 FRC:
 
 FRC:
-
-tn3270:        telnet.o ${SUBLIB}
-       ${CC} ${CFLAGS} -o tn3270 telnet.o \
-               ${SUBLIB} apilib/apilib.a $(LIBCURSES) $(LIBTERM)
-
-mset:  mset.o ascii/map3270.o ascii/astosc.o
-       ${CC} ${CFLAGS} -o mset mset.o ascii/map3270.o ascii/astosc.o
-
-telnet.o:      $(TNMAIN)
+       for i in ${SUBDIR}; \
+               do (cd $$i; make ${MFLAGS} "CFLAGS=${CFLAGS}"); done
+
+tn3270$X:      telnet$O ${SUBLIB}
+       ${CC} ${CFLAGS} -o tn3270 telnet$O \
+               $L ${SUBLIB} apilib/apiliblib.a $(LIBCURSES) $(LIBTERM)
+
+#PC_tn3270$X:
+#PC_   link <@<
+#PC_   telnet
+#PC_   telnet
+#PC_   nul
+#PC_   ${SUBLIB} apilib/apiliblib.a+
+#PC_   \lib\ublib\ubtcp
+#PC_   _PC_<
+
+mset$X:        mset$O ascii/map3270$O
+       ${CC} ${CFLAGS} -o mset mset$O ascii/map3270$O $L apilib/apiliblib.a
+
+telnet$O:      $(TNMAIN)
        $(CC) $(CFLAGS) -DTN3270 -c $(TNMAIN)
 
        $(CC) $(CFLAGS) -DTN3270 -c $(TNMAIN)
 
-mset.o:        $(MSMAIN)
+mset$O:        $(MSMAIN)
        $(CC) $(CFLAGS) -c $(MSMAIN)
 
 install:
        $(CC) $(CFLAGS) -c $(MSMAIN)
 
 install:
@@ -150,10 +196,16 @@ everywhere:       action
                                                "ACTION=${ACTION}"); done
 
 clean:
                                                "ACTION=${ACTION}"); done
 
 clean:
-       rm -f $(ALLO) mset tn3270 errs makefile.bak
-       for i in ${SUBDIR} ${EXTRADIR}; do (cd $$i; make ${MFLAGS} clean); done
-       rm -f t1 tmp/*.o
-       -rmdir tmp
+       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} ${ALLPRINT}
 
 print:
        ${PRINT} ${ALLPRINT}
@@ -165,9 +217,9 @@ tags:       ${ALLC} ${ALLH}
 
 sourcelist:    ${ALLSOURCE}
        @for i in ${ALLSOURCE}; \
 
 sourcelist:    ${ALLSOURCE}
        @for i in ${ALLSOURCE}; \
-               do (echo ${DIRPATH}/$$i); done
+               do (echo ${DIRPATH}$$i); done
        @for i in ${SUBDIR} ${EXTRADIR}; \
        @for i in ${SUBDIR} ${EXTRADIR}; \
-               do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}/$$i" \
+               do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
                                                            sourcelist); done
 
 lint:
                                                            sourcelist); done
 
 lint:
@@ -175,6 +227,16 @@ lint:
                                ${TNMAIN} -lcurses
        lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} ${MSMAIN} map3270.c -lcurses
 
                                ${TNMAIN} -lcurses
        lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} ${MSMAIN} 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 $<
 
@@ -182,9 +244,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 } } \
@@ -193,12 +256,12 @@ 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 general/globals.h telnet.ext ctlr/options.ext
-telnet.o: ctlr/outbound.ext ascii/termin.ext general/general.h
-ascii/mset.o: state.h ../general/globals.h map3270.ext
+telnet$O: ascii/termin.ext ctlr/screen.h ctlr/oia.h ctlr/options.ext
+telnet$O: ctlr/outbound.ext general/globals.h telnet.ext general/general.h