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