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