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