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