]> 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 = 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 = 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 mtgrammar.o : mtgrammar.c
162         $(CC) $(CPPFLAGS) -c $*.c
163
164 llgrammar.o : llgrammar.c
165         $(CC) $(CPPFLAGS) -c $*.c
166
167
168 ###
169 ### header files dependant on grammars
170 ###
171
172 Headers/signature2.h : signature.c
173 Headers/signature_gen.h : signature.c
174 Headers/cgrammar2.h : cgrammar.c
175 Headers/cgrammar_tokens.h : cgrammar.c
176 Headers/llgrammar.h : llgrammar.c
177 Headers/mtgrammar_tokens.h : mtgrammar.c
178
179 Headers/flag_codes.gen : flags.def
180         grep "FLG_" flags.def > Headers/flag_codes.gen
181
182 ###
183 ### defaults
184 ###
185
186 ### Flags for checking a single file
187 SINGLEFLAGS = -f lclint.lclintrc -supcounts +partial -unrecogcomments
188
189 LCLINT29 = ${HOME}/lclint-2.9c/src/lclint 
190
191 .c.check: lclint.lcd lclint
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
194
195 lcllib.c: Headers/llgrammar.h
196 clabstract.c: Headers/cgrammar_tokens.h 
197 scan.c: Headers/signature2.h  Headers/signature_gen.h
198 stateClause.c: Headers/cgrammar_tokens.h 
199
200
201 .c.o:
202 ifeq ($(CHECK), 1)
203         ${MAKE} $*.check
204 endif
205         @echo '//  Compiling '$*.c' / compiled: '`$(OFILES)`'  (of 161 files)'
206         $(CC) $(CFLAGS) -c $*.c
207
208 ###
209 ### alternatives (tests, releases, backups, etc.)
210 ###
211
212 ### -e option makes environment variables take precedence
213
214 .PHONY : test quicktest opt up backup
215
216 backup:
217         tar zcvf ../lclint-`date +%Y-%d-%m-%H-%M`.tgz ${ALLSRC} ${GRAMS} Headers/*.h *.i flags.def
218
219 betarelease:
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}`/
228         cd ~/temp/lclint-`cat ${VERSION_NUMBER}`; rm */*.core ; tar zcvf ~/public_html/lclint/lclint-`cat ~/LCLintDev/src/${VERSION_NUMBER}`-beta.tgz *
229         chmod 644 ~/public_html/lclint/lclint-`cat ${VERSION_NUMBER}`.tgz
230         @echo "Make release lclint-`cat ${VERSION_NUMBER}`
231
232 opt :
233 ifneq (,$(findstring csh, $(SHELL)))
234         setenv CC '$(CCOPT)' ; $(MAKE) -e lclint
235 else
236         CC="$(CCOPT)" ; export CC ; $(MAKE) -e lclint
237 endif
238
239 updateversion:
240         -@$(MV) Headers/herald.h Headers/herald.last
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
251 localconstants:
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
255 ifndef SYSTEM_LIBDIR
256         @echo '*** Fatal Error: SYSTEM_LIBDIR not defined.'
257 else
258         @echo '/*@constant observer char *SYSTEM_LIBDIR;@*/' >> Headers/local_constants.h
259         @echo '# define SYSTEM_LIBDIR $(SYSTEM_LIBDIR)' >> Headers/local_constants.h
260 ifndef DEFAULT_LARCHPATH
261         @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
262 else
263         @echo '/*@constant observer char *DEFAULT_LARCHPATH;@*/' >> Headers/local_constants.h
264         @echo '# define DEFAULT_LARCHPATH $(DEFAULT_LARCHPATH)' >> Headers/local_constants.h
265 ifndef DEFAULT_LCLIMPORTDIR
266         @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
267 else
268         @echo '/*@constant observer char *DEFAULT_LCLIMPORTDIR;@*/' >> Headers/local_constants.h
269         @echo '# define DEFAULT_LCLIMPORTDIR $(DEFAULT_LCLIMPORTDIR)' >> Headers/local_constants.h
270 endif
271 endif
272 endif
273
274 dorelease: 
275         @echo '// '
276         @echo '//  Making LCLint'
277         @echo '//  Version '`cat $(VERSION_NUMBER)`
278         @echo '// '
279         @echo '//  Compiler: '$(CCOPT)
280 ifdef BISON
281         @echo '//  Bison: '$(BISON)
282 else
283         @echo '//  Use derived bison files'
284 endif
285 ifdef FLEX
286         @echo '//  Flex: '$(FLEX)
287 else
288         @echo '//  Use derived flex files'
289 endif
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'
301         @$(MAKE) -e localconstants
302         @echo '//  Updating flags'
303         @$(MAKE) -e Headers/flag_codes.gen
304         @echo '// '
305         @echo '//  Compiling:'
306         @echo '// '
307         @$(MAKE) -e opt
308         @echo '//  Done Release'        
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
321 pristine: clean
322         -$(RM) -f *.lcs *.lslo
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*
329
330 clean: 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
336 tidy:
337         -$(RM) ,* .,* *.CKP *.BAK .emacs_[0-9]* core a.out *.*~
338
339 up: 
340         -$(RM) cgrammar.c llgrammar.c signature.c cscanner.c mtgrammar.c *.tab.[c,h]
341         -$(RM) *.o
342
343 ###
344 ### dependancies
345 ###
346
347 depend:
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
368 flags: flags.def
369         grep "FLG_" flags.def > Headers/flag_codes.gen
370         touch flags.c
371
372 ###
373 ### other flags are in .lclintrc file
374 ### 
375
376 tags:
377         etags ${ALLSRC} ${GRAMS} Headers/*.h *.i
378
379 lintweak: 
380         ${HOME}/lclint-build/lclint-2.5q-freebsdbin/lclint -f weak.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC)
381
382 lintnew: 
383         ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw
384
385 lintfcn: 
386         ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw +fcnconstraint
387
388 linttest: 
389         ${LCLINTNEW} -f lclint.lclintrc $(CPPFLAGS) +singleinclude cpphash.c +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw +partial
390
391 lint: 
392         ../bin/lclint -f lclint.lclintrc llmain.c $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -supcounts -fcnuse -exportlocal -unrecogcomments -constuse  -mts file
393
394 # -mts file
395
396 lintabstract: 
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
401 lintnodestroy: 
402         lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal -unrecogcomments -fcnuse -constuse -exportlocal -supcounts -compdestroy
403
404 linttest1g: 
405         lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude test.c -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts +partial
406
407 lint26: 
408         ${HOME}/lclint-2.6b/bin/lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts
409
410 lint28: 
411         ${HOME}/lclint-2.8a/bin/lclint -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -constuse -exportlocal -supcounts
412
413 lint29: 
414         ${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
415
416 lintm: 
417         lclint-2.5m -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint
418
419 test:
420         cp lclint ../bin/lclint
421         cd ../test ; ${MAKE} test
422
423 libs:
424         cd ../lib ; ${MAKE} 
425
426 myall:
427         -$(RM) -f ../bin/lclint; \
428         ${MAKE} -C ..
429
430 ctype.o: ctbase.i cttable.i
431 #exprNode.o: exprData.i
432
433 ctype.c: ctbase.i cttable.i
434
435 tokentable.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.547133 seconds and 5 git commands to generate.