PC mkmake compatibility
[unix-history] / usr / src / usr.bin / tn3270 / makefile
... / ...
CommitLineData
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#
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#
40# unix - Compiles in unix specific stuff.
41#
42# msdos - Compiles in msdos specific stuff.
43#
44
45# msdos versus unix defines
46O = .o
47#PC_O = .obj
48
49X =
50#PC_X = .exe
51
52L =
53#PC_L = -link
54
55CC = cc
56#PC_CC = cl
57
58MV = mv
59#PC_MV = rename
60
61RM = rm -f
62#PC_RM= erase
63
64LINT_ARGS =
65#PC_LINT_ARGS = -DLINT_ARGS
66
67DEBUG_FLAGS = -g
68#PC_DEBUG_FLAGS = -Zi -Od
69
70AR = ar
71AR1 = cr
72AR2 =
73AR3 =
74#PC_AR = lib
75#PC_AR1 =
76#PC_AR2 = +
77#PC_AR3 = ";"
78
79RANLIB = ranlib
80#PC_RANLIB = echo "Done with "
81
82
83PRINT = print
84ACTION = sccs tell
85
86DEFINES = ${LINT_ARGS}
87
88INCLUDES = -I. -I..
89
90OPTIMIZE = -O
91OPTIMIZE = ${DEBUG_FLAGS}
92
93CFLAGS = $(OPTIMIZE) $(INCLUDES) $(DEFINES)
94
95# Lint flags
96LINTFLAGS = -hbxaz
97# How to install the bloody thing...
98
99DESTDIR=
100
101BINDIR = $(DESTDIR)/usr/ucb
102ETCDIR = $(DESTDIR)/etc
103MANDIR = $(DESTDIR)/usr/man/man
104
105# Names for the terminal libraries...
106LIBCURSES = -lcurses
107LIBTERM = -ltermlib
108
109#PC_LIBCURSES =
110#PC_LIBTERM =
111
112# The source files...
113ALLH = telnet.ext
114
115TNMAIN = ../telnet.c
116TNMAIN = telnet.c
117MSMAIN = ascii/mset.c
118
119ALLC = ${TNMAIN}
120
121ALLO = telnet$O mset$O
122
123ALLPRINT = ${ALLH} ${ALLC}
124
125ALLSOURCE = ${ALLPRINT} makefile makefile.mak README
126
127SYS = sys_curses
128#PC_SYS = sys_dos
129
130# The places where the various components live...
131
132SUBDIR = api apilib ascii ctlr general ${SYS}
133
134# The following are directories we don't do regular make's in, but
135# we do make everywhere, print, and sourcelist in.
136
137EXTRADIR = arpa sys_dos tools utilities
138
139# The libraries we use. The order here is important.
140# ctlrlib.a and syslib.a should come first, then apilib.a
141# then the rest.
142SUBLIB = ctlr/ctlrlib.a ${SYS}/syslib.a \
143 api/apilib.a \
144 ascii/asciilib.a general/generallib.a
145
146.s.o:
147 /lib/cpp -E $< | as -o $@
148
149.c.obj:
150 ${CC} ${CFLAGS} -c $<
151
152all: FRC tn3270$X mset$X
153
154FRC:
155 for i in ${SUBDIR}; \
156 do (cd $$i; make ${MFLAGS} "CFLAGS=${CFLAGS}"); done
157
158tn3270$X: telnet$O ${SUBLIB}
159 ${CC} ${CFLAGS} -o tn3270 telnet$O \
160 $L ${SUBLIB} apilib/apilib.a $(LIBCURSES) $(LIBTERM)
161
162#PC_tn3270$X:
163 link <@<
164 telnet
165 telnet
166 nul
167 ${SUBLIB} apilib/apilib.a+
168 \lib\ublib\ubtcp
169 _PC_<
170
171
172mset$X: mset$O ascii/map3270$O
173 ${CC} ${CFLAGS} -o mset mset$O ascii/map3270$O $L apilib/apilib.a
174
175telnet$O: $(TNMAIN)
176 $(CC) $(CFLAGS) -DTN3270 -c $(TNMAIN)
177
178mset$O: $(MSMAIN)
179 $(CC) $(CFLAGS) -c $(MSMAIN)
180
181install:
182 install -s tn3270 $(BINDIR)
183 install -s mset $(BINDIR)
184 if [ ! -f ${ETCDIR}/map3270 ]; then \
185 install -c -m 444 map3270.dat ${ETCDIR}/map3270; \
186 fi
187# install -c -m 444 man/tn3270.1 $(MANDIR)1/tn3270.1
188# install -c -m 444 man/mset.1 $(MANDIR)1/mset.1
189# install -c -m 444 man/map3270.5 $(MANDIR)5/map3270.5
190
191action:
192 ${ACTION}
193
194everywhere: action
195 for i in ${SUBDIR} ${EXTRADIR}; \
196 do (echo "[$$i]"; cd $$i; make ${MFLAGS} action \
197 "ACTION=${ACTION}"); done
198
199clean:
200 for i in $(ALLO) mset tn3270 errs makefile.bak; \
201 do (${RM} $$i); done
202 for i in ${SUBDIR} ${EXTRADIR}; \
203 do (cd $$i; make ${MFLAGS} clean); done
204
205sccsclean:
206 -sccs clean
207 -sccs get makefile
208 for i in ${SUBDIR} ${EXTRADIR}; \
209 do (cd $$i; make ${MFLAGS} sccsclean); done
210
211print:
212 ${PRINT} ${ALLPRINT}
213 for i in ${SUBDIR} ${EXTRADIR}; \
214 do (cd $$i; make ${MFLAGS} "PRINT=${PRINT}" print); done
215
216tags: ${ALLC} ${ALLH}
217 ctags -t ${ALLC} ${ALLH}
218
219sourcelist: ${ALLSOURCE}
220 @for i in ${ALLSOURCE}; \
221 do (echo ${DIRPATH}$$i); done
222 @for i in ${SUBDIR} ${EXTRADIR}; \
223 do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
224 sourcelist); done
225
226lint:
227 lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} -DTN3270 \
228 ${TNMAIN} -lcurses
229 lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} ${MSMAIN} map3270.c -lcurses
230
231makefiles.pc:
232 for i in . ${SUBDIR} ${EXTRADIR}; \
233 do (sed -e "s/lib\.a/.lib/g" -e "s/^#PC_//" < $$i/makefile | \
234 mkmake | \
235 sed -e "sx/x\\\\xg" -e "s/[ ]*_PC_//" > $$i/makefile.mak); \
236 done
237
238.DEFAULT:
239 sccs get $<
240
241depend: thisdepend
242 for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done
243
244thisdepend:
245 echo > eddep.c
246 grep '^#include' ${ALLC} eddep.c | grep -v '<' | \
247 sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
248 -e 's/\.c/$$O/' | \
249 awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
250 else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
251 else rec = rec " " $$2 } } \
252 END { print rec } ' > makedep
253 echo '$$r makedep' >>eddep
254 echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
255 echo '$$r makedep' >>eddep
256 echo 'w' >>eddep
257 -rm -f makefile.bak
258 cp makefile makefile.bak
259 ed - makefile < eddep
260 rm eddep makedep eddep.c
261
262# DO NOT DELETE THIS LINE
263
264telnet$O: ascii/termin.ext ctlr/screen.h ctlr/oia.h ctlr/options.ext
265telnet$O: ctlr/outbound.ext general/globals.h telnet.ext general/general.h