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