2 ### Makefile for building and installing LCLint 2.5
4 ### Updated for LCLint 2.5: 23 May 2000
5 ### Updated for LCLint 2.4: 12 April 1998
6 ### Updated for LCLint 2.2: 25 August 1996
7 ### Updated for LCLint 2.1a: 17 April 1996
8 ### Updated for LCLint 2.0: 24 February 1996
9 ### Updated for LCLint 1.4: 29 January 1995
10 ### Original for LCLint 1.0: 20 February 1994
14 ### This makefile assumes the gnu version of make is available.
16 ### Run: make to build LCLint.
17 ### make install to install.
20 ### These constants will be compiled into the lclint binary.
22 ### They may be overridden by environment variables, but these
23 ### constants set the default values when no environment variables
27 ### Command to run C preprocessor:
29 DEFAULT_CPPCMD = @CPP@
31 ### Directory containing system include files:
33 SYSTEM_LIBDIR = "/usr/include"
36 ### Select installation directories:
38 ### The LIBDIR and IMPORTSDIR are compiled into the binary to
39 ### select the default LARCH_PATH and LCLIMPORTDIR, which can
40 ### also be overridden by environment variables.
43 ### directory for lclint libraries
44 LIBDIR = @installdir@/lib
46 ### directory for lclint standard imports
47 IMPORTSDIR = @installdir@/imports
49 ### directory for lclint binary
50 INSTALLDIR = @installdir@/bin
52 ### this should be the complete path for the directory where this
53 ### Makefile is, with no trailing / or spaces.
62 ### I recommend doing this in an emacs shell (or buffered terminal) so
63 ### you can scroll through the output.
65 ### This should (hopefully) work on most systems without further changes.
67 ### If you do not have gcc, set CC = cc (or some other compiler)
68 ### later in this file.
72 ### o put lclint in BASEDIR/bin/lclint
74 ### If you have installed the test suite, then do:
82 ### shell --- should work with /bin/sh or similar shells too.
88 ### If you wish to install lclint in some other directory, set these
94 ### installation command
98 ### this works with nfs, change to whatever is needed to make
99 ### a file executable on your system
104 ### end of installation variables
108 ### compiler --- gcc is recommended, but lclint has been compiled
109 ### without changes using cc on several platforms.
115 ### optimizing compiler --- add optimization flags here
121 ### link flags --- this links the lex or flex library
124 LINKFLAGS = @LINKLEX@
127 ### do you have bison and/or flex?
128 ### (Note: yacc will probably not work; lex might work but is not recommended.)
135 ### is the test suite available? (must be full path here)
138 TESTDIR = $(BASEDIR)/test
141 ### if this Makefile is used with one of the
142 ### standard installation packages, no changes should be
143 ### necessary below this line.
146 .PHONY: install dobinaries dolibraries doimports test
149 ### set this to a different directory
150 ### to install binaries elsewhere
153 RELEASEDIR = $(BASEDIR)/bin
159 @echo 'Building lclint from source'
160 ifeq ($(SHELL), /bin/csh)
161 cd src ; setenv CC '$(CC)' ; setenv CCOPT '$(CCOPT)'; \
162 setenv BISON '$(BISON)' ; setenv FLEX '$(FLEX)' ; \
163 setenv DEFAULT_CPPCMD '"$(DEFAULT_CPPCMD)"' ; \
164 setenv SYSTEM_LIBDIR '$(SYSTEM_LIBDIR)' ; \
165 setenv LINKFLAGS '$(LINKFLAGS)' ; \
166 setenv DEFAULT_LARCHPATH '".:$(LIBDIR)"' ; \
167 setenv DEFAULT_LCLIMPORTDIR '"$(IMPORTSDIR)"' ; \
170 cd src ; CC='$(CC)'; export CC; CCOPT='$(CCOPT)'; \
171 BISON='$(BISON)' ; export BISON; FLEX='$(FLEX)'; export FLEX; \
172 DEFAULT_CPPCMD='$(DEFAULT_CPPCMD)' ; export DEFAULT_CPPCMD ;\
173 SYSTEM_LIBDIR='$(SYSTEM_LIBDIR)' ; export SYSTEM_LIBDIR ;\
174 DEFAULT_LARCHPATH='".:$(LIBDIR)/"' ; export DEFAULT_LARCHPATH ;\
175 LINKFLAGS='$(LINKFLAGS)'; export LINK_FLAGS; \
176 DEFAULT_LCLIMPORTDIR='"$(IMPORTSDIR)"' ; export DEFAULT_LCLIMPORTDIR ;\
180 @echo '// Run: '$(MAKE)' test to check'
182 mv src/lclint bin/lclint
185 ifeq ($(SHELL), /bin/csh)
186 cd $(TESTDIR) ; setenv LCLINT $(RELEASEDIR)/lclint ; $(MAKE) -e
188 cd $(TESTDIR) ; LCLINT=$(RELEASEDIR)/lclint ; export LCLINT ; $(MAKE) -e
192 cd src; $(MAKE) clean
196 ### locations of standard LCLint files
198 ### this should NOT have to be edited if you use the standard
199 ### installation package
203 LCLINTBINDIR = $(BASEDIR)/bin
206 LCLINTLIB = $(BASEDIR)/lib
207 LCLINTIMPORTS = $(BASEDIR)/imports
210 ### uses recursive make calls directly, so installation
211 ### will continue even if there are errors!
216 @echo '// Doing lclint installation'
221 -@$(MAKE) dolibraries
225 @echo '// Installation complete.'
228 @echo '// Installing binaries in '$(INSTALLDIR)
229 cd $(LCLINTBINDIR); $(INSTALL) $(INSTALLFLAGS) lclint $(INSTALLDIR)
230 @echo '// Installed: lclint in '$(INSTALLDIR)
233 @echo '// Installing libraries in '$(LIBDIR)
234 @echo " (This will complain if the directory already exists, don't worry about it.)"
236 $(CP) $(LCLINTLIB)/* $(LIBDIR)
237 @echo '// Installed libraries.'
240 @echo '// Installing imports in '$(IMPORTSDIR)
241 @echo " (This will complain if the directory already exists, don't worry about it.)"
243 $(CP) $(LCLINTIMPORTS)/* $(IMPORTSDIR)
244 @echo '// Installed imports.'