]> andersk Git - splint.git/blame - src/Makefile
*** empty log message ***
[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
990ec868 52LCLINTNEW = lclint
28bf4b0b 53LCLINT = ../bin/lclint
a8e557d3 54
9db38114 55###
56### source files
57###
58
59include Makefile.sources
60
61###
62### top level
63###
64
65all : dorelease
66
67quick: lclint
68
28bf4b0b 69nocheck:
70 CHECK=0; export CHECK; ${MAKE} -e
71
9db38114 72lclint : $(OBJ)
73 @echo '// '
74 @echo '// Linking:'
75 @echo '// '
76 $(CC) -o lclint $(OBJ) $(LINKFLAGS)
77
28bf4b0b 78purify: ${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
90signature.c : signature.c.der signature.y
91ifdef 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 96else
97 $(CP) signature.c.der signature.c
98endif
99
100cgrammar.c : cgrammar.c.der cgrammar.y
101ifdef 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 109else
110 $(CP) cgrammar.c.der cgrammar.c
111endif
112
28bf4b0b 113mtgrammar.c: mtgrammar.y
114ifdef 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 120else
121 $(CP) mtgrammar.c.der mtgrammar.c
122endif
123
9db38114 124### llgrammar2.h is necessary so +singleinclude may be used
125
126llgrammar.c : llgrammar.c.der llgrammar.y
127ifdef 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 136else
137 $(CP) llgrammar.c.der llgrammar.c
138endif
139
140cscanner.c : cscanner.c.der cscanner.l
141ifdef FLEX
142 $(FLEX) $(LFLAGS) cscanner.l
28bf4b0b 143 $(CAT) flex.head lex.yy.c flex.reset > cscanner.c
9db38114 144else
145 $(CP) cscanner.c.der cscanner.c
146endif
147
148###
149### compile without warnings
150###
151
152signature.o : signature.c
153 $(CC) $(CPPFLAGS) -c $*.c
154
155cgrammar.o : cgrammar.c
156 $(CC) $(CPPFLAGS) -c $*.c
157
28bf4b0b 158cscanner.o : cscanner.c
9db38114 159 $(CC) $(CPPFLAGS) -c $*.c
160
12f2ffe9 161mtgrammar.o : mtgrammar.c
162 $(CC) $(CPPFLAGS) -c $*.c
163
28bf4b0b 164llgrammar.o : llgrammar.c
9db38114 165 $(CC) $(CPPFLAGS) -c $*.c
166
28bf4b0b 167
9db38114 168###
169### header files dependant on grammars
170###
171
172Headers/signature2.h : signature.c
28bf4b0b 173Headers/signature_gen.h : signature.c
9db38114 174Headers/cgrammar2.h : cgrammar.c
a028d0b7 175Headers/cgrammar_tokens.h : cgrammar.c
9db38114 176Headers/llgrammar.h : llgrammar.c
12f2ffe9 177Headers/mtgrammar_tokens.h : mtgrammar.c
9db38114 178
28bf4b0b 179Headers/flag_codes.gen : flags.def
180 grep "FLG_" flags.def > Headers/flag_codes.gen
181
9db38114 182###
183### defaults
184###
185
186### Flags for checking a single file
28bf4b0b 187SINGLEFLAGS = -f lclint.lclintrc -supcounts +partial -unrecogcomments
188
189LCLINT29 = ${HOME}/lclint-2.9c/src/lclint
9db38114 190
191.c.check: lclint.lcd lclint
28bf4b0b 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
9db38114 194
a028d0b7 195lcllib.c: Headers/llgrammar.h
196clabstract.c: Headers/cgrammar_tokens.h
28bf4b0b 197scan.c: Headers/signature2.h Headers/signature_gen.h
198stateClause.c: Headers/cgrammar_tokens.h
199
a028d0b7 200
9db38114 201.c.o:
202ifeq ($(CHECK), 1)
28bf4b0b 203 ${MAKE} $*.check
9db38114 204endif
28bf4b0b 205 @echo '// Compiling '$*.c' / compiled: '`$(OFILES)`' (of 161 files)'
206 $(CC) $(CFLAGS) -c $*.c
9db38114 207
208###
209### alternatives (tests, releases, backups, etc.)
210###
211
212### -e option makes environment variables take precedence
213
28bf4b0b 214.PHONY : test quicktest opt up backup
215
216backup:
217 tar zcvf ../lclint-`date +%Y-%d-%m-%H-%M`.tgz ${ALLSRC} ${GRAMS} Headers/*.h *.i flags.def
218
219betarelease:
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}`/
7b1629ab 228 cd ~/temp/lclint-`cat ${VERSION_NUMBER}`; rm */*.core ; tar zcvf ~/public_html/lclint/lclint-`cat ~/LCLintDev/src/${VERSION_NUMBER}`-beta.tgz *
28bf4b0b 229 chmod 644 ~/public_html/lclint/lclint-`cat ${VERSION_NUMBER}`.tgz
7b1629ab 230 @echo "Make release lclint-`cat ${VERSION_NUMBER}`
9db38114 231
232opt :
233ifneq (,$(findstring csh, $(SHELL)))
234 setenv CC '$(CCOPT)' ; $(MAKE) -e lclint
235else
236 CC="$(CCOPT)" ; export CC ; $(MAKE) -e lclint
237endif
238
239updateversion:
920a3797 240 -@$(MV) Headers/herald.h Headers/herald.last
9db38114 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`'"' \
244 >> Headers/herald.h
245 @echo '/*@constant observer char *LCL_PARSE_VERSION;@*/' >> Headers/herald.h
246 @echo '# define LCL_PARSE_VERSION "LCLint '`cat $(VERSION_NUMBER)`'"' \
247 >> Headers/herald.h
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
250
251localconstants:
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
255ifndef SYSTEM_LIBDIR
256 @echo '*** Fatal Error: SYSTEM_LIBDIR not defined.'
257else
258 @echo '/*@constant observer char *SYSTEM_LIBDIR;@*/' >> Headers/local_constants.h
259 @echo '# define SYSTEM_LIBDIR $(SYSTEM_LIBDIR)' >> Headers/local_constants.h
260ifndef DEFAULT_LARCHPATH
261 @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
262else
263 @echo '/*@constant observer char *DEFAULT_LARCHPATH;@*/' >> Headers/local_constants.h
264 @echo '# define DEFAULT_LARCHPATH $(DEFAULT_LARCHPATH)' >> Headers/local_constants.h
265ifndef DEFAULT_LCLIMPORTDIR
266 @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
267else
268 @echo '/*@constant observer char *DEFAULT_LCLIMPORTDIR;@*/' >> Headers/local_constants.h
269 @echo '# define DEFAULT_LCLIMPORTDIR $(DEFAULT_LCLIMPORTDIR)' >> Headers/local_constants.h
270endif
271endif
272endif
273
274dorelease:
275 @echo '// '
276 @echo '// Making LCLint'
277 @echo '// Version '`cat $(VERSION_NUMBER)`
278 @echo '// '
279 @echo '// Compiler: '$(CCOPT)
280ifdef BISON
281 @echo '// Bison: '$(BISON)
282else
283 @echo '// Use derived bison files'
284endif
285ifdef FLEX
286 @echo '// Flex: '$(FLEX)
287else
288 @echo '// Use derived flex files'
289endif
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)
294 @echo '// '
295 @echo 'Making tags'
296 ./maketags
297 @echo '// '
298 @echo '// Updating version information'
299 @$(MAKE) -e updateversion
300 @echo '// Updating local constants'
28bf4b0b 301 @$(MAKE) -e localconstants
4b86f30a 302 @echo '// Updating flags'
303 @$(MAKE) -e Headers/flag_codes.gen
9db38114 304 @echo '// '
305 @echo '// Compiling:'
306 @echo '// '
307 @$(MAKE) -e opt
28bf4b0b 308 @echo '// Done Release'
9db38114 309###
310### cleaning
311###
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
317###
318
319.PHONY .IGNORE : up tidy clean pristine
320
321pristine: clean
322 -$(RM) -f *.lcs *.lslo
a028d0b7 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
326 -$(RM) lex.yy.c
327 -$(RM) cgrammar.tab.h
328 -$(RM) Headers/*_gen.h* Headers/*_gen2.h*
9db38114 329
330clean: tidy
331 -$(RM) core lclint
332 -$(RM) *.out *.output *.bib *.dvi *.idx *.log *.o *.toc
333 -$(RM) cgrammar.c cscanner.c
334 -$(RM) test* Headers/*~ Headers/#*
335
336tidy:
337 -$(RM) ,* .,* *.CKP *.BAK .emacs_[0-9]* core a.out *.*~
338
339up:
28bf4b0b 340 -$(RM) cgrammar.c llgrammar.c signature.c cscanner.c mtgrammar.c *.tab.[c,h]
9db38114 341 -$(RM) *.o
342
343###
344### dependancies
345###
346
347depend:
348 $(MAKEDEPEND) $(CINCLUDES) $(CFLAGS) -f Makefile.depend $(SRC) $(GRAMS)
349
350###
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.
354###
355
356### include Makefile.depend
357
358###
359### LCLint checking
360###
361
362###
363### A library is used for the specifications
364###
365
366$(CHECKS): lclint.lcd
367
28bf4b0b 368flags: flags.def
369 grep "FLG_" flags.def > Headers/flag_codes.gen
370 touch flags.c
371
9db38114 372###
373### other flags are in .lclintrc file
374###
375
28bf4b0b 376tags:
377 etags ${ALLSRC} ${GRAMS} Headers/*.h *.i
378
379lintweak:
380 ${HOME}/lclint-build/lclint-2.5q-freebsdbin/lclint -f weak.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC)
381
382lintnew:
990ec868 383 ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw
9db38114 384
f3a2d773 385lintfcn:
386 ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw +fcnconstraint
387
dfd03f44 388linttest:
cd7d9b17 389 ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude cpphash.c +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw +partial
dfd03f44 390
4ab867d6 391lint:
28bf4b0b 392 ../bin/lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse
393
394# -mts file
395
396lintabstract:
397 lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse test.c +partial
398
399# -fcnuse -constuse -exportlocal -supcounts
400
401lintnodestroy:
402 lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal -unrecogcomments -fcnuse -constuse -exportlocal -supcounts -compdestroy
9db38114 403
28bf4b0b 404linttest1g:
405 lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude test.c -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts +partial
406
407lint26:
408 ${HOME}/lclint-2.6b/bin/lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts
409
410lint28:
411 ${HOME}/lclint-2.8a/bin/lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts
412
413lint29:
414 ${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
415
416lintm:
417 lclint-2.5m -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint
418
419test:
420 cp lclint ../bin/lclint
2c88d156 421 cd ../test ; ${MAKE} test
28bf4b0b 422
423libs:
424 cd ../lib ; ${MAKE}
9db38114 425
4ab867d6 426myall:
427 -$(RM) -f ../bin/lclint; \
28bf4b0b 428 ${MAKE} -C ..
429
430ctype.o: ctbase.i cttable.i
431#exprNode.o: exprData.i
9db38114 432
28bf4b0b 433ctype.c: ctbase.i cttable.i
9db38114 434
28bf4b0b 435tokentable.c: Headers/signature_gen.h
436
437#lint:
438# $(LCLINT) -f lclint.lclintrc $(CPPFLAGS) +forcehints +singleinclude -exportlocal -exportheader -abstract -namechecks -protoparammatch -temptrans -boolops $(ALLSRC) -dump lclint
This page took 0.12582 seconds and 5 git commands to generate.