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