xref: /original-bsd/usr.bin/tn3270/ctlr/makefile (revision c95cd016)
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#
12#	@(#)makefile	3.4 (Berkeley) 05/15/88
13#
14# msdos versus unix defines
15O	= .o
16#PC_O	= .obj
17
18X	=
19#PC_X	= .exe
20
21L	=
22#PC_L	= -link
23
24CC	= cc
25#PC_CC	= cl
26
27MV	= mv
28#PC_MV	= rename
29
30RM	= rm -f
31#PC_RM= erase
32
33LINT_ARGS =
34#PC_LINT_ARGS = -DLINT_ARGS
35
36DEBUG_FLAGS = -g
37#PC_DEBUG_FLAGS = -Zi -Od
38
39AR	= ar
40AR1	= cr
41AR2	=
42AR3	=
43#PC_AR	= lib
44#PC_AR1	=
45#PC_AR2	= +
46#PC_AR3	= ";"
47
48RANLIB	= ranlib
49#PC_RANLIB = echo "Done with "
50
51PRINT	= print
52
53DEFINES = ${LINT_ARGS}
54
55INCLUDES = -I.
56
57OPTIMIZE = -O
58OPTIMIZE = ${DEBUG_FLAGS}
59
60CFLAGS	= $(OPTIMIZE) $(INCLUDES) $(DEFINES)
61
62# Lint flags
63LINTFLAGS	= -hbxaz
64
65# Which keyboard are we emulating.
66KBD	= 3180.kbd
67KBD	= 3270pc.kbd
68KBD	= unix.kbd
69
70# The source files...
71ALLH =	api.h function.h hostctlr.h inbound.ext oia.h \
72	options.ext options.h outbound.ext screen.h scrnctlr.h
73
74ALLC =	api.c function.c inbound.c oia.c options.c outbound.c
75
76# Note: NO function.o!
77ALLO =	api$O inbound$O oia$O options$O outbound$O
78
79ALLHC=	${ALLH} ${ALLC}
80ALLPRINT =	3180.kbd 3270pc.kbd unix.kbd ${ALLHC}
81
82ALLSOURCE =	${ALLPRINT} makefile makefile.mak
83
84.s.o:
85	/lib/cpp -E $< | as -o $@
86
87.c.obj:
88	${CC} ${CFLAGS} -c $<
89
90ctlrlib.a:	${ALLO}
91	${RM} $@
92	for i in ${ALLO}; do (${AR} ${AR1} $@ ${AR2} $$i${AR3}); done
93	${RANLIB} $@
94
95clean:
96	for i in $(ALLO) mset tn3270 prt3270 m4.out errs \
97		makefile.bak ctlrlib.a kbd.out TMPfunc.out; \
98			do (${RM} $$i); done
99
100sccsclean:
101	-sccs clean
102	-sccs get makefile
103
104clist:	${ALLC}
105	@for i in ${ALLC} ; \
106		do (echo ${DIRPATH}$$i); done
107
108hclist:	${ALLHC}
109	@for i in ${ALLHC} ; \
110		do (echo ${DIRPATH}$$i); done
111
112sourcelist:	${ALLSOURCE}
113	@for i in ${ALLSOURCE}; \
114		do (echo ${DIRPATH}$$i); done
115
116print:
117	${PRINT} ${ALLPRINT}
118
119tags:	${ALLC} ${ALLH}
120	ctags -t ${ALLC} ${ALLH}
121
122action:
123	${ACTION}
124
125lint:
126	lint ${LINTFLAGS} ${INCLUDES} ${DEFINES} -DTN3270 ${ALLC} -lcurses
127
128.DEFAULT:
129	sccs get $<
130
131kbd.out:	$(KBD) hostctlr.h
132	(cd ../tools; make mkhits$X )
133	${RM} $@ TMPfunc.out
134	$(CC) $(CFLAGS) -E function.c > TMPfunc.out
135	../tools/mkhits - ../ctlr/TMPfunc.out < $(KBD) > $@
136	${RM} TMPfunc.out
137
138depend:
139	grep '^#include' ${ALLC} | grep -v '<' | \
140	sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
141	    -e 's/\.c/$$O/' | \
142	awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
143		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
144		       else rec = rec " " $$2 } } \
145	      END { print rec } ' > makedep
146	echo '$$r makedep' >>eddep
147	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
148	echo '$$r makedep' >>eddep
149	echo 'w' >>eddep
150	-rm -f makefile.bak
151	cp makefile makefile.bak
152	ed - makefile < eddep
153	rm eddep makedep
154
155# DO NOT DELETE THIS LINE
156
157api$O: api.h ../general/general.h ../api/disp_asc.h screen.h oia.h
158api$O: ../general/globals.h
159function$O: function.h
160inbound$O: ../general/general.h function.h hostctlr.h oia.h scrnctlr.h screen.h
161inbound$O: options.h ../api/dctype.h ../api/ebc_disp.h ../general/globals.h
162inbound$O: inbound.ext outbound.ext ../telnet.ext kbd.out
163oia$O: ../general/general.h oia.h ../general/globals.h
164options$O: options.h ../general/globals.h options.ext
165outbound$O: ../general/general.h hostctlr.h oia.h screen.h ../api/ebc_disp.h
166outbound$O: ../general/globals.h options.ext ../telnet.ext inbound.ext
167outbound$O: outbound.ext ../general/bsubs.ext
168