fix potential bug when cluster allocation fails;
[unix-history] / usr / src / usr.bin / tn3270 / makefile
CommitLineData
7ffa2088
GM
1# Makefile for tn3270 and friends...
2# @(#)makefile 3.1 10/29/86
3#
4# This is the makefile for tn3270. Note that we use ../telnet.c
5# (compiled with special options; see below) to provide the telnet
6# support we need.
7#
8# The following are the defines that may be passed (via the cc
9# -D option) to the compiler.
10#
11# The first group relate only to ../telnet.c:
12#
13# TN3270 - This is to be linked with tn3270. Necessary
14# for creating tn3270.
15#
7ffa2088
GM
16# NOT43 - Allows the program to compile and run on
17# a 4.2BSD system.
18#
19# PUTCHAR - Within tn3270, on a NOT43 system,
20# allows the use of the 4.3 curses
21# (greater speed updating the screen).
22# You need the 4.3 curses for this to work.
23#
24# FD_SETSIZE - On whichever system, if this isn't defined,
25# we patch over the FD_SET, etc., macros with
26# some homebrewed ones.
27#
28# SO_OOBINLINE - This is a socket option which we would like
29# to set to allow TCP urgent data to come
30# to us "inline". This is NECESSARY for
31# CORRECT operation, and desireable for
32# simpler operation.
33#
34# LNOFLSH - Detects the presence of the LNOFLSH bit
35# in the tty structure.
36#
37#
38# Here are some which are used throughout the system:
39#
7ffa2088
GM
40# unix - Compiles in unix specific stuff.
41#
42# msdos - Compiles in msdos specific stuff.
43#
44
fc70b5f7
GM
45# msdos versus unix defines
46O = .o
47PC_O = .obj
48
49X =
50PC_X = .exe
51
7ffa2088 52CC = cc
dd6c8c3e
GM
53PC_CC = cl
54
55MV = mv
56PC_MV = rename
57
58RM = rm -f
59PC_RM= erase
60
61LINT_ARGS =
62PC_LINT_ARGS = -DLINT_ARGS
63
64DEBUG_FLAGS = -g
65PC_DEBUG_FLAGS = -Zi -Od
66
67AR = ar
68C =
69PC_AR = lib
70PC_C = +
71
72RANLIB = ranlib
73PC_RANLIB = echo "Done with "
74
75
7ffa2088 76PRINT = print
eb82b98e 77ACTION = sccs tell
7ffa2088 78
dd6c8c3e 79DEFINES = ${LINT_ARGS}
7ffa2088 80
04b5f59e 81INCLUDES = -I. -I..
7ffa2088
GM
82
83OPTIMIZE = -O
dd6c8c3e 84OPTIMIZE = ${DEBUG_FLAGS}
7ffa2088
GM
85
86CFLAGS = $(OPTIMIZE) $(INCLUDES) $(DEFINES)
87
88# Lint flags
89LINTFLAGS = -hbxaz
90# How to install the bloody thing...
91
92DESTDIR=
93
94BINDIR = $(DESTDIR)/usr/ucb
95ETCDIR = $(DESTDIR)/etc
96MANDIR = $(DESTDIR)/usr/man/man
97
98# Names for the terminal libraries...
99LIBCURSES = -lcurses
100LIBTERM = -ltermlib
101
102# The source files...
eb82b98e 103ALLH = telnet.ext
7ffa2088
GM
104
105TNMAIN = ../telnet.c
106TNMAIN = telnet.c
3d05654e 107MSMAIN = ascii/mset.c
7ffa2088 108
eb82b98e
GM
109ALLC = ${TNMAIN}
110
fc70b5f7 111ALLO = telnet$O mset$O
eb82b98e
GM
112
113ALLPRINT = ${ALLH} ${ALLC}
114
115ALLSOURCE = ${ALLPRINT} makefile makefile.mak README
116
dd6c8c3e
GM
117SYS = sys
118PC_SYS = sys_dos
119
7ffa2088 120# The places where the various components live...
a63f9327 121
dd6c8c3e 122SUBDIR = api apilib ascii ctlr general ${SYS}
d86829c0 123
eb82b98e
GM
124# The following are directories we don't do regular make's in, but
125# we do make everywhere, print, and sourcelist in.
a63f9327 126
78f0cc47 127EXTRADIR = arpa sys_dos tools utilities
eb82b98e 128
d86829c0 129# The libraries we use. The order here is important.
78f0cc47 130# ctlrlib.a and syslib.a should come first, then apilib.a
d86829c0 131# then the rest.
dd6c8c3e 132SUBLIB = ctlr/ctlrlib.a ${SYS}/syslib.a \
78f0cc47
GM
133 api/apilib.a \
134 ascii/asciilib.a general/generallib.a
7ffa2088 135
7ffa2088
GM
136.s.o:
137 /lib/cpp -E $< | as -o $@
138
dd6c8c3e
GM
139.c.obj:
140 ${CC} ${CFLAGS} -c $<
141
fc70b5f7 142all: FRC tn3270$X mset$X
7ffa2088
GM
143
144FRC:
755c4d48
GM
145 for i in ${SUBDIR}; \
146 do (cd $$i; make ${MFLAGS} "CFLAGS=${CFLAGS}"); done
7ffa2088 147
fc70b5f7
GM
148tn3270$X: telnet$O ${SUBLIB}
149 ${CC} ${CFLAGS} -o tn3270 telnet$O \
d86829c0 150 ${SUBLIB} apilib/apilib.a $(LIBCURSES) $(LIBTERM)
7ffa2088 151
fc70b5f7
GM
152mset$X: mset$O ascii/map3270$O
153 ${CC} ${CFLAGS} -o mset mset$O ascii/map3270$O apilib/apilib.a
7ffa2088 154
fc70b5f7 155telnet$O: $(TNMAIN)
7ffa2088
GM
156 $(CC) $(CFLAGS) -DTN3270 -c $(TNMAIN)
157
fc70b5f7 158mset$O: $(MSMAIN)
7ffa2088
GM
159 $(CC) $(CFLAGS) -c $(MSMAIN)
160
161install:
162 install -s tn3270 $(BINDIR)
163 install -s mset $(BINDIR)
164 if [ ! -f ${ETCDIR}/map3270 ]; then \
165 install -c -m 444 map3270.dat ${ETCDIR}/map3270; \
166 fi
167# install -c -m 444 man/tn3270.1 $(MANDIR)1/tn3270.1
168# install -c -m 444 man/mset.1 $(MANDIR)1/mset.1
169# install -c -m 444 man/map3270.5 $(MANDIR)5/map3270.5
170
a233c85a
GM
171action:
172 ${ACTION}
173
eb82b98e
GM
174everywhere: action
175 for i in ${SUBDIR} ${EXTRADIR}; \
176 do (echo "[$$i]"; cd $$i; make ${MFLAGS} action \
177 "ACTION=${ACTION}"); done
a233c85a 178
7ffa2088 179clean:
dd6c8c3e
GM
180 for i in $(ALLO) mset tn3270 errs makefile.bak; \
181 do (${RM} $$i); done
182 for i in ${SUBDIR} ${EXTRADIR}; \
183 do (cd $$i; make ${MFLAGS} clean); done
184
185sccsclean:
78f0cc47
GM
186 -sccs clean
187 -sccs get makefile
dd6c8c3e
GM
188 for i in ${SUBDIR} ${EXTRADIR}; \
189 do (cd $$i; make ${MFLAGS} sccsclean); done
7ffa2088
GM
190
191print:
eb82b98e
GM
192 ${PRINT} ${ALLPRINT}
193 for i in ${SUBDIR} ${EXTRADIR}; \
7ffa2088 194 do (cd $$i; make ${MFLAGS} "PRINT=${PRINT}" print); done
7ffa2088
GM
195
196tags: ${ALLC} ${ALLH}
197 ctags -t ${ALLC} ${ALLH}
198
be140351
GM
199sourcelist: ${ALLSOURCE}
200 @for i in ${ALLSOURCE}; \
78f0cc47 201 do (echo ${DIRPATH}$$i); done
be140351 202 @for i in ${SUBDIR} ${EXTRADIR}; \
78f0cc47 203 do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
eb82b98e
GM
204 sourcelist); done
205
7ffa2088
GM
206lint:
207 lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} -DTN3270 \
208 ${TNMAIN} -lcurses
209 lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} ${MSMAIN} map3270.c -lcurses
210
dfcb0f75 211makefiles.pc:
fc70b5f7
GM
212 for i in . ${SUBDIR} ${EXTRADIR}; \
213 do (sed -e "s/lib\.a/.lib/g" -e "s/^PC_//" < $$i/makefile | \
214 mkmake | sed -e "sx/x\\\\x" > $$i/makefile.mak); \
215 done
216
7ffa2088
GM
217.DEFAULT:
218 sccs get $<
219
220depend: thisdepend
221 for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done
222
223thisdepend:
fc70b5f7
GM
224 echo > eddep.c
225 grep '^#include' ${ALLC} eddep.c | grep -v '<' | \
7ffa2088 226 sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
fc70b5f7 227 -e 's/\.c/$$O/' | \
7ffa2088
GM
228 awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
229 else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
230 else rec = rec " " $$2 } } \
231 END { print rec } ' > makedep
232 echo '$$r makedep' >>eddep
233 echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
234 echo '$$r makedep' >>eddep
235 echo 'w' >>eddep
dd6c8c3e 236 -rm -f makefile.bak
7ffa2088
GM
237 cp makefile makefile.bak
238 ed - makefile < eddep
fc70b5f7 239 rm eddep makedep eddep.c
7ffa2088
GM
240
241# DO NOT DELETE THIS LINE
242
fc70b5f7
GM
243telnet$O: ascii/termin.ext ctlr/screen.h ctlr/oia.h ctlr/options.ext
244telnet$O: ctlr/outbound.ext general/globals.h telnet.ext general/general.h