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