]> andersk Git - splint.git/blob - src/Makefile
1ee57f017746cef4786e2237fe7b46f13256f47a
[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 ###
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
88 signature.c : signature.c.der signature.y
89 ifdef BISON
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
94 else
95         $(CP) signature.c.der signature.c
96 endif
97
98 cgrammar.c : cgrammar.c.der cgrammar.y
99 ifdef BISON
100         $(BISON) $(YFLAGS) cgrammar.y
101         @echo '//           Expect 141 shift/reduce conflicts and 111 reduce/reduce conflicts.'
102         @echo '//           (see cgrammar.y for explanation)'
103         @$(CAT) bison.head cgrammar.tab.c bison.reset > cgrammar.c
104         -@$(MV) Headers/cgrammar_tokens.h Headers/cgrammar_tokens.bak
105         @$(CAT) bison.head cgrammar.tab.h bison.reset > Headers/cgrammar_tokens.h
106         @$(RM) cgrammar.tab.c cgrammar.tab.h
107 else
108         $(CP) cgrammar.c.der cgrammar.c
109 endif
110
111 mtgrammar.c: mtgrammar.y
112 ifdef 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
118 else
119         $(CP) mtgrammar.c.der mtgrammar.c
120 endif
121
122 ### llgrammar2.h is necessary so +singleinclude may be used
123
124 llgrammar.c  : llgrammar.c.der llgrammar.y
125 ifdef BISON
126         $(BISON) $(YFLAGS) -p yl llgrammar.y
127         @echo '//            Expect 2 shift/reduce conflicts.'
128         @$(CAT) bison.head llgrammar.tab.c bison.reset > llgrammar.c
129         -@$(MV) Headers/llgrammar_gen2.h Headers/llgrammar_gen2.bak
130         @$(CAT) bison.head llgrammar.tab.h bison.reset > Headers/llgrammar_gen2.h
131         -@$(MV) Headers/llgrammar_gen.h Headers/llgrammar_gen.bak
132         @$(CAT) bison.head llgrammar.tab.h bison.reset > Headers/llgrammar_gen.h
133         @$(RM) llgrammar.tab.c llgrammar.tab.h
134 else
135         $(CP) llgrammar.c.der llgrammar.c
136 endif
137
138 cscanner.c : cscanner.c.der cscanner.l
139 ifdef FLEX                              
140         $(FLEX) $(LFLAGS) cscanner.l 
141         $(CAT) flex.head lex.yy.c flex.reset > cscanner.c
142 else
143         $(CP) cscanner.c.der cscanner.c
144 endif
145
146 ###
147 ### compile without warnings
148 ### 
149
150 signature.o : signature.c
151         $(CC) $(CPPFLAGS) -c $*.c
152
153 cgrammar.o : cgrammar.c
154         $(CC) $(CPPFLAGS) -c $*.c
155
156 cscanner.o : cscanner.c
157         $(CC) $(CPPFLAGS) -c $*.c
158
159 mtgrammar.o : mtgrammar.c
160         $(CC) $(CPPFLAGS) -c $*.c
161
162 llgrammar.o : llgrammar.c
163         $(CC) $(CPPFLAGS) -c $*.c
164
165
166 ###
167 ### header files dependant on grammars
168 ###
169
170 Headers/signature2.h : signature.c
171 Headers/signature_gen.h : signature.c
172 Headers/cgrammar2.h : cgrammar.c
173 Headers/cgrammar_tokens.h : cgrammar.c
174 Headers/llgrammar_gen.h: llgrammar.c
175 Headers/llgrammar.h : llgrammar.c
176 Headers/mtgrammar_tokens.h : mtgrammar.c
177
178 Headers/flag_codes.gen : flags.def
179         grep "FLG_" flags.def > Headers/flag_codes.gen
180
181 ###
182 ### defaults
183 ###
184
185 ### Flags for checking a single file
186 SINGLEFLAGS = -f lclint.lclintrc -supcounts +partial -unrecogcomments
187
188 LCLINT29 = ${HOME}/lclint-2.9c/src/lclint 
189
190 .c.check: lclint.lcd lclint
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
193
194 lcllib.c: Headers/llgrammar.h Headers/llgrammar_gen.h
195 clabstract.c: Headers/cgrammar_tokens.h 
196 scan.c: Headers/signature2.h  Headers/signature_gen.h
197 stateClause.c: Headers/cgrammar_tokens.h 
198
199
200 .c.o:
201 ifeq ($(CHECK), 1)
202         ${MAKE} $*.check
203 endif
204         $(CC) $(CPPFLAGS) $(CFLAGS) -c $*.c
205
206 ### removed this: / compiled: '`$(OFILES)`'  (of 181 files)'
207 ### Apparently it is slow on some platforms...
208
209
210 ###
211 ### alternatives (tests, releases, backups, etc.)
212 ###
213
214 ### -e option makes environment variables take precedence
215
216 .PHONY : test quicktest opt up backup
217
218 backup:
219         tar zcvf ../lclint-`date +%Y-%d-%m-%H-%M`.tgz ${ALLSRC} ${GRAMS} Headers/*.h *.i flags.def
220
221
222 #drl 09-25-001 fixed so that betarelease nolonger assumes
223 #the source is in ~/LCLintDev/src
224
225 SRCPWD = ~/LCLintDev/src
226
227 betarelease:
228         echo ${SRCPWD}
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/
232         cp cscanner.c ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/cscanner.c.der
233         cp DATE lastversion maketags ~/temp/lclint-`cat ${VERSION_NUMBER}`/src/
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
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
242         cp -r ../os2 ~/temp/lclint-`cat ${VERSION_NUMBER}`/os2
243         cp -r ../test ~/temp/lclint-`cat ${VERSION_NUMBER}`/test
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
247         cd ~/temp/lclint-`cat ${VERSION_NUMBER}`; rm -f *~ */*~ */*/*~ #* */#* */*/#* .#* */.#* */*/.#* */*.core
248         cd ~/temp/lclint-`cat ${VERSION_NUMBER}`; rm -rf CVS */CVS */*/CVS */*/*/CVS */*/*/*/CVS
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
252         @echo "Made release lclint-`cat ${VERSION_NUMBER}`"
253
254 opt :
255 ifneq (,$(findstring csh, $(SHELL)))
256         setenv CC '$(CCOPT)' ; $(MAKE) -e lclint
257 else
258         CC="$(CCOPT)" ; export CC ; $(MAKE) -e lclint
259 endif
260
261 updateversion:
262         -@$(MV) Headers/herald.h Headers/herald.last
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
273 localconstants:
274         @-$(MV) Headers/local_constants.h Headers/local_constants.last
275         @echo '/* local_constants.h - created automatically by gmake localconstants */' \
276                 > Headers/local_constants.h
277 ifndef SYSTEM_LIBDIR
278         @echo '*** Fatal Error: SYSTEM_LIBDIR not defined.'
279 else
280         @echo '/*@constant observer char *SYSTEM_LIBDIR;@*/' >> Headers/local_constants.h
281         @echo '# define SYSTEM_LIBDIR $(SYSTEM_LIBDIR)' >> Headers/local_constants.h
282 ifndef DEFAULT_LARCHPATH
283         @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
284 else
285         @echo '/*@constant observer char *DEFAULT_LARCHPATH;@*/' >> Headers/local_constants.h
286         @echo '# define DEFAULT_LARCHPATH $(DEFAULT_LARCHPATH)' >> Headers/local_constants.h
287 ifndef DEFAULT_LCLIMPORTDIR
288         @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
289 else
290         @echo '/*@constant observer char *DEFAULT_LCLIMPORTDIR;@*/' >> Headers/local_constants.h
291         @echo '# define DEFAULT_LCLIMPORTDIR $(DEFAULT_LCLIMPORTDIR)' >> Headers/local_constants.h
292 endif
293 endif
294 endif
295
296 dorelease: 
297         @echo '// '
298         @echo '//  Making LCLint'
299         @echo '//  Version '`cat $(VERSION_NUMBER)`
300         @echo '// '
301         @echo '//  Compiler: '$(CCOPT)
302 ifdef BISON
303         @echo '//  Bison: '$(BISON)
304 else
305         @echo '//  Use derived bison files'
306 endif
307 ifdef FLEX
308         @echo '//  Flex: '$(FLEX)
309 else
310         @echo '//  Use derived flex files'
311 endif
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'
323         @$(MAKE) -e localconstants
324         @echo '//  Updating flags'
325         @$(MAKE) -e Headers/flag_codes.gen
326         @echo '// '
327         @echo '//  Compiling:'
328         @echo '// '
329         @$(MAKE) -e opt
330         @echo '//  Done Release'        
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
343 pristine: clean
344         -$(RM) -f *.lcs *.lslo
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*
351
352 clean: 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
358 tidy:
359         -$(RM) ,* .,* *.CKP *.BAK .emacs_[0-9]* core a.out *.*~
360
361 up: 
362         -$(RM) cgrammar.c llgrammar.c signature.c cscanner.c mtgrammar.c *.tab.[c,h]
363         -$(RM) *.o
364
365 ###
366 ### dependancies
367 ###
368
369 depend:
370         $(MAKEDEPEND) $(CINCLUDES) $(CPPFLAGS) -f Makefile.depend $(SRC) $(GRAMS)
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
390 flags: flags.def
391         grep "FLG_" flags.def > Headers/flag_codes.gen
392         touch flags.c
393
394 ###
395 ### other flags are in .lclintrc file
396 ### 
397
398 tags:
399         etags ${ALLSRC} ${GRAMS} Headers/*.h *.i
400
401 lintweak: 
402         ${HOME}/lclint-build/lclint-2.5q-freebsdbin/lclint -f weak.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC)
403
404 lintnew: 
405         ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw
406
407 lintfcn: 
408         ${LCLINT} -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw +arraybounds  +arrayboundsread
409
410 linttest: 
411         ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude cpphash.c +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw +partial
412
413 lint: 
414         ../bin/lclint -f lclint.lclintrc llmain.c $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -supcounts -fcnuse -exportlocal -unrecogcomments -constuse  -mts file
415
416 # -mts file
417
418 lintabstract: 
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
423 lintnodestroy: 
424         lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal -unrecogcomments -fcnuse -constuse -exportlocal -supcounts -compdestroy
425
426 linttest1g: 
427         lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude test.c -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts +partial
428
429 lint26: 
430         ${HOME}/lclint-2.6b/bin/lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts
431
432 lint28: 
433         ${HOME}/lclint-2.8a/bin/lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts
434
435 lint29: 
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
437
438 lintm: 
439         lclint-2.5m -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint
440
441 test:
442         cp lclint ../bin/lclint
443         cd ../test ; ${MAKE} test
444
445 libs:
446         cd ../lib ; ${MAKE} 
447
448 myall:
449         -$(RM) -f ../bin/lclint; \
450         ${MAKE} -C ..
451
452 ctype.o: ctbase.i cttable.i
453 #exprNode.o: exprData.i
454
455 ctype.c: ctbase.i cttable.i
456
457 tokentable.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.060296 seconds and 3 git commands to generate.