1 ##################################################
3 ### Makefile for LCLint
5 ### designed for use with gmake (GNU make)
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
13 ### This file should not need to be edited.
15 ### Compilers and tools set using the top-level Makefile override settings
16 ### in this file when make is run from the top directory.
21 ### builds a release version of lclint from scratch using optimizations
24 ### builds a local version of lclint (no optimizations)
25 ### (does not remake files)
28 ### runs the test suite
29 ### (must have installed test suite from lclint.test.tar.Z)
32 .SUFFIXES : .h .c .o .l .check
33 .PHONY : all dorerelease retest rerelease homeversion
34 .IGNORE : dorerelease retest rerelease
37 ### system information (compilers, flags, directories, etc.)
43 ### check files before compiling
44 ### (can't be 1 unless you have lclint already!)
47 CHECK = 0 ### set to 1
53 include Makefile.sources
67 $(CC) -o lclint $(OBJ) $(LINKFLAGS)
74 ### -p xx flag to bison renames yyparse ==> xxparse, xxlex ==> xxlex
75 ### this is probably NOT compatible with yacc.
78 signature.c : signature.c.der signature.y
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
85 $(CP) signature.c.der signature.c
88 cgrammar.c : cgrammar.c.der cgrammar.y
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
97 $(CP) cgrammar.c.der cgrammar.c
100 ### llgrammar2.h is necessary so +singleinclude may be used
102 llgrammar.c : llgrammar.c.der llgrammar.y
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
112 $(CP) llgrammar.c.der llgrammar.c
115 cscanner.c : cscanner.c.der cscanner.l
117 $(FLEX) $(LFLAGS) cscanner.l
118 $(CAT) flex.head lex.yy.c > cscanner.c
120 $(CP) cscanner.c.der cscanner.c
124 ### compile without warnings
127 signature.o : signature.c
128 $(CC) $(CPPFLAGS) -c $*.c
130 cgrammar.o : cgrammar.c
131 $(CC) $(CPPFLAGS) -c $*.c
133 llgrammar.o : llgrammar.c
134 $(CC) $(CPPFLAGS) -c $*.c
136 cscanner.o : cscanner.c
137 $(CC) $(CPPFLAGS) -c $*.c
140 ### header files dependant on grammars
143 Headers/signature2.h : signature.c
144 Headers/cgrammar2.h : cgrammar.c
145 Headers/llgrammar.h : llgrammar.c
151 ### Flags for checking a single file
152 SINGLEFLAGS = +neverinclude -supcounts +partial -showsummary -load lclint.lcd
154 .c.check: lclint.lcd lclint
155 $(LCLINT) $(LINTFLAGS) $(SINGLEFLAGS) $*.c
159 $(LCLINT) $(LINTFLAGS) $(SINGLEFLAGS) $*.c
161 @echo '// Compiling '$*.c' / compiled: '`$(OFILES)`' (of 120 files)'
162 @$(CC) $(CFLAGS) -c $*.c
165 ### alternatives (tests, releases, backups, etc.)
168 ### -e option makes environment variables take precedence
170 .PHONY : test quicktest opt up
173 ifneq (,$(findstring csh, $(SHELL)))
174 setenv CC '$(CCOPT)' ; $(MAKE) -e lclint
176 CC="$(CCOPT)" ; export CC ; $(MAKE) -e lclint
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`'"' \
185 @echo '/*@constant observer char *LCL_PARSE_VERSION;@*/' >> Headers/herald.h
186 @echo '# define LCL_PARSE_VERSION "LCLint '`cat $(VERSION_NUMBER)`'"' \
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
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
196 @echo '*** Fatal Error: SYSTEM_LIBDIR not defined.'
198 @echo '/*@constant observer char *SYSTEM_LIBDIR;@*/' >> Headers/local_constants.h
199 @echo '# define SYSTEM_LIBDIR $(SYSTEM_LIBDIR)' >> Headers/local_constants.h
200 ifndef DEFAULT_LARCHPATH
201 @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
203 @echo '/*@constant observer char *DEFAULT_LARCHPATH;@*/' >> Headers/local_constants.h
204 @echo '# define DEFAULT_LARCHPATH $(DEFAULT_LARCHPATH)' >> Headers/local_constants.h
205 ifndef DEFAULT_LCLIMPORTDIR
206 @echo '*** Fatal Error: DEFAULT_LARCHPATH not defined.'
208 @echo '/*@constant observer char *DEFAULT_LCLIMPORTDIR;@*/' >> Headers/local_constants.h
209 @echo '# define DEFAULT_LCLIMPORTDIR $(DEFAULT_LCLIMPORTDIR)' >> Headers/local_constants.h
216 @echo '// Making LCLint'
217 @echo '// Version '`cat $(VERSION_NUMBER)`
219 @echo '// Compiler: '$(CCOPT)
221 @echo '// Bison: '$(BISON)
223 @echo '// Use derived bison files'
226 @echo '// Flex: '$(FLEX)
228 @echo '// Use derived flex files'
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)
235 @echo '// Updating version information'
236 @$(MAKE) -e updateversion
237 @echo '// Updating local constants'
238 ### @$(MAKE) -e localconstants
240 @echo '// Compiling:'
243 @echo '// Done Release '`cat $(VERSION_NUMBER)`
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
255 .PHONY .IGNORE : up tidy clean pristine
258 -$(RM) -f *.lcs *.lslo
262 -$(RM) *.out *.output *.bib *.dvi *.idx *.log *.o *.toc
263 -$(RM) cgrammar.c cscanner.c
264 -$(RM) test* Headers/*~ Headers/#*
267 -$(RM) ,* .,* *.CKP *.BAK .emacs_[0-9]* core a.out *.*~
270 -$(RM) cgrammar.c llgrammar.c signature.c cscanner.c
278 $(MAKEDEPEND) $(CINCLUDES) $(CFLAGS) -f Makefile.depend $(SRC) $(GRAMS)
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.
286 ### include Makefile.depend
293 ### A library is used for the specifications
296 $(CHECKS): lclint.lcd
299 ### other flags are in .lclintrc file
303 $(LCLINT) -f lclint.lclintrc $(CPPFLAGS) +singleinclude $(ALLSRC) -dump lclint