xref: /original-bsd/usr.bin/tn3270/makefile (revision ed20bae8)
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.1 (Berkeley) 12/04/88
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#	Here are some which are used throughout the system:
56#
57#	unix		-	Compiles in unix specific stuff.
58#
59#	msdos		-	Compiles in msdos specific stuff.
60#
61
62# msdos versus unix defines
63O	= .o
64#PC_O	= .obj
65
66X	=
67#PC_X	= .exe
68
69L	=
70#PC_L	= -link
71
72CC	= cc
73#PC_CC	= cl
74
75MV	= mv
76#PC_MV	= rename
77
78RM	= rm -f
79#PC_RM= erase
80
81LINT_ARGS =
82#PC_LINT_ARGS = -DLINT_ARGS
83
84DEBUG_FLAGS = -g
85#PC_DEBUG_FLAGS = -Zi -Od
86
87AR	= ar
88AR1	= cr
89AR2	=
90AR3	=
91#PC_AR	= lib
92#PC_AR1	=
93#PC_AR2	= +
94#PC_AR3	= ";"
95
96RANLIB	= ranlib
97#PC_RANLIB = echo "Done with "
98
99
100PRINT	= print
101ACTION = @sccs tell
102
103DEFINES = ${LINT_ARGS}
104
105INCLUDES = -I. -I..
106
107OPTIMIZE = -O
108OPTIMIZE = ${DEBUG_FLAGS}
109
110CFLAGS	= $(OPTIMIZE) $(INCLUDES) $(DEFINES)
111
112# Lint flags
113LINTFLAGS	= -hbxaz
114# How to install the bloody thing...
115
116DESTDIR=
117
118BINDIR		= $(DESTDIR)/usr/ucb
119MAN1DIR		= $(DESTDIR)/usr/man/cat1
120MAN5DIR		= $(DESTDIR)/usr/man/cat5
121
122# Names for the terminal libraries...
123LIBCURSES	= -lcurses
124LIBTERM		= -ltermlib
125
126#PC_LIBCURSES	=
127#PC_LIBTERM	=
128
129# The source files...
130ALLH =	telextrn.h
131
132MSMAIN = ascii/mset.c
133
134ALLC =
135
136ALLO	= mset$O
137
138ALLHC=	${ALLH} ${ALLC}
139ALLPRINT =	${ALLHC}
140
141ALLSOURCE =	${ALLPRINT} makefile makefile.mak makefile_4.2 README \
142		mset.1 tn3270.1 map3270.5
143
144SYS	= sys_curses
145#PC_SYS	= sys_dos
146
147# The places where the various components live...
148
149SUBDIR =	api ascii ctlr general ${SYS} telnet
150
151# The following are directories we don't do regular make's in, but
152# we do make everywhere, print, and sourcelist in.
153
154EXTRADIR =	arpa sys_dos tools utilities
155
156# The libraries we use.  The order here is important.
157# syslib.a and ctlrlib.a should come first, then the rest.
158SUBLIB =	${SYS}/syslib.a ctlr/ctlrlib.a \
159		ascii/asciilib.a general/generallib.a
160
161.s.o:
162	/lib/cpp -E $< | as -o $@
163
164.c.obj:
165	${CC} ${CFLAGS} -c $<
166
167all:	FRC tn3270$X mset$X
168
169FRC:
170	for i in ${SUBDIR}; \
171		do (cd $$i; make ${MFLAGS} "CFLAGS=${CFLAGS}"); done
172
173tn3270$X:	telnet/telprog.o ${SUBLIB} api/apilib.a
174	${CC} ${CFLAGS} -o tn3270 telnet/telprog.o \
175		$L ${SUBLIB} api/apilib.a $(LIBCURSES) $(LIBTERM)
176
177#PC_tn3270$X:
178#PC_	link <@<
179#PC_	telnet
180#PC_	tn3270
181#PC_	nul
182#PC_	${SUBLIB} api/apilib.a+
183#PC_	\lib\ublib\ubtcp
184#PC_	_PC_<
185
186mset$X:	mset$O ascii/map3270$O
187	${CC} ${CFLAGS} -o mset mset$O ascii/map3270$O $L api/apilib.a
188
189mset$O:	$(MSMAIN)
190	$(CC) $(CFLAGS) -c $(MSMAIN)
191
192install:	tn3270$X mset$X tn3270.0 mset.0 map3270.0
193	install -m 755 -o bin -g bin -s tn3270 $(BINDIR)
194	install -m 755 -o bin -g bin -s mset $(BINDIR)
195	install -c -o bin -g bin -m 444 tn3270.0 mset.0 $(MAN1DIR)
196	install -c -o bin -g bin -m 444 map3270.0 $(MAN5DIR)
197
198action:
199	${ACTION}
200
201clist:	${ALLHC}
202	@for i in ${SUBDIR}; \
203		do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
204							    clist); done
205
206hclist:	${ALLHC}
207	@for i in ${SUBDIR}; \
208		do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
209							    hclist); done
210
211everywhere:	action
212	for i in ${SUBDIR} ${EXTRADIR}; \
213		do (echo "[$$i]"; cd $$i; make ${MFLAGS} action \
214						"ACTION=${ACTION}"); done
215
216clean:
217	for i in $(ALLO) mset tn3270 errs makefile.bak; \
218			do (${RM} $$i); done
219	for i in ${SUBDIR} ${EXTRADIR}; \
220			do (cd $$i; make ${MFLAGS} clean); done
221
222sccsclean:
223	-sccs clean
224	-sccs get makefile
225	for i in ${SUBDIR} ${EXTRADIR}; \
226			do (cd $$i; make ${MFLAGS} sccsclean); done
227
228print:
229	${PRINT} ${ALLPRINT}
230	for i in ${SUBDIR} ${EXTRADIR}; \
231			do (cd $$i; make ${MFLAGS} "PRINT=${PRINT}" print); done
232
233tags:	${ALLC} ${ALLH}
234	ctags -t `make ${MFLAGS} hclist`
235
236sourcelist:	${ALLSOURCE}
237	@for i in ${ALLSOURCE}; \
238		do (echo ${DIRPATH}$$i); done
239	@for i in ${SUBDIR} ${EXTRADIR}; \
240		do (cd $$i; make ${MFLAGS} "DIRPATH=${DIRPATH}$$i/" \
241							    sourcelist); done
242
243lint:
244	lint ${LINTFLAGS} -Itelnet ${INCLUDES} ${DEFINES} -DTN3270 \
245				`make clist` -lcurses
246
247lintmset:
248	lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} ${MSMAIN} \
249				ascii/map3270.c -lcurses
250
251makefiles.pc:	tools/mkmake
252	for i in . ${SUBDIR} ${EXTRADIR}; \
253	do (sed -e "s/lib\.a/.lib/g" -e "s/^#PC_//" < $$i/makefile | \
254		./tools/mkmake | \
255		sed -e "sx/x\\\\xg" -e "s/[ 	]*_PC_//" > $$i/makefile.mak); \
256	    done
257
258tools/mkmake:
259	(cd tools; make mkmake)
260
261.DEFAULT:
262	sccs get $<
263
264depend:	thisdepend
265	for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done
266
267thisdepend:
268	echo > eddep.c
269	grep '^#include' ${ALLC} eddep.c | grep -v '<' | \
270	sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
271	    -e 's/\.c/$$O/' | \
272	awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
273		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
274		       else rec = rec " " $$2 } } \
275	      END { print rec } ' > makedep
276	echo '$$r makedep' >>eddep
277	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
278	echo '$$r makedep' >>eddep
279	echo 'w' >>eddep
280	-rm -f makefile.bak
281	cp makefile makefile.bak
282	ed - makefile < eddep
283	rm eddep makedep eddep.c
284
285# DO NOT DELETE THIS LINE
286
287