]> andersk Git - splint.git/blob - src/Makefile
c01a3325af05cf4c6f571bab2f07ed5ddecfdab2
[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
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
51 ###
52 ### source files
53 ###
54
55 include Makefile.sources
56
57 ###
58 ### top level
59 ### 
60
61 all : dorelease
62
63 quick: lclint
64
65 lclint : $(OBJ) 
66         @echo '// '
67         @echo '//  Linking:'
68         @echo '// '
69         $(CC) -o lclint $(OBJ) $(LINKFLAGS)
70
71 object: $(OBJ)
72
73 mylint:
74         CC="$(LCLINT)" ; export CC ; $(MAKE) -e object
75 ###
76 ### grammars
77 ###
78
79 ###
80 ### -p xx flag to bison renames yyparse ==> xxparse, xxlex ==> xxlex
81 ### this is probably NOT compatible with yacc.
82 ###
83
84 signature.c : signature.c.der signature.y
85 ifdef BISON
86         @$(BISON) $(YFLAGS) -p lsl signature.y
87         @$(CAT) bison.head signature.tab.c > signature.c
88         @$(MV) Headers/signature_gen.h Headers/signature_gen.bak
89         @$(CAT) bison.head signature.tab.h > Headers/signature_gen.h
90 else
91         $(CP) signature.c.der signature.c
92 endif
93
94 cgrammar.c : cgrammar.c.der cgrammar.y
95 ifdef BISON
96         $(BISON) $(YFLAGS) cgrammar.y
97         @echo '//           Expect 119 shift/reduce conflicts and 114 reduce/reduce conflicts.'
98         @echo '//           (see cgrammar.y for explanation)'
99         @$(CAT) bison.head cgrammar.tab.c > cgrammar.c
100         @$(MV) Headers/cgrammar_tokens.h Headers/cgrammar_tokens.bak
101         @$(CAT) bison.head cgrammar.tab.h > Headers/cgrammar_tokens.h
102 else
103         $(CP) cgrammar.c.der cgrammar.c
104 endif
105
106 ### llgrammar2.h is necessary so +singleinclude may be used
107
108 llgrammar.c  : llgrammar.c.der llgrammar.y
109 ifdef BISON
110         $(BISON) $(YFLAGS) -p yl llgrammar.y
111         @echo '//            Expect 2 shift/reduce conflicts.'
112         @$(CAT) bison.head llgrammar.tab.c > llgrammar.c
113         @$(MV) Headers/llgrammar_gen2.h Headers/llgrammar_gen2.bak
114         @$(CAT) bison.head llgrammar.tab.h > Headers/llgrammar_gen2.h
115         @$(MV) Headers/llgrammar_gen.h Headers/llgrammar_gen.bak
116         @$(CAT) bison.head llgrammar.tab.h > Headers/llgrammar_gen.h
117 else
118         $(CP) llgrammar.c.der llgrammar.c
119 endif
120
121 cscanner.c : cscanner.c.der cscanner.l
122 ifdef FLEX                              
123         $(FLEX) $(LFLAGS) cscanner.l 
124         $(CAT) flex.head lex.yy.c > cscanner.c
125 else
126         $(CP) cscanner.c.der cscanner.c
127 endif
128
129 ###
130 ### compile without warnings
131 ### 
132
133 signature.o : signature.c
134         $(CC) $(CPPFLAGS) -c $*.c
135
136 cgrammar.o : cgrammar.c
137         $(CC) $(CPPFLAGS) -c $*.c
138
139 llgrammar.o : llgrammar.c
140         $(CC) $(CPPFLAGS) -c $*.c
141
142 cscanner.o : cscanner.c
143         $(CC) $(CPPFLAGS) -c $*.c
144
145 ###
146 ### header files dependant on grammars
147 ###
148
149 Headers/signature2.h : signature.c
150 Headers/cgrammar2.h : cgrammar.c
151 Headers/llgrammar.h : llgrammar.c
152
153 ###
154 ### defaults
155 ###
156
157 ### Flags for checking a single file
158 SINGLEFLAGS = +neverinclude -supcounts +partial -showsummary -load lclint.lcd
159
160 .c.check: lclint.lcd lclint
161         $(LCLINT) $(LINTFLAGS) $(SINGLEFLAGS) $*.c
162
163 .c.o:
164 ifeq ($(CHECK), 1)
165         $(LCLINT) $(LINTFLAGS) $(SINGLEFLAGS) $*.c
166 endif
167         @echo '//  Compiling '$*.c' / compiled: '`$(OFILES)`'  (of 120 files)'
168         @$(CC) $(CFLAGS) -c $*.c
169
170 ###
171 ### alternatives (tests, releases, backups, etc.)
172 ###
173
174 ### -e option makes environment variables take precedence
175
176 .PHONY : test quicktest opt up 
177
178 opt :
179 ifneq (,$(findstring csh, $(SHELL)))
180         setenv CC '$(CCOPT)' ; $(MAKE) -e lclint
181 else
182         CC="$(CCOPT)" ; export CC ; $(MAKE) -e lclint
183 endif
184
185 updateversion:
186         @$(MV) Headers/herald.h Headers/herald.last
187         @echo '/* herald.h - created automatically by gmake updateversion */' > Headers/herald.h
188         @echo '/*@constant observer char *LCL_VERSION;@*/' >> Headers/herald.h
189         @echo '# define LCL_VERSION "LCLint '`cat $(VERSION_NUMBER)`' --- '`cat DATE`'"' \
190               >> Headers/herald.h
191         @echo '/*@constant observer char *LCL_PARSE_VERSION;@*/' >> Headers/herald.h
192         @echo '# define LCL_PARSE_VERSION "LCLint '`cat $(VERSION_NUMBER)`'"' \
193               >> Headers/herald.h
194         @echo '/*@constant observer char *LCL_COMPILE;@*/' >> Headers/herald.h
195         @echo '# define LCL_COMPILE "Compiled using '$(CC)' on '`uname -a`' by '`whoami`'"' >> Headers/herald.h
196
197 localconstants:
198         @$(MV) Headers/local_constants.h Headers/local_constants.last
199         @echo '/* local_constants.h - created automatically by gmake localconstants */' \
200                 > Headers/local_constants.h
201 ifndef SYSTEM_LIBDIR
202         @echo '*** Fatal Error: SYSTEM_LIBDIR not defined.'
203 else
204         @echo '/*@constant observer char *SYSTEM_LIBDIR;@*/' >> Headers/local_constants.h
205         @echo '# define SYSTEM_LIBDIR $(SYSTEM_LIBDIR)' >> Headers/local_constants.h
206 ifndef DEFAULT_LARCHPATH
207         @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
208 else
209         @echo '/*@constant observer char *DEFAULT_LARCHPATH;@*/' >> Headers/local_constants.h
210         @echo '# define DEFAULT_LARCHPATH $(DEFAULT_LARCHPATH)' >> Headers/local_constants.h
211 ifndef DEFAULT_LCLIMPORTDIR
212         @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
213 else
214         @echo '/*@constant observer char *DEFAULT_LCLIMPORTDIR;@*/' >> Headers/local_constants.h
215         @echo '# define DEFAULT_LCLIMPORTDIR $(DEFAULT_LCLIMPORTDIR)' >> Headers/local_constants.h
216 endif
217 endif
218 endif
219
220 dorelease: 
221         @echo '// '
222         @echo '//  Making LCLint'
223         @echo '//  Version '`cat $(VERSION_NUMBER)`
224         @echo '// '
225         @echo '//  Compiler: '$(CCOPT)
226 ifdef BISON
227         @echo '//  Bison: '$(BISON)
228 else
229         @echo '//  Use derived bison files'
230 endif
231 ifdef FLEX
232         @echo '//  Flex: '$(FLEX)
233 else
234         @echo '//  Use derived flex files'
235 endif
236         @echo '//  Default cpp command: '$(DEFAULT_CPPCMD)
237         @echo '//  System include directory: '$(SYSTEM_LIBDIR)
238         @echo '//  Default Larch path: '$(DEFAULT_LARCHPATH)
239         @echo '//  Default imports directory: '$(DEFAULT_LCLIMPORTDIR)
240         @echo '// '
241         @echo 'Making tags'
242         ./maketags
243         @echo '// '
244         @echo '//  Updating version information'
245         @$(MAKE) -e updateversion
246         @echo '//  Updating local constants'
247 ###     @$(MAKE) -e localconstants
248         @echo '// '
249         @echo '//  Compiling:'
250         @echo '// '
251         @$(MAKE) -e opt
252         @echo '//  Done Release '`cat $(VERSION_NUMBER)`
253
254
255 flags: flags.def
256         grep "FLG_" flags.def > Headers/flag_codes.gen
257
258 ###
259 ### cleaning
260 ###
261 ### Standard entries to remove files from the directories
262 ###    up       --- remove .o files and grammar derivatives
263 ###    tidy     --- eliminate unwanted files
264 ###    clean    --- delete derived files, except for spec-derived files
265 ###    pristine --- delete all derived files
266 ###
267
268 .PHONY .IGNORE : up tidy clean pristine
269
270 pristine: clean
271         -$(RM) -f *.lcs *.lslo
272
273 clean: tidy
274         -$(RM) core lclint 
275         -$(RM) *.out *.output *.bib *.dvi *.idx *.log *.o *.toc
276         -$(RM) cgrammar.c cscanner.c
277         -$(RM) test* Headers/*~ Headers/#* 
278
279 tidy:
280         -$(RM) ,* .,* *.CKP *.BAK .emacs_[0-9]* core a.out *.*~
281
282 up: 
283         -$(RM) cgrammar.c llgrammar.c signature.c cscanner.c 
284         -$(RM) *.o
285
286 ###
287 ### dependancies
288 ###
289
290 depend:
291         $(MAKEDEPEND) $(CINCLUDES) $(CFLAGS) -f Makefile.depend $(SRC) $(GRAMS)
292
293 ###
294 ### analysing dependancies takes a long time and doesn't work terribly
295 ### well, so the are NOT included here.  NOTE carefully, this means if a
296 ### header file is changed manual recompilation may be necessary.
297 ###
298
299 ### include Makefile.depend
300
301 ###
302 ### LCLint checking
303 ###
304
305 ### 
306 ### A library is used for the specifications
307 ###
308
309 $(CHECKS): lclint.lcd
310
311 ###
312 ### other flags are in .lclintrc file
313 ### 
314
315 lint: 
316         $(LCLINT) -f lclint.lclintrc $(CPPFLAGS) +forcehints +singleinclude -nestcomments -fcnuse -uniondef -exportlocal -exportheader -abstract -namechecks -protoparammatch -boolops $(ALLSRC) -dump  lclint
317
318
319
320
321
This page took 0.061981 seconds and 3 git commands to generate.