PC mkmake compatibility
[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
df7a539a 47#PC_O = .obj
fc70b5f7
GM
48
49X =
df7a539a
GM
50#PC_X = .exe
51
52L =
53#PC_L = -link
fc70b5f7 54
7ffa2088 55CC = cc
df7a539a 56#PC_CC = cl
dd6c8c3e
GM
57
58MV = mv
df7a539a 59#PC_MV = rename
dd6c8c3e
GM
60
61RM = rm -f
df7a539a 62#PC_RM= erase
dd6c8c3e
GM
63
64LINT_ARGS =
df7a539a 65#PC_LINT_ARGS = -DLINT_ARGS
dd6c8c3e
GM
66
67DEBUG_FLAGS = -g
df7a539a 68#PC_DEBUG_FLAGS = -Zi -Od
dd6c8c3e
GM
69
70AR = ar
df7a539a
GM
71AR1 = cr
72AR2 =
73AR3 =
74#PC_AR = lib
75#PC_AR1 =
76#PC_AR2 = +
77#PC_AR3 = ";"
dd6c8c3e
GM
78
79RANLIB = ranlib
df7a539a 80#PC_RANLIB = echo "Done with "
dd6c8c3e
GM
81
82
7ffa2088 83PRINT = print
eb82b98e 84ACTION = sccs tell
7ffa2088 85
dd6c8c3e 86DEFINES = ${LINT_ARGS}
7ffa2088 87
04b5f59e 88INCLUDES = -I. -I..
7ffa2088
GM
89
90OPTIMIZE = -O
dd6c8c3e 91OPTIMIZE = ${DEBUG_FLAGS}
7ffa2088
GM
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
df7a539a
GM
109#PC_LIBCURSES =
110#PC_LIBTERM =
111
7ffa2088 112# The source files...
eb82b98e 113ALLH = telnet.ext
7ffa2088
GM
114
115TNMAIN = ../telnet.c
116TNMAIN = telnet.c
3d05654e 117MSMAIN = ascii/mset.c
7ffa2088 118
eb82b98e
GM
119ALLC = ${TNMAIN}
120
fc70b5f7 121ALLO = telnet$O mset$O
eb82b98e
GM
122
123ALLPRINT = ${ALLH} ${ALLC}
124
125ALLSOURCE = ${ALLPRINT} makefile makefile.mak README
126
df7a539a
GM
127SYS = sys_curses
128#PC_SYS = sys_dos
dd6c8c3e 129
7ffa2088 130# The places where the various components live...
a63f9327 131
dd6c8c3e 132SUBDIR = api apilib ascii ctlr general ${SYS}
d86829c0 133
eb82b98e
GM
134# The following are directories we don't do regular make's in, but
135# we do make everywhere, print, and sourcelist in.
a63f9327 136
78f0cc47 137EXTRADIR = arpa sys_dos tools utilities
eb82b98e 138
d86829c0 139# The libraries we use. The order here is important.
78f0cc47 140# ctlrlib.a and syslib.a should come first, then apilib.a
d86829c0 141# then the rest.
dd6c8c3e 142SUBLIB = ctlr/ctlrlib.a ${SYS}/syslib.a \
78f0cc47
GM
143 api/apilib.a \
144 ascii/asciilib.a general/generallib.a
7ffa2088 145
7ffa2088
GM
146.s.o:
147 /lib/cpp -E $< | as -o $@
148
dd6c8c3e
GM
149.c.obj:
150 ${CC} ${CFLAGS} -c $<
151
fc70b5f7 152all: FRC tn3270$X mset$X
7ffa2088
GM
153
154FRC:
755c4d48
GM
155 for i in ${SUBDIR}; \
156 do (cd $$i; make ${MFLAGS} "CFLAGS=${CFLAGS}"); done
7ffa2088 157
fc70b5f7
GM
158tn3270$X: telnet$O ${SUBLIB}
159 ${CC} ${CFLAGS} -o tn3270 telnet$O \
df7a539a
GM
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
7ffa2088 171
fc70b5f7 172mset$X: mset$O ascii/map3270$O
df7a539a 173 ${CC} ${CFLAGS} -o mset mset$O ascii/map3270$O $L apilib/apilib.a
7ffa2088 174
fc70b5f7 175telnet$O: $(TNMAIN)
7ffa2088
GM
176 $(CC) $(CFLAGS) -DTN3270 -c $(TNMAIN)
177
fc70b5f7 178mset$O: $(MSMAIN)
7ffa2088
GM
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
a233c85a
GM
191action:
192 ${ACTION}
193
eb82b98e
GM
194everywhere: action
195 for i in ${SUBDIR} ${EXTRADIR}; \
196 do (echo "[$$i]"; cd $$i; make ${MFLAGS} action \
197 "ACTION=${ACTION}"); done
a233c85a 198
7ffa2088 199clean:
dd6c8c3e
GM
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:
78f0cc47
GM
206 -sccs clean
207 -sccs get makefile
dd6c8c3e
GM
208 for i in ${SUBDIR} ${EXTRADIR}; \
209 do (cd $$i; make ${MFLAGS} sccsclean); done
7ffa2088
GM
210
211print:
eb82b98e
GM
212 ${PRINT} ${ALLPRINT}
213 for i in ${SUBDIR} ${EXTRADIR}; \
7ffa2088 214 do (cd $$i; make ${MFLAGS} "PRINT=${PRINT}" print); done
7ffa2088
GM
215
216tags: ${ALLC} ${ALLH}
217 ctags -t ${ALLC} ${ALLH}
218
be140351
GM
219sourcelist: ${ALLSOURCE}
220 @for i in ${ALLSOURCE}; \
78f0cc47 221 do (echo ${DIRPATH}$$i); done
be140351 222 @for i in ${SUBDIR} ${EXTRADIR}; \
78f0cc47 223 do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
eb82b98e
GM
224 sourcelist); done
225
7ffa2088
GM
226lint:
227 lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} -DTN3270 \
228 ${TNMAIN} -lcurses
229 lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} ${MSMAIN} map3270.c -lcurses
230
dfcb0f75 231makefiles.pc:
fc70b5f7 232 for i in . ${SUBDIR} ${EXTRADIR}; \
df7a539a
GM
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); \
fc70b5f7
GM
236 done
237
7ffa2088
GM
238.DEFAULT:
239 sccs get $<
240
241depend: thisdepend
242 for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done
243
244thisdepend:
fc70b5f7
GM
245 echo > eddep.c
246 grep '^#include' ${ALLC} eddep.c | grep -v '<' | \
7ffa2088 247 sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
fc70b5f7 248 -e 's/\.c/$$O/' | \
7ffa2088
GM
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
dd6c8c3e 257 -rm -f makefile.bak
7ffa2088
GM
258 cp makefile makefile.bak
259 ed - makefile < eddep
fc70b5f7 260 rm eddep makedep eddep.c
7ffa2088
GM
261
262# DO NOT DELETE THIS LINE
263
fc70b5f7
GM
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