xref: /original-bsd/usr.bin/tn3270/makefile (revision ba762ddc)
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 the above copyright notice and this paragraph are
7# duplicated in all such forms and that any documentation,
8# advertising materials, and other materials related to such
9# distribution and use acknowledge that the software was developed
10# by the University of California, Berkeley.  The name of the
11# University may not be used to endorse or promote products derived
12# from this software without specific prior written permission.
13# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16#
17#	@(#)makefile	4.8 (Berkeley) 04/25/91
18#
19
20# Makefile for tn3270 and friends...
21#
22#	This is the makefile for tn3270.  Note that we use the 4.3+ telnet
23# (compiled with special options; see below) to provide the telnet
24# support we need.
25#
26#	The following are the defines that may be passed (via the cc
27# -D option) to the compiler.
28#
29#	TN3270		- 	This is to be linked with tn3270.  Necessary
30#				for creating tn3270.  Only for compiling
31#				telnet.
32#
33#	NOT43		-	Allows the program to compile and run on
34#				a 4.2BSD system.
35#
36#	PUTCHAR		-	Within tn3270, on a NOT43 system,
37#				allows the use of the 4.3 curses
38#				(greater speed updating the screen).
39#				You need the 4.3 curses for this to work.
40#
41#	FD_SETSIZE	-	On whichever system, if this isn't defined,
42#				we patch over the FD_SET, etc., macros with
43#				some homebrewed ones.
44#
45#	SO_OOBINLINE	-	This is a socket option which we would like
46#				to set to allow TCP urgent data to come
47#				to us "inline".  This is NECESSARY for
48#				CORRECT operation, and desireable for
49#				simpler operation.
50#
51#	LNOFLSH		-	Detects the presence of the LNOFLSH bit
52#				in the tty structure.
53#
54#
55#
56#	TERMCAP		-	Define this if your system is termcap based,
57#				otherwise a terminfo based system is assumed.
58#
59#	SRCRT		-	Includes code to allow you to specify
60#				source routes.
61#				Format is:
62#					[!]@hop1@hop2...[@|:]dst
63#				Leading ! means strict source route.
64#
65#	NOSTRNCASECMP	-	Define this if you do not have strncasecmp() in
66#				your C libarary.
67#
68#	USE_TERMIO	-	Define this if you have System V termio
69#				structures.  What is here is how things
70#				are on Cray computers.
71#
72#	KLUDGELINEMODE	-	Define this to get the kludged up version
73#				of linemode that was in 4.3BSD.  This is a
74#				good thing to have around for talking to
75#				older systems.
76#
77#
78#	Here are some which are used throughout the system:
79#
80#	unix		-	Compiles in unix specific stuff.
81#
82#	msdos		-	Compiles in msdos specific stuff.
83#
84
85# msdos versus unix defines
86O	= .o
87#PC_O	= .obj
88
89X	=
90#PC_X	= .exe
91
92L	=
93#PC_L	= -link
94
95CC	= cc
96#PC_CC	= cl
97
98MV	= mv
99#PC_MV	= rename
100
101RM	= rm -f
102#PC_RM= erase
103
104LINT_ARGS =
105#PC_LINT_ARGS = -DLINT_ARGS
106
107DEBUG_FLAGS = -g
108#PC_DEBUG_FLAGS = -Zi -Od
109
110AR	= ar
111AR1	= cr
112AR2	=
113AR3	=
114#PC_AR	= lib
115#PC_AR1	=
116#PC_AR2	= +
117#PC_AR3	= ";"
118
119RANLIB	= ranlib
120#PC_RANLIB = echo "Done with "
121
122
123PRINT	= print
124ACTION = @sccs tell
125
126DEFINES= ${LINT_ARGS} -DTERMCAP -DSRCRT -DKLUDGELINEMODE -DUSE_TERMIO
127
128INCLUDES = -I. -I..
129
130OPTIMIZE = -O
131OPTIMIZE = ${DEBUG_FLAGS}
132
133CFLAGS	= $(OPTIMIZE) $(INCLUDES) $(DEFINES)
134
135# Lint flags
136LINTFLAGS	= -hbxaz
137# How to install the bloody thing...
138
139DESTDIR=
140
141BINDIR		= $(DESTDIR)/usr/bin
142MAN1DIR		= $(DESTDIR)/usr/man/cat1
143MAN5DIR		= $(DESTDIR)/usr/man/cat5
144
145# Names for the terminal libraries...
146LIBCURSES	= -lcurses
147LIBTERM		= -ltermlib
148
149#PC_LIBCURSES	=
150#PC_LIBTERM	=
151
152# The source files...
153ALLH =	telextrn.h
154
155MSMAIN = ${.CURDIR}/ascii/mset.c
156
157ALLC =
158
159ALLO	= mset$O
160
161ALLHC=	${ALLH} ${ALLC}
162ALLPRINT =	${ALLHC}
163
164ALLSOURCE =	${ALLPRINT} makefile makefile.mak makefile_4.2 README \
165		mset.1 tn3270.1 map3270.5
166
167SYS	= sys_curses
168#PC_SYS	= sys_dos
169
170# The places where the various components live...
171
172SUBDIR =	${.CURDIR}/api ${.CURDIR}/ascii ${.CURDIR}/ctlr \
173		${.CURDIR}/general ${.CURDIR}/${SYS} ${.CURDIR}/telnet
174
175# The following are directories we don't do regular make's in, but
176# we do make everywhere, print, and sourcelist in.
177
178EXTRADIR =	${.CURDIR}/tools
179
180# The libraries we use.  The order here is important.
181# syslib.a and ctlrlib.a should come first, then the rest.
182SUBLIB =	${SYS}/syslib.a ctlr/ctlrlib.a \
183		ascii/asciilib.a general/generallib.a
184
185.s.o:
186	/lib/cpp -E $< | as -o $@
187
188#.c.obj:
189#	${CC} ${CFLAGS} -c $<
190
191all:	FRC tn3270$X mset$X
192
193FRC:
194	for i in ${SUBDIR}; \
195		do (cd $$i; make ${MFLAGS} "CFLAGS=${CFLAGS}"); done
196
197tn3270$X:	telnet/telprog.o ${SUBLIB} api/libapi.a
198	${CC} ${CFLAGS} -o tn3270 telnet/telprog.o \
199		$L ${SUBLIB} api/libapi.a $(LIBCURSES) $(LIBTERM) \
200		-lcompat
201
202#PC_tn3270$X:
203#PC_	link <@<
204#PC_	telnet
205#PC_	tn3270
206#PC_	nul
207#PC_	${SUBLIB} api/libapi.a+
208#PC_	\lib\ublib\ubtcp
209#PC_	_PC_<
210
211mset$X:	mset$O ascii/map3270$O
212	${CC} ${CFLAGS} -o mset mset$O ascii/map3270$O $L api/libapi.a
213
214mset$O:	$(MSMAIN)
215	$(CC) $(CFLAGS) -c $(MSMAIN)
216
217install:	tn3270$X mset$X tn3270.0 mset.0 map3270.0
218	install -m 755 -o bin -g bin -s tn3270 $(BINDIR)
219	install -m 755 -o bin -g bin -s mset $(BINDIR)
220	install -c -o bin -g bin -m 444 tn3270.0 mset.0 $(MAN1DIR)
221	install -c -o bin -g bin -m 444 map3270.0 $(MAN5DIR)
222
223action:
224	${ACTION}
225
226clist:	${ALLHC}
227	@for i in ${SUBDIR}; \
228		do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
229							    clist); done
230
231hclist:	${ALLHC}
232	@for i in ${SUBDIR}; \
233		do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
234							    hclist); done
235
236everywhere:	action
237	for i in ${SUBDIR} ${EXTRADIR}; \
238		do (echo "[$$i]"; cd $$i; make ${MFLAGS} action \
239						"ACTION=${ACTION}"); done
240
241cleandir clean:
242	for i in $(ALLO) mset tn3270 errs makefile.bak; \
243			do (${RM} $$i); done
244	for i in ${SUBDIR} ${EXTRADIR}; \
245			do (cd $$i; make ${MFLAGS} clean); done
246
247sccsclean:
248	-sccs clean
249	-sccs get makefile
250	for i in ${SUBDIR} ${EXTRADIR}; \
251			do (cd $$i; make ${MFLAGS} sccsclean); done
252
253print:
254	${PRINT} ${ALLPRINT}
255	for i in ${SUBDIR} ${EXTRADIR}; \
256			do (cd $$i; make ${MFLAGS} "PRINT=${PRINT}" print); done
257
258tags:	${ALLC} ${ALLH}
259	ctags -t `make ${MFLAGS} hclist`
260
261sourcelist:	${ALLSOURCE}
262	@for i in ${ALLSOURCE}; \
263		do (echo ${DIRPATH}$$i); done
264	@for i in ${SUBDIR} ${EXTRADIR}; \
265		do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
266							    sourcelist); done
267
268lint:
269	lint ${LINTFLAGS} -Itelnet ${INCLUDES} ${DEFINES} -DTN3270 \
270				`make clist` -lcurses
271
272lintmset:
273	lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} ${MSMAIN} \
274				ascii/map3270.c -lcurses
275
276makefiles.pc:	tools/mkmake
277	for i in . ${SUBDIR} ${EXTRADIR}; \
278	do (sed -e "s/lib\.a/.lib/g" -e "s/^#PC_//" < $$i/makefile | \
279		./tools/mkmake | \
280		sed -e "sx/x\\\\xg" -e "s/[ 	]*_PC_//" > $$i/makefile.mak); \
281	    done
282
283tools/mkmake:
284	(cd tools; make mkmake)
285
286.DEFAULT:
287	sccs get $<
288
289depend:	thisdepend
290	for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done
291
292thisdepend:
293	echo > eddep.c
294	grep '^#include' ${ALLC} eddep.c | grep -v '<' | \
295	sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
296	    -e 's/\.c/$$O/' | \
297	awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
298		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
299		       else rec = rec " " $$2 } } \
300	      END { print rec } ' > makedep
301	echo '$$r makedep' >>eddep
302	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
303	echo '$$r makedep' >>eddep
304	echo 'w' >>eddep
305	-rm -f makefile.bak
306	cp makefile makefile.bak
307	ed - makefile < eddep
308	rm eddep makedep eddep.c
309
310# DO NOT DELETE THIS LINE
311
312