xref: /original-bsd/usr.bin/tn3270/makefile (revision e277ffea)
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.5 (Berkeley) 09/02/89
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
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 = 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 =	api ascii ctlr general ${SYS} telnet
173
174# The following are directories we don't do regular make's in, but
175# we do make everywhere, print, and sourcelist in.
176
177EXTRADIR =	arpa sys_dos tools utilities
178
179# The libraries we use.  The order here is important.
180# syslib.a and ctlrlib.a should come first, then the rest.
181SUBLIB =	${SYS}/syslib.a ctlr/ctlrlib.a \
182		ascii/asciilib.a general/generallib.a
183
184.s.o:
185	/lib/cpp -E $< | as -o $@
186
187.c.obj:
188	${CC} ${CFLAGS} -c $<
189
190all:	FRC tn3270$X mset$X
191
192FRC:
193	for i in ${SUBDIR}; \
194		do (cd $$i; make ${MFLAGS} "CFLAGS=${CFLAGS}"); done
195
196tn3270$X:	telnet/telprog.o ${SUBLIB} api/apilib.a
197	${CC} ${CFLAGS} -o tn3270 telnet/telprog.o \
198		$L ${SUBLIB} api/apilib.a $(LIBCURSES) $(LIBTERM) \
199		-lcompat
200
201#PC_tn3270$X:
202#PC_	link <@<
203#PC_	telnet
204#PC_	tn3270
205#PC_	nul
206#PC_	${SUBLIB} api/apilib.a+
207#PC_	\lib\ublib\ubtcp
208#PC_	_PC_<
209
210mset$X:	mset$O ascii/map3270$O
211	${CC} ${CFLAGS} -o mset mset$O ascii/map3270$O $L api/apilib.a
212
213mset$O:	$(MSMAIN)
214	$(CC) $(CFLAGS) -c $(MSMAIN)
215
216install:	tn3270$X mset$X tn3270.0 mset.0 map3270.0
217	install -m 755 -o bin -g bin -s tn3270 $(BINDIR)
218	install -m 755 -o bin -g bin -s mset $(BINDIR)
219	install -c -o bin -g bin -m 444 tn3270.0 mset.0 $(MAN1DIR)
220	install -c -o bin -g bin -m 444 map3270.0 $(MAN5DIR)
221
222action:
223	${ACTION}
224
225clist:	${ALLHC}
226	@for i in ${SUBDIR}; \
227		do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
228							    clist); done
229
230hclist:	${ALLHC}
231	@for i in ${SUBDIR}; \
232		do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
233							    hclist); done
234
235everywhere:	action
236	for i in ${SUBDIR} ${EXTRADIR}; \
237		do (echo "[$$i]"; cd $$i; make ${MFLAGS} action \
238						"ACTION=${ACTION}"); done
239
240cleandir clean:
241	for i in $(ALLO) mset tn3270 errs makefile.bak; \
242			do (${RM} $$i); done
243	for i in ${SUBDIR} ${EXTRADIR}; \
244			do (cd $$i; make ${MFLAGS} clean); done
245
246sccsclean:
247	-sccs clean
248	-sccs get makefile
249	for i in ${SUBDIR} ${EXTRADIR}; \
250			do (cd $$i; make ${MFLAGS} sccsclean); done
251
252print:
253	${PRINT} ${ALLPRINT}
254	for i in ${SUBDIR} ${EXTRADIR}; \
255			do (cd $$i; make ${MFLAGS} "PRINT=${PRINT}" print); done
256
257tags:	${ALLC} ${ALLH}
258	ctags -t `make ${MFLAGS} hclist`
259
260sourcelist:	${ALLSOURCE}
261	@for i in ${ALLSOURCE}; \
262		do (echo ${DIRPATH}$$i); done
263	@for i in ${SUBDIR} ${EXTRADIR}; \
264		do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
265							    sourcelist); done
266
267lint:
268	lint ${LINTFLAGS} -Itelnet ${INCLUDES} ${DEFINES} -DTN3270 \
269				`make clist` -lcurses
270
271lintmset:
272	lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} ${MSMAIN} \
273				ascii/map3270.c -lcurses
274
275makefiles.pc:	tools/mkmake
276	for i in . ${SUBDIR} ${EXTRADIR}; \
277	do (sed -e "s/lib\.a/.lib/g" -e "s/^#PC_//" < $$i/makefile | \
278		./tools/mkmake | \
279		sed -e "sx/x\\\\xg" -e "s/[ 	]*_PC_//" > $$i/makefile.mak); \
280	    done
281
282tools/mkmake:
283	(cd tools; make mkmake)
284
285.DEFAULT:
286	sccs get $<
287
288depend:	thisdepend
289	for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done
290
291thisdepend:
292	echo > eddep.c
293	grep '^#include' ${ALLC} eddep.c | grep -v '<' | \
294	sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
295	    -e 's/\.c/$$O/' | \
296	awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
297		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
298		       else rec = rec " " $$2 } } \
299	      END { print rec } ' > makedep
300	echo '$$r makedep' >>eddep
301	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
302	echo '$$r makedep' >>eddep
303	echo 'w' >>eddep
304	-rm -f makefile.bak
305	cp makefile makefile.bak
306	ed - makefile < eddep
307	rm eddep makedep eddep.c
308
309# DO NOT DELETE THIS LINE
310
311