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