]>
Commit | Line | Data |
---|---|---|
9db38114 | 1 | ################################################## |
2 | ### | |
3 | ### Makefile for LCLint | |
4 | ### | |
5 | ### designed for use with gmake (GNU make) | |
6 | ### | |
7 | ### original version based on LCL Makefile | |
8 | ### completely revised December 1993 | |
9 | ### revised for 1.4a, November 1994 | |
10 | ### revised for 2.0, February 1996 | |
11 | ### revised for 2.2, August 1996 | |
12 | ### | |
13 | ### This file should not need to be edited. | |
14 | ### | |
15 | ### Compilers and tools set using the top-level Makefile override settings | |
16 | ### in this file when make is run from the top directory. | |
17 | ### | |
18 | ### Commands: | |
19 | ### | |
20 | ### make all | |
21 | ### builds a release version of lclint from scratch using optimizations | |
22 | ### | |
23 | ### make quick | |
24 | ### builds a local version of lclint (no optimizations) | |
25 | ### (does not remake files) | |
26 | ### | |
27 | ### make test | |
28 | ### runs the test suite | |
29 | ### (must have installed test suite from lclint.test.tar.Z) | |
30 | ### | |
31 | ||
32 | .SUFFIXES : .h .c .o .l .check | |
33 | .PHONY : all dorerelease retest rerelease homeversion | |
34 | .IGNORE : dorerelease retest rerelease | |
35 | ||
36 | ### | |
37 | ### system information (compilers, flags, directories, etc.) | |
38 | ### | |
39 | ||
40 | include Makefile.sys | |
41 | ||
42 | ### | |
43 | ### check files before compiling | |
44 | ### (can't be 1 unless you have lclint already!) | |
45 | ### | |
46 | ||
47 | CHECK = 0 ### set to 1 | |
48 | ||
a8e557d3 | 49 | LCLINT = //tmp/lclint-2.5q/bin/lclint |
4ab867d6 | 50 | #LCLINT = ../bin/lclint |
a8e557d3 | 51 | |
9db38114 | 52 | ### |
53 | ### source files | |
54 | ### | |
55 | ||
56 | include Makefile.sources | |
57 | ||
58 | ### | |
59 | ### top level | |
60 | ### | |
61 | ||
62 | all : dorelease | |
63 | ||
64 | quick: lclint | |
65 | ||
66 | lclint : $(OBJ) | |
67 | @echo '// ' | |
68 | @echo '// Linking:' | |
69 | @echo '// ' | |
70 | $(CC) -o lclint $(OBJ) $(LINKFLAGS) | |
71 | ||
72 | object: $(OBJ) | |
73 | ||
74 | mylint: | |
75 | CC="$(LCLINT)" ; export CC ; $(MAKE) -e object | |
76 | ### | |
77 | ### grammars | |
78 | ### | |
79 | ||
80 | ### | |
81 | ### -p xx flag to bison renames yyparse ==> xxparse, xxlex ==> xxlex | |
82 | ### this is probably NOT compatible with yacc. | |
83 | ### | |
84 | ||
85 | signature.c : signature.c.der signature.y | |
86 | ifdef BISON | |
87 | @$(BISON) $(YFLAGS) -p lsl signature.y | |
88 | @$(CAT) bison.head signature.tab.c > signature.c | |
89 | @$(MV) Headers/signature_gen.h Headers/signature_gen.bak | |
90 | @$(CAT) bison.head signature.tab.h > Headers/signature_gen.h | |
91 | else | |
92 | $(CP) signature.c.der signature.c | |
93 | endif | |
94 | ||
95 | cgrammar.c : cgrammar.c.der cgrammar.y | |
96 | ifdef BISON | |
97 | $(BISON) $(YFLAGS) cgrammar.y | |
98 | @echo '// Expect 119 shift/reduce conflicts and 114 reduce/reduce conflicts.' | |
99 | @echo '// (see cgrammar.y for explanation)' | |
100 | @$(CAT) bison.head cgrammar.tab.c > cgrammar.c | |
101 | @$(MV) Headers/cgrammar_tokens.h Headers/cgrammar_tokens.bak | |
102 | @$(CAT) bison.head cgrammar.tab.h > Headers/cgrammar_tokens.h | |
103 | else | |
104 | $(CP) cgrammar.c.der cgrammar.c | |
105 | endif | |
106 | ||
107 | ### llgrammar2.h is necessary so +singleinclude may be used | |
108 | ||
109 | llgrammar.c : llgrammar.c.der llgrammar.y | |
110 | ifdef BISON | |
111 | $(BISON) $(YFLAGS) -p yl llgrammar.y | |
112 | @echo '// Expect 2 shift/reduce conflicts.' | |
113 | @$(CAT) bison.head llgrammar.tab.c > llgrammar.c | |
114 | @$(MV) Headers/llgrammar_gen2.h Headers/llgrammar_gen2.bak | |
115 | @$(CAT) bison.head llgrammar.tab.h > Headers/llgrammar_gen2.h | |
116 | @$(MV) Headers/llgrammar_gen.h Headers/llgrammar_gen.bak | |
117 | @$(CAT) bison.head llgrammar.tab.h > Headers/llgrammar_gen.h | |
118 | else | |
119 | $(CP) llgrammar.c.der llgrammar.c | |
120 | endif | |
121 | ||
122 | cscanner.c : cscanner.c.der cscanner.l | |
123 | ifdef FLEX | |
124 | $(FLEX) $(LFLAGS) cscanner.l | |
125 | $(CAT) flex.head lex.yy.c > cscanner.c | |
126 | else | |
127 | $(CP) cscanner.c.der cscanner.c | |
128 | endif | |
129 | ||
130 | ### | |
131 | ### compile without warnings | |
132 | ### | |
133 | ||
134 | signature.o : signature.c | |
135 | $(CC) $(CPPFLAGS) -c $*.c | |
136 | ||
137 | cgrammar.o : cgrammar.c | |
138 | $(CC) $(CPPFLAGS) -c $*.c | |
139 | ||
140 | llgrammar.o : llgrammar.c | |
141 | $(CC) $(CPPFLAGS) -c $*.c | |
142 | ||
143 | cscanner.o : cscanner.c | |
144 | $(CC) $(CPPFLAGS) -c $*.c | |
145 | ||
146 | ### | |
147 | ### header files dependant on grammars | |
148 | ### | |
149 | ||
150 | Headers/signature2.h : signature.c | |
151 | Headers/cgrammar2.h : cgrammar.c | |
152 | Headers/llgrammar.h : llgrammar.c | |
153 | ||
154 | ### | |
155 | ### defaults | |
156 | ### | |
157 | ||
158 | ### Flags for checking a single file | |
159 | SINGLEFLAGS = +neverinclude -supcounts +partial -showsummary -load lclint.lcd | |
160 | ||
161 | .c.check: lclint.lcd lclint | |
162 | $(LCLINT) $(LINTFLAGS) $(SINGLEFLAGS) $*.c | |
163 | ||
164 | .c.o: | |
165 | ifeq ($(CHECK), 1) | |
166 | $(LCLINT) $(LINTFLAGS) $(SINGLEFLAGS) $*.c | |
167 | endif | |
168 | @echo '// Compiling '$*.c' / compiled: '`$(OFILES)`' (of 120 files)' | |
169 | @$(CC) $(CFLAGS) -c $*.c | |
170 | ||
171 | ### | |
172 | ### alternatives (tests, releases, backups, etc.) | |
173 | ### | |
174 | ||
175 | ### -e option makes environment variables take precedence | |
176 | ||
177 | .PHONY : test quicktest opt up | |
178 | ||
179 | opt : | |
180 | ifneq (,$(findstring csh, $(SHELL))) | |
181 | setenv CC '$(CCOPT)' ; $(MAKE) -e lclint | |
182 | else | |
183 | CC="$(CCOPT)" ; export CC ; $(MAKE) -e lclint | |
184 | endif | |
185 | ||
186 | updateversion: | |
187 | @$(MV) Headers/herald.h Headers/herald.last | |
188 | @echo '/* herald.h - created automatically by gmake updateversion */' > Headers/herald.h | |
189 | @echo '/*@constant observer char *LCL_VERSION;@*/' >> Headers/herald.h | |
190 | @echo '# define LCL_VERSION "LCLint '`cat $(VERSION_NUMBER)`' --- '`cat DATE`'"' \ | |
191 | >> Headers/herald.h | |
192 | @echo '/*@constant observer char *LCL_PARSE_VERSION;@*/' >> Headers/herald.h | |
193 | @echo '# define LCL_PARSE_VERSION "LCLint '`cat $(VERSION_NUMBER)`'"' \ | |
194 | >> Headers/herald.h | |
195 | @echo '/*@constant observer char *LCL_COMPILE;@*/' >> Headers/herald.h | |
196 | @echo '# define LCL_COMPILE "Compiled using '$(CC)' on '`uname -a`' by '`whoami`'"' >> Headers/herald.h | |
197 | ||
198 | localconstants: | |
199 | @$(MV) Headers/local_constants.h Headers/local_constants.last | |
200 | @echo '/* local_constants.h - created automatically by gmake localconstants */' \ | |
201 | > Headers/local_constants.h | |
202 | ifndef SYSTEM_LIBDIR | |
203 | @echo '*** Fatal Error: SYSTEM_LIBDIR not defined.' | |
204 | else | |
205 | @echo '/*@constant observer char *SYSTEM_LIBDIR;@*/' >> Headers/local_constants.h | |
206 | @echo '# define SYSTEM_LIBDIR $(SYSTEM_LIBDIR)' >> Headers/local_constants.h | |
207 | ifndef DEFAULT_LARCHPATH | |
208 | @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.' | |
209 | else | |
210 | @echo '/*@constant observer char *DEFAULT_LARCHPATH;@*/' >> Headers/local_constants.h | |
211 | @echo '# define DEFAULT_LARCHPATH $(DEFAULT_LARCHPATH)' >> Headers/local_constants.h | |
212 | ifndef DEFAULT_LCLIMPORTDIR | |
213 | @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.' | |
214 | else | |
215 | @echo '/*@constant observer char *DEFAULT_LCLIMPORTDIR;@*/' >> Headers/local_constants.h | |
216 | @echo '# define DEFAULT_LCLIMPORTDIR $(DEFAULT_LCLIMPORTDIR)' >> Headers/local_constants.h | |
217 | endif | |
218 | endif | |
219 | endif | |
220 | ||
221 | dorelease: | |
222 | @echo '// ' | |
223 | @echo '// Making LCLint' | |
224 | @echo '// Version '`cat $(VERSION_NUMBER)` | |
225 | @echo '// ' | |
226 | @echo '// Compiler: '$(CCOPT) | |
227 | ifdef BISON | |
228 | @echo '// Bison: '$(BISON) | |
229 | else | |
230 | @echo '// Use derived bison files' | |
231 | endif | |
232 | ifdef FLEX | |
233 | @echo '// Flex: '$(FLEX) | |
234 | else | |
235 | @echo '// Use derived flex files' | |
236 | endif | |
237 | @echo '// Default cpp command: '$(DEFAULT_CPPCMD) | |
238 | @echo '// System include directory: '$(SYSTEM_LIBDIR) | |
239 | @echo '// Default Larch path: '$(DEFAULT_LARCHPATH) | |
240 | @echo '// Default imports directory: '$(DEFAULT_LCLIMPORTDIR) | |
241 | @echo '// ' | |
242 | @echo 'Making tags' | |
243 | ./maketags | |
244 | @echo '// ' | |
245 | @echo '// Updating version information' | |
246 | @$(MAKE) -e updateversion | |
247 | @echo '// Updating local constants' | |
248 | ### @$(MAKE) -e localconstants | |
249 | @echo '// ' | |
250 | @echo '// Compiling:' | |
251 | @echo '// ' | |
252 | @$(MAKE) -e opt | |
253 | @echo '// Done Release '`cat $(VERSION_NUMBER)` | |
254 | ||
255 | ||
256 | flags: flags.def | |
257 | grep "FLG_" flags.def > Headers/flag_codes.gen | |
258 | ||
259 | ### | |
260 | ### cleaning | |
261 | ### | |
262 | ### Standard entries to remove files from the directories | |
263 | ### up --- remove .o files and grammar derivatives | |
264 | ### tidy --- eliminate unwanted files | |
265 | ### clean --- delete derived files, except for spec-derived files | |
266 | ### pristine --- delete all derived files | |
267 | ### | |
268 | ||
269 | .PHONY .IGNORE : up tidy clean pristine | |
270 | ||
271 | pristine: clean | |
272 | -$(RM) -f *.lcs *.lslo | |
273 | ||
274 | clean: tidy | |
275 | -$(RM) core lclint | |
276 | -$(RM) *.out *.output *.bib *.dvi *.idx *.log *.o *.toc | |
277 | -$(RM) cgrammar.c cscanner.c | |
278 | -$(RM) test* Headers/*~ Headers/#* | |
279 | ||
280 | tidy: | |
281 | -$(RM) ,* .,* *.CKP *.BAK .emacs_[0-9]* core a.out *.*~ | |
282 | ||
283 | up: | |
284 | -$(RM) cgrammar.c llgrammar.c signature.c cscanner.c | |
285 | -$(RM) *.o | |
286 | ||
287 | ### | |
288 | ### dependancies | |
289 | ### | |
290 | ||
291 | depend: | |
292 | $(MAKEDEPEND) $(CINCLUDES) $(CFLAGS) -f Makefile.depend $(SRC) $(GRAMS) | |
293 | ||
294 | ### | |
295 | ### analysing dependancies takes a long time and doesn't work terribly | |
296 | ### well, so the are NOT included here. NOTE carefully, this means if a | |
297 | ### header file is changed manual recompilation may be necessary. | |
298 | ### | |
299 | ||
300 | ### include Makefile.depend | |
301 | ||
302 | ### | |
303 | ### LCLint checking | |
304 | ### | |
305 | ||
306 | ### | |
307 | ### A library is used for the specifications | |
308 | ### | |
309 | ||
310 | $(CHECKS): lclint.lcd | |
311 | ||
312 | ### | |
313 | ### other flags are in .lclintrc file | |
314 | ### | |
315 | ||
4ab867d6 | 316 | #lint: |
317 | # $(LCLINT) -f lclint.lclintrc $(CPPFLAGS) +forcehints +singleinclude -nestcomments -fcnuse -allimponly -modglobsnomods -uniondef -exportlocal -exportheader -abstract -namechecks -protoparammatch -boolops $(ALLSRC) -dump lclint | |
9db38114 | 318 | |
4ab867d6 | 319 | lint: |
320 | $(LCLINT) -f lclint.lclintrc $(CPPFLAGS) +forcehints +singleinclude -nestcomments -fcnuse -uniondef +allimponly -branchstate -exportlocal -exportheader -abstract -namechecks -protoparammatch -temptrans -boolops $(ALLSRC) -dump lclint | |
9db38114 | 321 | |
322 | ||
4ab867d6 | 323 | myall: |
324 | -$(RM) -f ../bin/lclint; \ | |
325 | gmake -C .. | |
9db38114 | 326 | |
327 |