]>
Commit | Line | Data |
---|---|---|
885824d3 | 1 | ### |
2 | ### Makefile for building and installing LCLint 2.5 | |
3 | ### | |
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 | |
11 | ### | |
12 | ||
13 | ### | |
14 | ### This makefile assumes the gnu version of make is available. | |
15 | ### | |
16 | ### Run: make to build LCLint. | |
17 | ### make install to install. | |
18 | ### | |
19 | ### | |
20 | ### These constants will be compiled into the lclint binary. | |
21 | ### | |
22 | ### They may be overridden by environment variables, but these | |
23 | ### constants set the default values when no environment variables | |
24 | ### are set. | |
25 | ### | |
26 | ||
27 | ### Command to run C preprocessor: | |
28 | ||
29 | DEFAULT_CPPCMD = @CPP@ | |
30 | ||
31 | ### Directory containing system include files: | |
32 | ||
33 | SYSTEM_LIBDIR = "/usr/include" | |
34 | ||
35 | ### | |
36 | ### Select installation directories: | |
37 | ### | |
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. | |
41 | ### | |
42 | ||
43 | ### directory for lclint libraries | |
44 | LIBDIR = @installdir@/lib | |
45 | ||
46 | ### directory for lclint standard imports | |
47 | IMPORTSDIR = @installdir@/imports | |
48 | ||
49 | ### directory for lclint binary | |
50 | INSTALLDIR = @installdir@/bin | |
51 | ||
52 | ### this should be the complete path for the directory where this | |
53 | ### Makefile is, with no trailing / or spaces. | |
54 | ||
55 | BASEDIR = @cwdir@ | |
56 | ||
57 | ### | |
58 | ### Then, run: | |
59 | ### | |
60 | ### make | |
61 | ### | |
62 | ### I recommend doing this in an emacs shell (or buffered terminal) so | |
63 | ### you can scroll through the output. | |
64 | ### | |
65 | ### This should (hopefully) work on most systems without further changes. | |
66 | ### | |
67 | ### If you do not have gcc, set CC = cc (or some other compiler) | |
68 | ### later in this file. | |
69 | ### | |
70 | ### It should: | |
71 | ### o build lclint | |
72 | ### o put lclint in BASEDIR/bin/lclint | |
73 | ### | |
74 | ### If you have installed the test suite, then do: | |
75 | ### | |
76 | ### make test | |
77 | ### | |
78 | ### to verify lclint. | |
79 | ### | |
80 | ||
81 | ### | |
82 | ### shell --- should work with /bin/sh or similar shells too. | |
83 | ### | |
84 | ||
85 | SHELL = /bin/csh | |
86 | ||
87 | ### | |
88 | ### If you wish to install lclint in some other directory, set these | |
89 | ### variables, and do | |
90 | ### | |
91 | ### make install | |
92 | ### | |
93 | ||
94 | ### installation command | |
95 | INSTALL = @INSTALL@ | |
96 | INSTALLFLAGS = | |
97 | ||
98 | ### this works with nfs, change to whatever is needed to make | |
99 | ### a file executable on your system | |
100 | ||
101 | MAKEEXE = chmod 755 | |
102 | ||
103 | ### | |
104 | ### end of installation variables | |
105 | ### | |
106 | ||
107 | ### | |
108 | ### compiler --- gcc is recommended, but lclint has been compiled | |
109 | ### without changes using cc on several platforms. | |
110 | ### | |
111 | ||
112 | CC = @CC@ @DEFS@ | |
113 | ||
114 | ### | |
115 | ### optimizing compiler --- add optimization flags here | |
116 | ### | |
117 | ||
118 | CCOPT = $(CC) @OPT@ | |
119 | ||
120 | ### | |
121 | ### link flags --- this links the lex or flex library | |
122 | ### | |
123 | ||
124 | LINKFLAGS = @LINKLEX@ | |
125 | ||
126 | ### | |
127 | ### do you have bison and/or flex? | |
128 | ### (Note: yacc will probably not work; lex might work but is not recommended.) | |
129 | ### | |
130 | ||
131 | BISON = @BISON@ | |
132 | FLEX = @FLEX@ | |
133 | ||
134 | ### | |
135 | ### is the test suite available? (must be full path here) | |
136 | ### | |
137 | ||
138 | TESTDIR = $(BASEDIR)/test | |
139 | ||
140 | ### | |
141 | ### if this Makefile is used with one of the | |
142 | ### standard installation packages, no changes should be | |
143 | ### necessary below this line. | |
144 | ### | |
145 | ||
146 | .PHONY: install dobinaries dolibraries doimports test | |
147 | ||
148 | ### | |
149 | ### set this to a different directory | |
150 | ### to install binaries elsewhere | |
151 | ### | |
152 | ||
153 | RELEASEDIR = $(BASEDIR)/bin | |
154 | ||
155 | all: bin/lclint | |
156 | lclint: bin/lclint | |
157 | ||
158 | bin/lclint: | |
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)"' ; \ | |
168 | $(MAKE) -e | |
169 | else | |
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 ;\ | |
177 | $(MAKE) -e | |
178 | endif | |
179 | @echo '// ' | |
180 | @echo '// Run: '$(MAKE)' test to check' | |
181 | @echo '// ' | |
182 | mv src/lclint bin/lclint | |
183 | ||
184 | test: | |
185 | ifeq ($(SHELL), /bin/csh) | |
186 | cd $(TESTDIR) ; setenv LCLINT $(RELEASEDIR)/lclint ; $(MAKE) -e | |
187 | else | |
188 | cd $(TESTDIR) ; LCLINT=$(RELEASEDIR)/lclint ; export LCLINT ; $(MAKE) -e | |
189 | endif | |
190 | ||
191 | clean: | |
192 | cd src; $(MAKE) clean | |
193 | rm bin/lclint | |
194 | ||
195 | ### | |
196 | ### locations of standard LCLint files | |
197 | ### | |
198 | ### this should NOT have to be edited if you use the standard | |
199 | ### installation package | |
200 | ||
201 | CP = cp | |
202 | ||
203 | LCLINTBINDIR = $(BASEDIR)/bin | |
204 | LCLINTBIN = lclint | |
205 | ||
206 | LCLINTLIB = $(BASEDIR)/lib | |
207 | LCLINTIMPORTS = $(BASEDIR)/imports | |
208 | ||
209 | ### | |
210 | ### uses recursive make calls directly, so installation | |
211 | ### will continue even if there are errors! | |
212 | ### | |
213 | ||
214 | install: | |
215 | @echo '// ' | |
216 | @echo '// Doing lclint installation' | |
217 | @echo '// ' | |
218 | @echo ' ' | |
219 | -@$(MAKE) dobinaries | |
220 | @echo ' ' | |
221 | -@$(MAKE) dolibraries | |
222 | @echo ' ' | |
223 | -@$(MAKE) doimports | |
224 | @echo ' ' | |
225 | @echo '// Installation complete.' | |
226 | ||
227 | dobinaries: | |
228 | @echo '// Installing binaries in '$(INSTALLDIR) | |
229 | cd $(LCLINTBINDIR); $(INSTALL) $(INSTALLFLAGS) lclint $(INSTALLDIR) | |
230 | @echo '// Installed: lclint in '$(INSTALLDIR) | |
231 | ||
232 | dolibraries: | |
233 | @echo '// Installing libraries in '$(LIBDIR) | |
234 | @echo " (This will complain if the directory already exists, don't worry about it.)" | |
235 | -mkdir $(LIBDIR) | |
236 | $(CP) $(LCLINTLIB)/* $(LIBDIR) | |
237 | @echo '// Installed libraries.' | |
238 | ||
239 | doimports: | |
240 | @echo '// Installing imports in '$(IMPORTSDIR) | |
241 | @echo " (This will complain if the directory already exists, don't worry about it.)" | |
242 | -mkdir $(IMPORTSDIR) | |
243 | $(CP) $(LCLINTIMPORTS)/* $(IMPORTSDIR) | |
244 | @echo '// Installed imports.' | |
245 | ||
246 | ||
247 | ||
248 | ||
249 | ||
250 | ||
251 | ||
252 | ||
253 | ||
254 | ||
255 | ||
256 |