]>
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 | |
28bf4b0b | 33 | .PHONY : all dorerelease retest rerelease homeversion test updateversion |
9db38114 | 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 | ||
28bf4b0b | 49 | #LCLINT = //tmp/lclint-2.5q/bin/lclint |
990ec868 | 50 | #LCLINTNEW = //afs/cert.org/usr/dlaroche/evLCLintDev/bin/lclint |
28bf4b0b | 51 | #LCLINTNEW = /home/drl7x/evLCLintDev/evLCLintDev/bin/lclint |
990ec868 | 52 | LCLINTNEW = lclint |
28bf4b0b | 53 | LCLINT = ../bin/lclint |
a8e557d3 | 54 | |
9db38114 | 55 | ### |
56 | ### source files | |
57 | ### | |
58 | ||
59 | include Makefile.sources | |
60 | ||
61 | ### | |
62 | ### top level | |
63 | ### | |
64 | ||
65 | all : dorelease | |
66 | ||
67 | quick: lclint | |
68 | ||
28bf4b0b | 69 | nocheck: |
70 | CHECK=0; export CHECK; ${MAKE} -e | |
71 | ||
9db38114 | 72 | lclint : $(OBJ) |
73 | @echo '// ' | |
74 | @echo '// Linking:' | |
75 | @echo '// ' | |
76 | $(CC) -o lclint $(OBJ) $(LINKFLAGS) | |
77 | ||
28bf4b0b | 78 | purify: ${OBJ} |
79 | purify ${CC} -o lclint ${OBJ} ${LINKFLAGS} | |
9db38114 | 80 | |
9db38114 | 81 | ### |
82 | ### grammars | |
83 | ### | |
84 | ||
85 | ### | |
86 | ### -p xx flag to bison renames yyparse ==> xxparse, xxlex ==> xxlex | |
87 | ### this is probably NOT compatible with yacc. | |
88 | ### | |
89 | ||
90 | signature.c : signature.c.der signature.y | |
91 | ifdef BISON | |
dfd03f44 | 92 | $(BISON) $(YFLAGS) -p lsl signature.y |
93 | $(CAT) bison.head signature.tab.c bison.reset > signature.c | |
94 | -$(MV) Headers/signature_gen.h Headers/signature_gen.bak | |
95 | $(CAT) bison.head signature.tab.h bison.reset > Headers/signature_gen.h | |
9db38114 | 96 | else |
97 | $(CP) signature.c.der signature.c | |
98 | endif | |
99 | ||
100 | cgrammar.c : cgrammar.c.der cgrammar.y | |
101 | ifdef BISON | |
102 | $(BISON) $(YFLAGS) cgrammar.y | |
28bf4b0b | 103 | @echo '// Expect 119 shift/reduce conflicts and 115 reduce/reduce conflicts.' |
9db38114 | 104 | @echo '// (see cgrammar.y for explanation)' |
28bf4b0b | 105 | @$(CAT) bison.head cgrammar.tab.c bison.reset > cgrammar.c |
a028d0b7 | 106 | -@$(MV) Headers/cgrammar_tokens.h Headers/cgrammar_tokens.bak |
28bf4b0b | 107 | @$(CAT) bison.head cgrammar.tab.h bison.reset > Headers/cgrammar_tokens.h |
108 | @$(RM) cgrammar.tab.c cgrammar.tab.h | |
9db38114 | 109 | else |
110 | $(CP) cgrammar.c.der cgrammar.c | |
111 | endif | |
112 | ||
28bf4b0b | 113 | mtgrammar.c: mtgrammar.y |
114 | ifdef BISON | |
115 | $(BISON) $(YFLAGS) -p mt mtgrammar.y | |
116 | @$(CAT) bison.head mtgrammar.tab.c bison.reset > mtgrammar.c | |
117 | # @$(MV) Headers/mtgrammar_tokens.h Headers/mtgrammar_tokens.bak | |
118 | @$(CAT) bison.head mtgrammar.tab.h bison.reset > Headers/mtgrammar_tokens.h | |
119 | @$(RM) mtgrammar.tab.c mtgrammar.tab.h | |
28bf4b0b | 120 | else |
121 | $(CP) mtgrammar.c.der mtgrammar.c | |
122 | endif | |
123 | ||
9db38114 | 124 | ### llgrammar2.h is necessary so +singleinclude may be used |
125 | ||
126 | llgrammar.c : llgrammar.c.der llgrammar.y | |
127 | ifdef BISON | |
128 | $(BISON) $(YFLAGS) -p yl llgrammar.y | |
129 | @echo '// Expect 2 shift/reduce conflicts.' | |
28bf4b0b | 130 | @$(CAT) bison.head llgrammar.tab.c bison.reset > llgrammar.c |
a028d0b7 | 131 | -@$(MV) Headers/llgrammar_gen2.h Headers/llgrammar_gen2.bak |
28bf4b0b | 132 | @$(CAT) bison.head llgrammar.tab.h bison.reset > Headers/llgrammar_gen2.h |
a028d0b7 | 133 | -@$(MV) Headers/llgrammar_gen.h Headers/llgrammar_gen.bak |
28bf4b0b | 134 | @$(CAT) bison.head llgrammar.tab.h bison.reset > Headers/llgrammar_gen.h |
135 | @$(RM) llgrammar.tab.c llgrammar.tab.h | |
9db38114 | 136 | else |
137 | $(CP) llgrammar.c.der llgrammar.c | |
138 | endif | |
139 | ||
140 | cscanner.c : cscanner.c.der cscanner.l | |
141 | ifdef FLEX | |
142 | $(FLEX) $(LFLAGS) cscanner.l | |
28bf4b0b | 143 | $(CAT) flex.head lex.yy.c flex.reset > cscanner.c |
9db38114 | 144 | else |
145 | $(CP) cscanner.c.der cscanner.c | |
146 | endif | |
147 | ||
148 | ### | |
149 | ### compile without warnings | |
150 | ### | |
151 | ||
152 | signature.o : signature.c | |
153 | $(CC) $(CPPFLAGS) -c $*.c | |
154 | ||
155 | cgrammar.o : cgrammar.c | |
156 | $(CC) $(CPPFLAGS) -c $*.c | |
157 | ||
28bf4b0b | 158 | cscanner.o : cscanner.c |
9db38114 | 159 | $(CC) $(CPPFLAGS) -c $*.c |
160 | ||
28bf4b0b | 161 | llgrammar.o : llgrammar.c |
9db38114 | 162 | $(CC) $(CPPFLAGS) -c $*.c |
163 | ||
28bf4b0b | 164 | |
9db38114 | 165 | ### |
166 | ### header files dependant on grammars | |
167 | ### | |
168 | ||
169 | Headers/signature2.h : signature.c | |
28bf4b0b | 170 | Headers/signature_gen.h : signature.c |
9db38114 | 171 | Headers/cgrammar2.h : cgrammar.c |
a028d0b7 | 172 | Headers/cgrammar_tokens.h : cgrammar.c |
9db38114 | 173 | Headers/llgrammar.h : llgrammar.c |
174 | ||
28bf4b0b | 175 | Headers/flag_codes.gen : flags.def |
176 | grep "FLG_" flags.def > Headers/flag_codes.gen | |
177 | ||
9db38114 | 178 | ### |
179 | ### defaults | |
180 | ### | |
181 | ||
182 | ### Flags for checking a single file | |
28bf4b0b | 183 | SINGLEFLAGS = -f lclint.lclintrc -supcounts +partial -unrecogcomments |
184 | ||
185 | LCLINT29 = ${HOME}/lclint-2.9c/src/lclint | |
9db38114 | 186 | |
187 | .c.check: lclint.lcd lclint | |
28bf4b0b | 188 | -../bin/lclint $(CPPFLAGS) $(LINTFLAGS) $(SINGLEFLAGS) -load lclint.lcd +neverinclude $*.c +showsourceloc -mts file |
189 | # -$(LCLINT29) $(CPPFLAGS) $(LINTFLAGS) $(SINGLEFLAGS) -load lclint.lcd +neverinclude $*.c +showsourceloc | |
9db38114 | 190 | |
a028d0b7 | 191 | lcllib.c: Headers/llgrammar.h |
192 | clabstract.c: Headers/cgrammar_tokens.h | |
28bf4b0b | 193 | scan.c: Headers/signature2.h Headers/signature_gen.h |
194 | stateClause.c: Headers/cgrammar_tokens.h | |
195 | ||
a028d0b7 | 196 | |
9db38114 | 197 | .c.o: |
198 | ifeq ($(CHECK), 1) | |
28bf4b0b | 199 | ${MAKE} $*.check |
9db38114 | 200 | endif |
28bf4b0b | 201 | @echo '// Compiling '$*.c' / compiled: '`$(OFILES)`' (of 161 files)' |
202 | $(CC) $(CFLAGS) -c $*.c | |
9db38114 | 203 | |
204 | ### | |
205 | ### alternatives (tests, releases, backups, etc.) | |
206 | ### | |
207 | ||
208 | ### -e option makes environment variables take precedence | |
209 | ||
28bf4b0b | 210 | .PHONY : test quicktest opt up backup |
211 | ||
212 | backup: | |
213 | tar zcvf ../lclint-`date +%Y-%d-%m-%H-%M`.tgz ${ALLSRC} ${GRAMS} Headers/*.h *.i flags.def | |
214 | ||
215 | betarelease: | |
216 | mkdir ~/temp/lclint-`cat ${VERSION_NUMBER}` | |
217 | mkdir ~/temp/lclint-`cat ${VERSION_NUMBER}`/src | |
218 | cp Makefile* ${ALLSRC} ${GRAMS} *.i flags.def ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/ | |
219 | cp -r Headers ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/ | |
220 | cp -r ../lib ~/temp/lclint-`cat ${VERSION_NUMBER}`/lib | |
221 | cp -r ../imports ~/temp/lclint-`cat ${VERSION_NUMBER}`/imports | |
222 | cp -r ../test ~/temp/lclint-`cat ${VERSION_NUMBER}`/test | |
223 | cp ../configure ../Makefile* ../README ~/temp/lclint-`cat ${VERSION_NUMBER}`/ | |
7b1629ab | 224 | cd ~/temp/lclint-`cat ${VERSION_NUMBER}`; rm */*.core ; tar zcvf ~/public_html/lclint/lclint-`cat ~/LCLintDev/src/${VERSION_NUMBER}`-beta.tgz * |
28bf4b0b | 225 | chmod 644 ~/public_html/lclint/lclint-`cat ${VERSION_NUMBER}`.tgz |
7b1629ab | 226 | @echo "Make release lclint-`cat ${VERSION_NUMBER}` |
9db38114 | 227 | |
228 | opt : | |
229 | ifneq (,$(findstring csh, $(SHELL))) | |
230 | setenv CC '$(CCOPT)' ; $(MAKE) -e lclint | |
231 | else | |
232 | CC="$(CCOPT)" ; export CC ; $(MAKE) -e lclint | |
233 | endif | |
234 | ||
235 | updateversion: | |
920a3797 | 236 | -@$(MV) Headers/herald.h Headers/herald.last |
9db38114 | 237 | @echo '/* herald.h - created automatically by gmake updateversion */' > Headers/herald.h |
238 | @echo '/*@constant observer char *LCL_VERSION;@*/' >> Headers/herald.h | |
239 | @echo '# define LCL_VERSION "LCLint '`cat $(VERSION_NUMBER)`' --- '`cat DATE`'"' \ | |
240 | >> Headers/herald.h | |
241 | @echo '/*@constant observer char *LCL_PARSE_VERSION;@*/' >> Headers/herald.h | |
242 | @echo '# define LCL_PARSE_VERSION "LCLint '`cat $(VERSION_NUMBER)`'"' \ | |
243 | >> Headers/herald.h | |
244 | @echo '/*@constant observer char *LCL_COMPILE;@*/' >> Headers/herald.h | |
245 | @echo '# define LCL_COMPILE "Compiled using '$(CC)' on '`uname -a`' by '`whoami`'"' >> Headers/herald.h | |
246 | ||
247 | localconstants: | |
248 | @$(MV) Headers/local_constants.h Headers/local_constants.last | |
249 | @echo '/* local_constants.h - created automatically by gmake localconstants */' \ | |
250 | > Headers/local_constants.h | |
251 | ifndef SYSTEM_LIBDIR | |
252 | @echo '*** Fatal Error: SYSTEM_LIBDIR not defined.' | |
253 | else | |
254 | @echo '/*@constant observer char *SYSTEM_LIBDIR;@*/' >> Headers/local_constants.h | |
255 | @echo '# define SYSTEM_LIBDIR $(SYSTEM_LIBDIR)' >> Headers/local_constants.h | |
256 | ifndef DEFAULT_LARCHPATH | |
257 | @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.' | |
258 | else | |
259 | @echo '/*@constant observer char *DEFAULT_LARCHPATH;@*/' >> Headers/local_constants.h | |
260 | @echo '# define DEFAULT_LARCHPATH $(DEFAULT_LARCHPATH)' >> Headers/local_constants.h | |
261 | ifndef DEFAULT_LCLIMPORTDIR | |
262 | @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.' | |
263 | else | |
264 | @echo '/*@constant observer char *DEFAULT_LCLIMPORTDIR;@*/' >> Headers/local_constants.h | |
265 | @echo '# define DEFAULT_LCLIMPORTDIR $(DEFAULT_LCLIMPORTDIR)' >> Headers/local_constants.h | |
266 | endif | |
267 | endif | |
268 | endif | |
269 | ||
270 | dorelease: | |
271 | @echo '// ' | |
272 | @echo '// Making LCLint' | |
273 | @echo '// Version '`cat $(VERSION_NUMBER)` | |
274 | @echo '// ' | |
275 | @echo '// Compiler: '$(CCOPT) | |
276 | ifdef BISON | |
277 | @echo '// Bison: '$(BISON) | |
278 | else | |
279 | @echo '// Use derived bison files' | |
280 | endif | |
281 | ifdef FLEX | |
282 | @echo '// Flex: '$(FLEX) | |
283 | else | |
284 | @echo '// Use derived flex files' | |
285 | endif | |
286 | @echo '// Default cpp command: '$(DEFAULT_CPPCMD) | |
287 | @echo '// System include directory: '$(SYSTEM_LIBDIR) | |
288 | @echo '// Default Larch path: '$(DEFAULT_LARCHPATH) | |
289 | @echo '// Default imports directory: '$(DEFAULT_LCLIMPORTDIR) | |
290 | @echo '// ' | |
291 | @echo 'Making tags' | |
292 | ./maketags | |
293 | @echo '// ' | |
294 | @echo '// Updating version information' | |
295 | @$(MAKE) -e updateversion | |
296 | @echo '// Updating local constants' | |
28bf4b0b | 297 | @$(MAKE) -e localconstants |
4b86f30a | 298 | @echo '// Updating flags' |
299 | @$(MAKE) -e Headers/flag_codes.gen | |
9db38114 | 300 | @echo '// ' |
301 | @echo '// Compiling:' | |
302 | @echo '// ' | |
303 | @$(MAKE) -e opt | |
28bf4b0b | 304 | @echo '// Done Release' |
9db38114 | 305 | ### |
306 | ### cleaning | |
307 | ### | |
308 | ### Standard entries to remove files from the directories | |
309 | ### up --- remove .o files and grammar derivatives | |
310 | ### tidy --- eliminate unwanted files | |
311 | ### clean --- delete derived files, except for spec-derived files | |
312 | ### pristine --- delete all derived files | |
313 | ### | |
314 | ||
315 | .PHONY .IGNORE : up tidy clean pristine | |
316 | ||
317 | pristine: clean | |
318 | -$(RM) -f *.lcs *.lslo | |
a028d0b7 | 319 | -$(RM) signature.c signature.tab.c signature.tab.h |
320 | -$(RM) llgrammar.c llgrammar.tab.c llgrammar.tab.h | |
321 | -$(RM) Headers/cgrammar_tokens.h | |
322 | -$(RM) lex.yy.c | |
323 | -$(RM) cgrammar.tab.h | |
324 | -$(RM) Headers/*_gen.h* Headers/*_gen2.h* | |
9db38114 | 325 | |
326 | clean: tidy | |
327 | -$(RM) core lclint | |
328 | -$(RM) *.out *.output *.bib *.dvi *.idx *.log *.o *.toc | |
329 | -$(RM) cgrammar.c cscanner.c | |
330 | -$(RM) test* Headers/*~ Headers/#* | |
331 | ||
332 | tidy: | |
333 | -$(RM) ,* .,* *.CKP *.BAK .emacs_[0-9]* core a.out *.*~ | |
334 | ||
335 | up: | |
28bf4b0b | 336 | -$(RM) cgrammar.c llgrammar.c signature.c cscanner.c mtgrammar.c *.tab.[c,h] |
9db38114 | 337 | -$(RM) *.o |
338 | ||
339 | ### | |
340 | ### dependancies | |
341 | ### | |
342 | ||
343 | depend: | |
344 | $(MAKEDEPEND) $(CINCLUDES) $(CFLAGS) -f Makefile.depend $(SRC) $(GRAMS) | |
345 | ||
346 | ### | |
347 | ### analysing dependancies takes a long time and doesn't work terribly | |
348 | ### well, so the are NOT included here. NOTE carefully, this means if a | |
349 | ### header file is changed manual recompilation may be necessary. | |
350 | ### | |
351 | ||
352 | ### include Makefile.depend | |
353 | ||
354 | ### | |
355 | ### LCLint checking | |
356 | ### | |
357 | ||
358 | ### | |
359 | ### A library is used for the specifications | |
360 | ### | |
361 | ||
362 | $(CHECKS): lclint.lcd | |
363 | ||
28bf4b0b | 364 | flags: flags.def |
365 | grep "FLG_" flags.def > Headers/flag_codes.gen | |
366 | touch flags.c | |
367 | ||
9db38114 | 368 | ### |
369 | ### other flags are in .lclintrc file | |
370 | ### | |
371 | ||
28bf4b0b | 372 | tags: |
373 | etags ${ALLSRC} ${GRAMS} Headers/*.h *.i | |
374 | ||
375 | lintweak: | |
376 | ${HOME}/lclint-build/lclint-2.5q-freebsdbin/lclint -f weak.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) | |
377 | ||
378 | lintnew: | |
990ec868 | 379 | ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw |
9db38114 | 380 | |
f3a2d773 | 381 | lintfcn: |
382 | ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw +fcnconstraint | |
383 | ||
dfd03f44 | 384 | linttest: |
cd7d9b17 | 385 | ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude cpphash.c +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw +partial |
dfd03f44 | 386 | |
4ab867d6 | 387 | lint: |
28bf4b0b | 388 | ../bin/lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse |
389 | ||
390 | # -mts file | |
391 | ||
392 | lintabstract: | |
393 | lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse test.c +partial | |
394 | ||
395 | # -fcnuse -constuse -exportlocal -supcounts | |
396 | ||
397 | lintnodestroy: | |
398 | lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal -unrecogcomments -fcnuse -constuse -exportlocal -supcounts -compdestroy | |
9db38114 | 399 | |
28bf4b0b | 400 | linttest1g: |
401 | lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude test.c -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts +partial | |
402 | ||
403 | lint26: | |
404 | ${HOME}/lclint-2.6b/bin/lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts | |
405 | ||
406 | lint28: | |
407 | ${HOME}/lclint-2.8a/bin/lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts | |
408 | ||
409 | lint29: | |
410 | ${HOME}/lclint-2.9a/bin/lclint -f lclint.lclintrc $(CPPFLAGS) -larchpath .:${HOME}/lclint-2.9a/lib/ +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts | |
411 | ||
412 | lintm: | |
413 | lclint-2.5m -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint | |
414 | ||
415 | test: | |
416 | cp lclint ../bin/lclint | |
2c88d156 | 417 | cd ../test ; ${MAKE} test |
28bf4b0b | 418 | |
419 | libs: | |
420 | cd ../lib ; ${MAKE} | |
9db38114 | 421 | |
4ab867d6 | 422 | myall: |
423 | -$(RM) -f ../bin/lclint; \ | |
28bf4b0b | 424 | ${MAKE} -C .. |
425 | ||
426 | ctype.o: ctbase.i cttable.i | |
427 | #exprNode.o: exprData.i | |
9db38114 | 428 | |
28bf4b0b | 429 | ctype.c: ctbase.i cttable.i |
9db38114 | 430 | |
28bf4b0b | 431 | tokentable.c: Headers/signature_gen.h |
432 | ||
433 | #lint: | |
434 | # $(LCLINT) -f lclint.lclintrc $(CPPFLAGS) +forcehints +singleinclude -exportlocal -exportheader -abstract -namechecks -protoparammatch -temptrans -boolops $(ALLSRC) -dump lclint |