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