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
53 LCLINT = ../bin/lclint
59 include Makefile.sources
70 CHECK=0; export CHECK; ${MAKE} -e
76 $(CC) -o lclint $(OBJ) $(LINKFLAGS)
79 purify ${CC} -o lclint ${OBJ} ${LINKFLAGS}
86 ### -p xx flag to bison renames yyparse ==> xxparse, xxlex ==> xxlex
87 ### this is probably NOT compatible with yacc.
90 signature.c : signature.c.der signature.y
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
97 $(CP) signature.c.der signature.c
100 cgrammar.c : cgrammar.c.der cgrammar.y
102 $(BISON) $(YFLAGS) cgrammar.y
103 @echo '// Expect 119 shift/reduce conflicts and 115 reduce/reduce conflicts.'
104 @echo '// (see cgrammar.y for explanation)'
105 @$(CAT) bison.head cgrammar.tab.c bison.reset > cgrammar.c
106 -@$(MV) Headers/cgrammar_tokens.h Headers/cgrammar_tokens.bak
107 @$(CAT) bison.head cgrammar.tab.h bison.reset > Headers/cgrammar_tokens.h
108 @$(RM) cgrammar.tab.c cgrammar.tab.h
110 $(CP) cgrammar.c.der cgrammar.c
113 mtgrammar.c: mtgrammar.y
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
121 $(CP) mtgrammar.c.der mtgrammar.c
124 ### llgrammar2.h is necessary so +singleinclude may be used
126 llgrammar.c : llgrammar.c.der llgrammar.y
128 $(BISON) $(YFLAGS) -p yl llgrammar.y
129 @echo '// Expect 2 shift/reduce conflicts.'
130 @$(CAT) bison.head llgrammar.tab.c bison.reset > llgrammar.c
131 -@$(MV) Headers/llgrammar_gen2.h Headers/llgrammar_gen2.bak
132 @$(CAT) bison.head llgrammar.tab.h bison.reset > Headers/llgrammar_gen2.h
133 -@$(MV) Headers/llgrammar_gen.h Headers/llgrammar_gen.bak
134 @$(CAT) bison.head llgrammar.tab.h bison.reset > Headers/llgrammar_gen.h
135 @$(RM) llgrammar.tab.c llgrammar.tab.h
137 $(CP) llgrammar.c.der llgrammar.c
140 cscanner.c : cscanner.c.der cscanner.l
142 $(FLEX) $(LFLAGS) cscanner.l
143 $(CAT) flex.head lex.yy.c flex.reset > cscanner.c
145 $(CP) cscanner.c.der cscanner.c
149 ### compile without warnings
152 signature.o : signature.c
153 $(CC) $(CPPFLAGS) -c $*.c
155 cgrammar.o : cgrammar.c
156 $(CC) $(CPPFLAGS) -c $*.c
158 cscanner.o : cscanner.c
159 $(CC) $(CPPFLAGS) -c $*.c
161 mtgrammar.o : mtgrammar.c
162 $(CC) $(CPPFLAGS) -c $*.c
164 llgrammar.o : llgrammar.c
165 $(CC) $(CPPFLAGS) -c $*.c
169 ### header files dependant on grammars
172 Headers/signature2.h : signature.c
173 Headers/signature_gen.h : signature.c
174 Headers/cgrammar2.h : cgrammar.c
175 Headers/cgrammar_tokens.h : cgrammar.c
176 Headers/llgrammar.h : llgrammar.c
177 Headers/mtgrammar_tokens.h : mtgrammar.c
179 Headers/flag_codes.gen : flags.def
180 grep "FLG_" flags.def > Headers/flag_codes.gen
186 ### Flags for checking a single file
187 SINGLEFLAGS = -f lclint.lclintrc -supcounts +partial -unrecogcomments
189 LCLINT29 = ${HOME}/lclint-2.9c/src/lclint
191 .c.check: lclint.lcd lclint
192 -../bin/lclint $(CPPFLAGS) $(LINTFLAGS) $(SINGLEFLAGS) -load lclint.lcd +neverinclude $*.c +showsourceloc -mts file
193 # -$(LCLINT29) $(CPPFLAGS) $(LINTFLAGS) $(SINGLEFLAGS) -load lclint.lcd +neverinclude $*.c +showsourceloc
195 lcllib.c: Headers/llgrammar.h
196 clabstract.c: Headers/cgrammar_tokens.h
197 scan.c: Headers/signature2.h Headers/signature_gen.h
198 stateClause.c: Headers/cgrammar_tokens.h
205 @echo '// Compiling '$*.c' / compiled: '`$(OFILES)`' (of 161 files)'
206 $(CC) $(CFLAGS) -c $*.c
209 ### alternatives (tests, releases, backups, etc.)
212 ### -e option makes environment variables take precedence
214 .PHONY : test quicktest opt up backup
217 tar zcvf ../lclint-`date +%Y-%d-%m-%H-%M`.tgz ${ALLSRC} ${GRAMS} Headers/*.h *.i flags.def
220 mkdir ~/temp/lclint-`cat ${VERSION_NUMBER}`
221 mkdir ~/temp/lclint-`cat ${VERSION_NUMBER}`/src
222 cp Makefile* ${ALLSRC} ${GRAMS} *.i flags.def ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/
223 cp -r Headers ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/
224 cp -r ../lib ~/temp/lclint-`cat ${VERSION_NUMBER}`/lib
225 cp -r ../imports ~/temp/lclint-`cat ${VERSION_NUMBER}`/imports
226 cp -r ../test ~/temp/lclint-`cat ${VERSION_NUMBER}`/test
227 cp ../configure ../Makefile* ../README ~/temp/lclint-`cat ${VERSION_NUMBER}`/
228 cd ~/temp/lclint-`cat ${VERSION_NUMBER}`; rm */*.core ; tar zcvf ~/public_html/lclint/lclint-`cat ~/LCLintDev/src/${VERSION_NUMBER}`-beta.tgz *
229 chmod 644 ~/public_html/lclint/lclint-`cat ${VERSION_NUMBER}`.tgz
230 @echo "Make release lclint-`cat ${VERSION_NUMBER}`
233 ifneq (,$(findstring csh, $(SHELL)))
234 setenv CC '$(CCOPT)' ; $(MAKE) -e lclint
236 CC="$(CCOPT)" ; export CC ; $(MAKE) -e lclint
240 -@$(MV) Headers/herald.h Headers/herald.last
241 @echo '/* herald.h - created automatically by gmake updateversion */' > Headers/herald.h
242 @echo '/*@constant observer char *LCL_VERSION;@*/' >> Headers/herald.h
243 @echo '# define LCL_VERSION "LCLint '`cat $(VERSION_NUMBER)`' --- '`cat DATE`'"' \
245 @echo '/*@constant observer char *LCL_PARSE_VERSION;@*/' >> Headers/herald.h
246 @echo '# define LCL_PARSE_VERSION "LCLint '`cat $(VERSION_NUMBER)`'"' \
248 @echo '/*@constant observer char *LCL_COMPILE;@*/' >> Headers/herald.h
249 @echo '# define LCL_COMPILE "Compiled using '$(CC)' on '`uname -a`' by '`whoami`'"' >> Headers/herald.h
252 @$(MV) Headers/local_constants.h Headers/local_constants.last
253 @echo '/* local_constants.h - created automatically by gmake localconstants */' \
254 > Headers/local_constants.h
256 @echo '*** Fatal Error: SYSTEM_LIBDIR not defined.'
258 @echo '/*@constant observer char *SYSTEM_LIBDIR;@*/' >> Headers/local_constants.h
259 @echo '# define SYSTEM_LIBDIR $(SYSTEM_LIBDIR)' >> Headers/local_constants.h
260 ifndef DEFAULT_LARCHPATH
261 @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
263 @echo '/*@constant observer char *DEFAULT_LARCHPATH;@*/' >> Headers/local_constants.h
264 @echo '# define DEFAULT_LARCHPATH $(DEFAULT_LARCHPATH)' >> Headers/local_constants.h
265 ifndef DEFAULT_LCLIMPORTDIR
266 @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
268 @echo '/*@constant observer char *DEFAULT_LCLIMPORTDIR;@*/' >> Headers/local_constants.h
269 @echo '# define DEFAULT_LCLIMPORTDIR $(DEFAULT_LCLIMPORTDIR)' >> Headers/local_constants.h
276 @echo '// Making LCLint'
277 @echo '// Version '`cat $(VERSION_NUMBER)`
279 @echo '// Compiler: '$(CCOPT)
281 @echo '// Bison: '$(BISON)
283 @echo '// Use derived bison files'
286 @echo '// Flex: '$(FLEX)
288 @echo '// Use derived flex files'
290 @echo '// Default cpp command: '$(DEFAULT_CPPCMD)
291 @echo '// System include directory: '$(SYSTEM_LIBDIR)
292 @echo '// Default Larch path: '$(DEFAULT_LARCHPATH)
293 @echo '// Default imports directory: '$(DEFAULT_LCLIMPORTDIR)
298 @echo '// Updating version information'
299 @$(MAKE) -e updateversion
300 @echo '// Updating local constants'
301 @$(MAKE) -e localconstants
302 @echo '// Updating flags'
303 @$(MAKE) -e Headers/flag_codes.gen
305 @echo '// Compiling:'
308 @echo '// Done Release'
312 ### Standard entries to remove files from the directories
313 ### up --- remove .o files and grammar derivatives
314 ### tidy --- eliminate unwanted files
315 ### clean --- delete derived files, except for spec-derived files
316 ### pristine --- delete all derived files
319 .PHONY .IGNORE : up tidy clean pristine
322 -$(RM) -f *.lcs *.lslo
323 -$(RM) signature.c signature.tab.c signature.tab.h
324 -$(RM) llgrammar.c llgrammar.tab.c llgrammar.tab.h
325 -$(RM) Headers/cgrammar_tokens.h
327 -$(RM) cgrammar.tab.h
328 -$(RM) Headers/*_gen.h* Headers/*_gen2.h*
332 -$(RM) *.out *.output *.bib *.dvi *.idx *.log *.o *.toc
333 -$(RM) cgrammar.c cscanner.c
334 -$(RM) test* Headers/*~ Headers/#*
337 -$(RM) ,* .,* *.CKP *.BAK .emacs_[0-9]* core a.out *.*~
340 -$(RM) cgrammar.c llgrammar.c signature.c cscanner.c mtgrammar.c *.tab.[c,h]
348 $(MAKEDEPEND) $(CINCLUDES) $(CFLAGS) -f Makefile.depend $(SRC) $(GRAMS)
351 ### analysing dependancies takes a long time and doesn't work terribly
352 ### well, so the are NOT included here. NOTE carefully, this means if a
353 ### header file is changed manual recompilation may be necessary.
356 ### include Makefile.depend
363 ### A library is used for the specifications
366 $(CHECKS): lclint.lcd
369 grep "FLG_" flags.def > Headers/flag_codes.gen
373 ### other flags are in .lclintrc file
377 etags ${ALLSRC} ${GRAMS} Headers/*.h *.i
380 ${HOME}/lclint-build/lclint-2.5q-freebsdbin/lclint -f weak.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC)
383 ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw
386 ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw +fcnconstraint
389 ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude cpphash.c +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw +partial
392 ../bin/lclint -f lclint.lclintrc llmain.c $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -supcounts -fcnuse -exportlocal -unrecogcomments -constuse -mts file
397 lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse test.c +partial
399 # -fcnuse -constuse -exportlocal -supcounts
402 lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal -unrecogcomments -fcnuse -constuse -exportlocal -supcounts -compdestroy
405 lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude test.c -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts +partial
408 ${HOME}/lclint-2.6b/bin/lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts
411 ${HOME}/lclint-2.8a/bin/lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts
414 ${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
417 lclint-2.5m -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint
420 cp lclint ../bin/lclint
421 cd ../test ; ${MAKE} test
427 -$(RM) -f ../bin/lclint; \
430 ctype.o: ctbase.i cttable.i
431 #exprNode.o: exprData.i
433 ctype.c: ctbase.i cttable.i
435 tokentable.c: Headers/signature_gen.h
438 # $(LCLINT) -f lclint.lclintrc $(CPPFLAGS) +forcehints +singleinclude -exportlocal -exportheader -abstract -namechecks -protoparammatch -temptrans -boolops $(ALLSRC) -dump lclint