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