1 ##################################################
3 ### Makefile for LCLint
5 ### designed for use with gmake (GNU make)
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
13 ### This file should not need to be edited.
15 ### Compilers and tools set using the top-level Makefile override settings
16 ### in this file when make is run from the top directory.
21 ### builds a release version of lclint from scratch using optimizations
24 ### builds a local version of lclint (no optimizations)
25 ### (does not remake files)
28 ### runs the test suite
29 ### (must have installed test suite from lclint.test.tar.Z)
32 .SUFFIXES : .h .c .o .l .check
33 .PHONY : all dorerelease retest rerelease homeversion test updateversion
34 .IGNORE : dorerelease retest rerelease
37 ### system information (compilers, flags, directories, etc.)
43 ### check files before compiling
44 ### (can't be 1 unless you have lclint already!)
47 CHECK = 1 ### set to 1
49 #LCLINT = //tmp/lclint-2.5q/bin/lclint
50 #LCLINTNEW = //afs/cert.org/usr/dlaroche/evLCLintDev/bin/lclint
51 #LCLINTNEW = /home/drl7x/evLCLintDev/evLCLintDev/bin/lclint
52 #LCLINTNEW = /home/drl7x/stabletest/LCLintDev/bin/lclint
54 LCLINT = ../bin/lclint
60 include Makefile.sources
71 CHECK=0; export CHECK; ${MAKE} -e
77 $(CC) -o lclint $(OBJ) $(LINKFLAGS)
80 purify ${CC} -o lclint ${OBJ} ${LINKFLAGS}
87 ### -p xx flag to bison renames yyparse ==> xxparse, xxlex ==> xxlex
88 ### this is probably NOT compatible with yacc.
91 signature.c : signature.c.der signature.y
93 $(BISON) $(YFLAGS) -p lsl signature.y
94 $(CAT) bison.head signature.tab.c bison.reset > signature.c
95 -$(MV) Headers/signature_gen.h Headers/signature_gen.bak
96 $(CAT) bison.head signature.tab.h bison.reset > Headers/signature_gen.h
98 $(CP) signature.c.der signature.c
101 cgrammar.c : cgrammar.c.der cgrammar.y
103 $(BISON) $(YFLAGS) cgrammar.y
104 @echo '// Expect 141 shift/reduce conflicts and 111 reduce/reduce conflicts.'
105 @echo '// (see cgrammar.y for explanation)'
106 @$(CAT) bison.head cgrammar.tab.c bison.reset > cgrammar.c
107 -@$(MV) Headers/cgrammar_tokens.h Headers/cgrammar_tokens.bak
108 @$(CAT) bison.head cgrammar.tab.h bison.reset > Headers/cgrammar_tokens.h
109 @$(RM) cgrammar.tab.c cgrammar.tab.h
111 $(CP) cgrammar.c.der cgrammar.c
114 mtgrammar.c: mtgrammar.y
116 $(BISON) $(YFLAGS) -p mt mtgrammar.y
117 @$(CAT) bison.head mtgrammar.tab.c bison.reset > mtgrammar.c
118 # @$(MV) Headers/mtgrammar_tokens.h Headers/mtgrammar_tokens.bak
119 @$(CAT) bison.head mtgrammar.tab.h bison.reset > Headers/mtgrammar_tokens.h
120 @$(RM) mtgrammar.tab.c mtgrammar.tab.h
122 $(CP) mtgrammar.c.der mtgrammar.c
125 ### llgrammar2.h is necessary so +singleinclude may be used
127 llgrammar.c : llgrammar.c.der llgrammar.y
129 $(BISON) $(YFLAGS) -p yl llgrammar.y
130 @echo '// Expect 2 shift/reduce conflicts.'
131 @$(CAT) bison.head llgrammar.tab.c bison.reset > llgrammar.c
132 -@$(MV) Headers/llgrammar_gen2.h Headers/llgrammar_gen2.bak
133 @$(CAT) bison.head llgrammar.tab.h bison.reset > Headers/llgrammar_gen2.h
134 -@$(MV) Headers/llgrammar_gen.h Headers/llgrammar_gen.bak
135 @$(CAT) bison.head llgrammar.tab.h bison.reset > Headers/llgrammar_gen.h
136 @$(RM) llgrammar.tab.c llgrammar.tab.h
138 $(CP) llgrammar.c.der llgrammar.c
141 cscanner.c : cscanner.c.der cscanner.l
143 $(FLEX) $(LFLAGS) cscanner.l
144 $(CAT) flex.head lex.yy.c flex.reset > cscanner.c
146 $(CP) cscanner.c.der cscanner.c
150 ### compile without warnings
153 signature.o : signature.c
154 $(CC) $(CPPFLAGS) -c $*.c
156 cgrammar.o : cgrammar.c
157 $(CC) $(CPPFLAGS) -c $*.c
159 cscanner.o : cscanner.c
160 $(CC) $(CPPFLAGS) -c $*.c
162 mtgrammar.o : mtgrammar.c
163 $(CC) $(CPPFLAGS) -c $*.c
165 llgrammar.o : llgrammar.c
166 $(CC) $(CPPFLAGS) -c $*.c
170 ### header files dependant on grammars
173 Headers/signature2.h : signature.c
174 Headers/signature_gen.h : signature.c
175 Headers/cgrammar2.h : cgrammar.c
176 Headers/cgrammar_tokens.h : cgrammar.c
177 Headers/llgrammar.h : llgrammar.c
178 Headers/mtgrammar_tokens.h : mtgrammar.c
180 Headers/flag_codes.gen : flags.def
181 grep "FLG_" flags.def > Headers/flag_codes.gen
187 ### Flags for checking a single file
188 SINGLEFLAGS = -f lclint.lclintrc -supcounts +partial -unrecogcomments
190 LCLINT29 = ${HOME}/lclint-2.9c/src/lclint
192 .c.check: lclint.lcd lclint
193 -../bin/lclint $(CPPFLAGS) $(LINTFLAGS) $(SINGLEFLAGS) -load lclint.lcd +neverinclude $*.c +showsourceloc -mts file
194 # -$(LCLINT29) $(CPPFLAGS) $(LINTFLAGS) $(SINGLEFLAGS) -load lclint.lcd +neverinclude $*.c +showsourceloc
196 lcllib.c: Headers/llgrammar.h
197 clabstract.c: Headers/cgrammar_tokens.h
198 scan.c: Headers/signature2.h Headers/signature_gen.h
199 stateClause.c: Headers/cgrammar_tokens.h
206 @echo '// Compiling '$*.c' / compiled: '`$(OFILES)`' (of 181 files)'
207 $(CC) $(CPPFLAGS) $(CFLAGS) -c $*.c
210 ### alternatives (tests, releases, backups, etc.)
213 ### -e option makes environment variables take precedence
215 .PHONY : test quicktest opt up backup
218 tar zcvf ../lclint-`date +%Y-%d-%m-%H-%M`.tgz ${ALLSRC} ${GRAMS} Headers/*.h *.i flags.def
221 mkdir ~/temp/lclint-`cat ${VERSION_NUMBER}`
222 mkdir ~/temp/lclint-`cat ${VERSION_NUMBER}`/src
223 cp Makefile* ${ALLSRC} ${GRAMS} *.i flags.def ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/
224 cp cscanner.c ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/cscanner.c.der
225 cp lastversion maketags ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/
226 cp *.head *.reset ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/
227 cp cgrammar.c ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/cgrammar.c.der
228 cp llgrammar.c ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/llgrammar.c.der
229 cp signature.c ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/signature.c.der
230 cp mtgrammar.c ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/mtgrammar.c.der
231 cp -r Headers ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/
232 cp -r ../lib ~/temp/lclint-`cat ${VERSION_NUMBER}`/lib
233 cp -r ../imports ~/temp/lclint-`cat ${VERSION_NUMBER}`/imports
234 cp -r ../test ~/temp/lclint-`cat ${VERSION_NUMBER}`/test
235 cp ../configure ../Makefile* ../LICENSE ../README ../BUFFERCHECKING ~/temp/lclint-`cat ${VERSION_NUMBER}`/
236 cd ~/temp/lclint-`cat ${VERSION_NUMBER}`; mkdir bin
237 cd ~/temp/lclint-`cat ${VERSION_NUMBER}`; rm -r test/temp
238 cd ~/temp/lclint-`cat ${VERSION_NUMBER}`; rm -f *~ */*~ */*/*~ #* */#* */*/#* .#* */.#* */*/.# */*.core
239 cd ~/temp/lclint-`cat ${VERSION_NUMBER}`; rm -rf CVS */CVS */*/CVS */*/*/CVS */*/*/*/CVS
240 cd ~/temp/; tar czvf ~/public_html/lclint/lclint-`cat ~/LCLintDev/src/${VERSION_NUMBER}`.src.tgz lclint-`cat ~/LCLintDev/src/${VERSION_NUMBER}`
241 chmod 644 ~/public_html/lclint/lclint-`cat ${VERSION_NUMBER}`.src.tgz
242 ls -l ~/public_html/lclint/lclint-*.tgz
243 @echo "Made release lclint-`cat ${VERSION_NUMBER}`"
246 ifneq (,$(findstring csh, $(SHELL)))
247 setenv CC '$(CCOPT)' ; $(MAKE) -e lclint
249 CC="$(CCOPT)" ; export CC ; $(MAKE) -e lclint
253 -@$(MV) Headers/herald.h Headers/herald.last
254 @echo '/* herald.h - created automatically by gmake updateversion */' > Headers/herald.h
255 @echo '/*@constant observer char *LCL_VERSION;@*/' >> Headers/herald.h
256 @echo '# define LCL_VERSION "LCLint '`cat $(VERSION_NUMBER)`' --- '`cat DATE`'"' \
258 @echo '/*@constant observer char *LCL_PARSE_VERSION;@*/' >> Headers/herald.h
259 @echo '# define LCL_PARSE_VERSION "LCLint '`cat $(VERSION_NUMBER)`'"' \
261 @echo '/*@constant observer char *LCL_COMPILE;@*/' >> Headers/herald.h
262 @echo '# define LCL_COMPILE "Compiled using '$(CC)' on '`uname -a`' by '`whoami`'"' >> Headers/herald.h
265 @$(MV) Headers/local_constants.h Headers/local_constants.last
266 @echo '/* local_constants.h - created automatically by gmake localconstants */' \
267 > Headers/local_constants.h
269 @echo '*** Fatal Error: SYSTEM_LIBDIR not defined.'
271 @echo '/*@constant observer char *SYSTEM_LIBDIR;@*/' >> Headers/local_constants.h
272 @echo '# define SYSTEM_LIBDIR $(SYSTEM_LIBDIR)' >> Headers/local_constants.h
273 ifndef DEFAULT_LARCHPATH
274 @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
276 @echo '/*@constant observer char *DEFAULT_LARCHPATH;@*/' >> Headers/local_constants.h
277 @echo '# define DEFAULT_LARCHPATH $(DEFAULT_LARCHPATH)' >> Headers/local_constants.h
278 ifndef DEFAULT_LCLIMPORTDIR
279 @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
281 @echo '/*@constant observer char *DEFAULT_LCLIMPORTDIR;@*/' >> Headers/local_constants.h
282 @echo '# define DEFAULT_LCLIMPORTDIR $(DEFAULT_LCLIMPORTDIR)' >> Headers/local_constants.h
289 @echo '// Making LCLint'
290 @echo '// Version '`cat $(VERSION_NUMBER)`
292 @echo '// Compiler: '$(CCOPT)
294 @echo '// Bison: '$(BISON)
296 @echo '// Use derived bison files'
299 @echo '// Flex: '$(FLEX)
301 @echo '// Use derived flex files'
303 @echo '// Default cpp command: '$(DEFAULT_CPPCMD)
304 @echo '// System include directory: '$(SYSTEM_LIBDIR)
305 @echo '// Default Larch path: '$(DEFAULT_LARCHPATH)
306 @echo '// Default imports directory: '$(DEFAULT_LCLIMPORTDIR)
311 @echo '// Updating version information'
312 @$(MAKE) -e updateversion
313 @echo '// Updating local constants'
314 @$(MAKE) -e localconstants
315 @echo '// Updating flags'
316 @$(MAKE) -e Headers/flag_codes.gen
318 @echo '// Compiling:'
321 @echo '// Done Release'
325 ### Standard entries to remove files from the directories
326 ### up --- remove .o files and grammar derivatives
327 ### tidy --- eliminate unwanted files
328 ### clean --- delete derived files, except for spec-derived files
329 ### pristine --- delete all derived files
332 .PHONY .IGNORE : up tidy clean pristine
335 -$(RM) -f *.lcs *.lslo
336 -$(RM) signature.c signature.tab.c signature.tab.h
337 -$(RM) llgrammar.c llgrammar.tab.c llgrammar.tab.h
338 -$(RM) Headers/cgrammar_tokens.h
340 -$(RM) cgrammar.tab.h
341 -$(RM) Headers/*_gen.h* Headers/*_gen2.h*
345 -$(RM) *.out *.output *.bib *.dvi *.idx *.log *.o *.toc
346 -$(RM) cgrammar.c cscanner.c
347 -$(RM) test* Headers/*~ Headers/#*
350 -$(RM) ,* .,* *.CKP *.BAK .emacs_[0-9]* core a.out *.*~
353 -$(RM) cgrammar.c llgrammar.c signature.c cscanner.c mtgrammar.c *.tab.[c,h]
361 $(MAKEDEPEND) $(CINCLUDES) $(CPPFLAGS) -f Makefile.depend $(SRC) $(GRAMS)
364 ### analysing dependancies takes a long time and doesn't work terribly
365 ### well, so the are NOT included here. NOTE carefully, this means if a
366 ### header file is changed manual recompilation may be necessary.
369 ### include Makefile.depend
376 ### A library is used for the specifications
379 $(CHECKS): lclint.lcd
382 grep "FLG_" flags.def > Headers/flag_codes.gen
386 ### other flags are in .lclintrc file
390 etags ${ALLSRC} ${GRAMS} Headers/*.h *.i
393 ${HOME}/lclint-build/lclint-2.5q-freebsdbin/lclint -f weak.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC)
396 ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw
399 ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw +fcnconstraint
402 ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude cpphash.c +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw +partial
405 ../bin/lclint -f lclint.lclintrc llmain.c $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -supcounts -fcnuse -exportlocal -unrecogcomments -constuse -mts file
410 lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse test.c +partial
412 # -fcnuse -constuse -exportlocal -supcounts
415 lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal -unrecogcomments -fcnuse -constuse -exportlocal -supcounts -compdestroy
418 lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude test.c -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts +partial
421 ${HOME}/lclint-2.6b/bin/lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts
424 ${HOME}/lclint-2.8a/bin/lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts
427 ${HOME}/lclint-2.9a/bin/lclint -f lclint.lclintrc $(CPPFLAGS) -larchpath .:${HOME}/lclint-2.9a/lib/ +singleinclue $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts
430 lclint-2.5m -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint
433 cp lclint ../bin/lclint
434 cd ../test ; ${MAKE} test
440 -$(RM) -f ../bin/lclint; \
443 ctype.o: ctbase.i cttable.i
444 #exprNode.o: exprData.i
446 ctype.c: ctbase.i cttable.i
448 tokentable.c: Headers/signature_gen.h
451 # $(LCLINT) -f lclint.lclintrc $(CPPFLAGS) +forcehints +singleinclude -exportlocal -exportheader -abstract -namechecks -protoparammatch -temptrans -boolops $(ALLSRC) -dump lclint