]>
Commit | Line | Data |
---|---|---|
567a9e6f RL |
1 | ## |
2 | ## Makefile for OpenSSL | |
3 | ## | |
4 | ## {- join("\n## ", @autowarntext) -} | |
5 | {- | |
9dd4ed28 | 6 | our $makedepprog = platform->makedepprog(); |
834aae2a | 7 | |
567a9e6f | 8 | sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ } |
f5c174ff | 9 | |
cff89b17 AP |
10 | # Shared AIX support is special. We put libcrypto[64].so.ver into |
11 | # libcrypto.a and use libcrypto_a.a as static one. | |
12 | sub sharedaix { !$disabled{shared} && $config{target} =~ /^aix/ } | |
13 | ||
9dd4ed28 | 14 | our $sover_dirname = platform->shlib_version_as_filename(); |
33105818 | 15 | |
27c40a93 BL |
16 | # This makes sure things get built in the order they need |
17 | # to. You're welcome. | |
18 | sub dependmagic { | |
19 | my $target = shift; | |
20 | ||
21 | return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target"; | |
22 | } | |
834aae2a | 23 | ''; |
567a9e6f RL |
24 | -} |
25 | PLATFORM={- $config{target} -} | |
26 | OPTIONS={- $config{options} -} | |
27 | CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) | |
28 | SRCDIR={- $config{sourcedir} -} | |
29 | BLDDIR={- $config{builddir} -} | |
30 | ||
16942e08 | 31 | VERSION={- "$config{full_version}" -} |
567a9e6f RL |
32 | MAJOR={- $config{major} -} |
33 | MINOR={- $config{minor} -} | |
3a63dbef | 34 | SHLIB_VERSION_NUMBER={- $config{shlib_version} -} |
567a9e6f | 35 | SHLIB_TARGET={- $target{shared_target} -} |
9dd4ed28 RL |
36 | |
37 | LIBS={- join(" ", map { platform->staticlib($_) // () } @{$unified_info{libraries}}) -} | |
38 | SHLIBS={- join(" ", map { platform->sharedlib($_) // () } @{$unified_info{libraries}}) -} | |
39 | SHLIB_INFO={- join(" ", map { my $x = platform->sharedlib($_); | |
40 | my $y = platform->sharedlib_simple($_); | |
41 | $x ? "\"$x;$y\"" : () } | |
42 | @{$unified_info{libraries}}) -} | |
1842f369 | 43 | MODULES={- join(" ", map { platform->dso($_) } @{$unified_info{modules}}) -} |
9dd4ed28 | 44 | PROGRAMS={- join(" ", map { platform->bin($_) } @{$unified_info{programs}}) -} |
567a9e6f | 45 | SCRIPTS={- join(" ", @{$unified_info{scripts}}) -} |
29eed3dd | 46 | {- output_off() if $disabled{makedepend}; "" -} |
9dd4ed28 | 47 | DEPS={- join(" ", map { platform->isobj($_) ? platform->dep($_) : () } |
c058fcd7 RL |
48 | grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } |
49 | keys %{$unified_info{sources}}); -} | |
29eed3dd | 50 | {- output_on() if $disabled{makedepend}; "" -} |
8258975c RL |
51 | GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}}) -} |
52 | GENERATED={- # common0.tmpl provides @generated | |
9dd4ed28 RL |
53 | join(" ", map { platform->convertext($_) } @generated ) -} |
54 | ||
ac6bba6f RL |
55 | INSTALL_LIBS={- |
56 | join(" ", map { platform->staticlib($_) // () } | |
57 | grep { !$unified_info{attributes}->{$_}->{noinst} } | |
58 | @{$unified_info{libraries}}) | |
59 | -} | |
60 | INSTALL_SHLIBS={- | |
61 | join(" ", map { platform->sharedlib($_) // () } | |
62 | grep { !$unified_info{attributes}->{$_}->{noinst} } | |
63 | @{$unified_info{libraries}}) | |
64 | -} | |
65 | INSTALL_SHLIB_INFO={- | |
66 | join(" ", map { my $x = platform->sharedlib($_); | |
67 | my $y = platform->sharedlib_simple($_); | |
68 | $x ? "\"$x;$y\"" : () } | |
69 | grep { !$unified_info{attributes}->{$_}->{noinst} } | |
70 | @{$unified_info{libraries}}) | |
71 | -} | |
72 | INSTALL_ENGINES={- | |
73 | join(" ", map { platform->dso($_) } | |
1842f369 RL |
74 | grep { !$unified_info{attributes}->{$_}->{noinst} |
75 | && $unified_info{attributes}->{$_}->{engine} } | |
76 | @{$unified_info{modules}}) | |
ac6bba6f RL |
77 | -} |
78 | INSTALL_PROGRAMS={- | |
79 | join(" ", map { platform->bin($_) } | |
80 | grep { !$unified_info{attributes}->{$_}->{noinst} } | |
81 | @{$unified_info{programs}}) | |
82 | -} | |
994e86a9 RL |
83 | BIN_SCRIPTS={- |
84 | join(" ", map { my $x = $unified_info{attributes}->{$_}->{linkname}; | |
85 | $x ? "$_:$x" : $_ } | |
86 | grep { !$unified_info{attributes}->{$_}->{noinst} | |
87 | && !$unified_info{attributes}->{$_}->{misc} } | |
88 | @{$unified_info{scripts}}) | |
89 | -} | |
90 | MISC_SCRIPTS={- | |
91 | join(" ", map { my $x = $unified_info{attributes}->{$_}->{linkname}; | |
92 | $x ? "$_:$x" : $_ } | |
93 | grep { !$unified_info{attributes}->{$_}->{noinst} | |
94 | && $unified_info{attributes}->{$_}->{misc} } | |
95 | @{$unified_info{scripts}}) | |
96 | -} | |
567a9e6f | 97 | |
6a74806e RL |
98 | APPS_OPENSSL={- use File::Spec::Functions; |
99 | catfile("apps","openssl") -} | |
100 | ||
3c65577f RL |
101 | # DESTDIR is for package builders so that they can configure for, say, |
102 | # /usr/ and yet have everything installed to /tmp/somedir/usr/. | |
567a9e6f | 103 | # Normally it is left empty. |
3c65577f | 104 | DESTDIR= |
567a9e6f RL |
105 | |
106 | # Do not edit these manually. Use Configure with --prefix or --openssldir | |
107 | # to change this! Short explanation in the top comment in Configure | |
108 | INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet | |
109 | # | |
110 | our $prefix = $config{prefix} || "/usr/local"; | |
111 | $prefix -} | |
112 | OPENSSLDIR={- # | |
113 | # The logic here is that if no --openssldir was given, | |
114 | # OPENSSLDIR will get the value from $prefix plus "/ssl". | |
115 | # If --openssldir was given and the value is an absolute | |
116 | # path, OPENSSLDIR will get its value without change. | |
117 | # If the value from --openssldir is a relative path, | |
118 | # OPENSSLDIR will get $prefix with the --openssldir | |
119 | # value appended as a subdirectory. | |
120 | # | |
121 | use File::Spec::Functions; | |
122 | our $openssldir = | |
123 | $config{openssldir} ? | |
124 | (file_name_is_absolute($config{openssldir}) ? | |
125 | $config{openssldir} | |
126 | : catdir($prefix, $config{openssldir})) | |
127 | : catdir($prefix, "ssl"); | |
128 | $openssldir -} | |
e454f3ad RL |
129 | LIBDIR={- our $libdir = $config{libdir}; |
130 | unless ($libdir) { | |
131 | # | |
132 | # if $prefix/lib$target{multilib} is not an existing | |
133 | # directory, then assume that it's not searched by linker | |
134 | # automatically, in which case adding $target{multilib} suffix | |
135 | # causes more grief than we're ready to tolerate, so don't... | |
136 | our $multilib = | |
137 | -d "$prefix/lib$target{multilib}" ? $target{multilib} : ""; | |
138 | $libdir = "lib$multilib"; | |
139 | } | |
140 | file_name_is_absolute($libdir) ? "" : $libdir -} | |
141 | # $(libdir) is chosen to be compatible with the GNU coding standards | |
142 | libdir={- file_name_is_absolute($libdir) | |
143 | ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -} | |
144 | ENGINESDIR=$(libdir)/engines-{- $sover_dirname -} | |
3f4e8d66 | 145 | MODULESDIR=$(libdir)/ossl-modules |
567a9e6f | 146 | |
fad599f7 RL |
147 | # Convenience variable for those who want to set the rpath in shared |
148 | # libraries and applications | |
e454f3ad | 149 | LIBRPATH=$(libdir) |
fad599f7 | 150 | |
dde10ab4 | 151 | MANDIR=$(INSTALLTOP)/share/man |
8be7bdb5 RL |
152 | DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME) |
153 | HTMLDIR=$(DOCDIR)/html | |
567a9e6f | 154 | |
3544091a RL |
155 | # MANSUFFIX is for the benefit of anyone who may want to have a suffix |
156 | # appended after the manpage file section number. "ssl" is popular, | |
157 | # resulting in files such as config.5ssl rather than config.5. | |
158 | MANSUFFIX= | |
567a9e6f RL |
159 | HTMLSUFFIX=html |
160 | ||
5407338a RS |
161 | # For "optional" echo messages, to get "real" silence |
162 | ECHO = echo | |
567a9e6f | 163 | |
abe256e7 RL |
164 | ##### User defined commands and flags ################################ |
165 | ||
166 | # We let the C compiler driver to take care of .s files. This is done in | |
167 | # order to be excused from maintaining a separate set of architecture | |
168 | # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC | |
169 | # gcc, then the driver will automatically translate it to -xarch=v8plus | |
170 | # and pass it down to assembler. In any case, we do not define AS or | |
171 | # ASFLAGS for this reason. | |
172 | ||
173 | CROSS_COMPILE={- $config{CROSS_COMPILE} -} | |
174 | CC=$(CROSS_COMPILE){- $config{CC} -} | |
175 | CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -} | |
176 | CPPFLAGS={- our $cppflags1 = join(" ", | |
177 | (map { "-D".$_} @{$config{CPPDEFINES}}), | |
178 | (map { "-I".$_} @{$config{CPPINCLUDES}}), | |
179 | @{$config{CPPFLAGS}}) -} | |
180 | CFLAGS={- join(' ', @{$config{CFLAGS}}) -} | |
181 | CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -} | |
182 | LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -} | |
183 | EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -} | |
184 | ||
185 | MAKEDEPEND={- $config{makedepprog} -} | |
567a9e6f | 186 | |
9e265322 | 187 | PERL={- $config{PERL} -} |
567a9e6f | 188 | |
abe256e7 RL |
189 | AR=$(CROSS_COMPILE){- $config{AR} -} |
190 | ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -} | |
191 | RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -} | |
192 | RC= $(CROSS_COMPILE){- $config{RC} -} | |
193 | RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -} | |
194 | ||
567a9e6f | 195 | RM= rm -f |
98e5534e | 196 | RMDIR= rmdir |
abe256e7 RL |
197 | TAR= {- $target{TAR} || "tar" -} |
198 | TARFLAGS= {- $target{TARFLAGS} -} | |
567a9e6f RL |
199 | |
200 | BASENAME= openssl | |
201 | NAME= $(BASENAME)-$(VERSION) | |
b741f153 | 202 | # Relative to $(SRCDIR) |
567a9e6f RL |
203 | TARFILE= ../$(NAME).tar |
204 | ||
abe256e7 RL |
205 | ##### Project flags ################################################## |
206 | ||
207 | # Variables starting with CNF_ are common variables for all product types | |
208 | ||
209 | CNF_CPPFLAGS={- our $cppflags2 = | |
210 | join(' ', $target{cppflags} || (), | |
211 | (map { "-D".$_} @{$target{defines}}, | |
212 | @{$config{defines}}), | |
213 | (map { "-I".$_} @{$target{includes}}, | |
214 | @{$config{includes}}), | |
215 | @{$config{cppflags}}) -} | |
216 | CNF_CFLAGS={- join(' ', $target{cflags} || (), | |
217 | @{$config{cflags}}) -} | |
218 | CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (), | |
219 | @{$config{cxxflags}}) -} | |
220 | CNF_LDFLAGS={- join(' ', $target{lflags} || (), | |
221 | @{$config{lflags}}) -} | |
222 | CNF_EX_LIBS={- join(' ', $target{ex_libs} || (), | |
223 | @{$config{ex_libs}}) -} | |
224 | ||
225 | # Variables starting with LIB_ are used to build library object files | |
226 | # and shared libraries. | |
227 | # Variables starting with DSO_ are used to build DSOs and their object files. | |
228 | # Variables starting with BIN_ are used to build programs and their object | |
229 | # files. | |
230 | ||
58d6be5b RL |
231 | LIB_CPPFLAGS={- our $lib_cppflags = |
232 | join(' ', $target{lib_cppflags} || (), | |
abe256e7 RL |
233 | $target{shared_cppflag} || (), |
234 | (map { '-D'.$_ } | |
2fce15b5 RL |
235 | @{$config{lib_defines} || ()}, |
236 | @{$config{shared_defines} || ()}), | |
58d6be5b RL |
237 | @{$config{lib_cppflags}}, |
238 | @{$config{shared_cppflag}}); | |
239 | join(' ', $lib_cppflags, | |
240 | (map { '-D'.$_ } | |
abe256e7 | 241 | 'OPENSSLDIR="\"$(OPENSSLDIR)\""', |
3f4e8d66 RL |
242 | 'ENGINESDIR="\"$(ENGINESDIR)\""', |
243 | 'MODULESDIR="\"$(MODULESDIR)\""'), | |
abe256e7 RL |
244 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} |
245 | LIB_CFLAGS={- join(' ', $target{lib_cflags} || (), | |
246 | $target{shared_cflag} || (), | |
247 | @{$config{lib_cflags}}, | |
248 | @{$config{shared_cflag}}, | |
249 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
250 | LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (), | |
251 | $target{shared_cxxflag} || (), | |
252 | @{$config{lib_cxxflags}}, | |
253 | @{$config{shared_cxxflag}}, | |
254 | '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} | |
255 | LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (), | |
256 | $config{shared_ldflag} || (), | |
257 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
258 | LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
259 | DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (), | |
260 | $target{module_cppflags} || (), | |
2fce15b5 RL |
261 | (map { '-D'.$_ } |
262 | @{$config{dso_defines} || ()}, | |
263 | @{$config{module_defines} || ()}), | |
abe256e7 RL |
264 | @{$config{dso_cppflags}}, |
265 | @{$config{module_cppflags}}, | |
266 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} | |
267 | DSO_CFLAGS={- join(' ', $target{dso_cflags} || (), | |
268 | $target{module_cflags} || (), | |
269 | @{$config{dso_cflags}}, | |
270 | @{$config{module_cflags}}, | |
271 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
272 | DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (), | |
273 | $target{module_cxxflags} || (), | |
274 | @{$config{dso_cxxflags}}, | |
275 | @{$config{module_cxxflag}}, | |
276 | '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} | |
277 | DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (), | |
278 | $target{module_ldflags} || (), | |
279 | @{$config{dso_ldflags}}, | |
280 | @{$config{module_ldflags}}, | |
281 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
282 | DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
283 | BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (), | |
2fce15b5 | 284 | (map { '-D'.$_ } @{$config{bin_defines} || ()}), |
abe256e7 RL |
285 | @{$config{bin_cppflags}}, |
286 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} | |
287 | BIN_CFLAGS={- join(' ', $target{bin_cflags} || (), | |
288 | @{$config{bin_cflags}}, | |
289 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
290 | BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (), | |
291 | @{$config{bin_cxxflags}}, | |
292 | '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} | |
293 | BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (), | |
294 | @{$config{bin_lflags}}, | |
295 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
296 | BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
297 | ||
298 | # CPPFLAGS_Q is used for one thing only: to build up buildinf.h | |
299 | CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g; | |
300 | $cppflags2 =~ s|([\\"])|\\$1|g; | |
58d6be5b RL |
301 | $lib_cppflags =~ s|([\\"])|\\$1|g; |
302 | join(' ', $lib_cppflags || (), $cppflags2 || (), | |
303 | $cppflags1 || ()) -} | |
abe256e7 | 304 | |
567a9e6f RL |
305 | PERLASM_SCHEME= {- $target{perlasm_scheme} -} |
306 | ||
307 | # For x86 assembler: Set PROCESSOR to 386 if you want to support | |
308 | # the 80386. | |
309 | PROCESSOR= {- $config{processor} -} | |
310 | ||
9c7ce40b AP |
311 | # We want error [and other] messages in English. Trouble is that make(1) |
312 | # doesn't pass macros down as environment variables unless there already | |
313 | # was corresponding variable originally set. In other words we can only | |
314 | # reassign environment variables, but not set new ones, not in portable | |
315 | # manner that is. That's why we reassign several, just to be sure... | |
316 | LC_ALL=C | |
317 | LC_MESSAGES=C | |
318 | LANG=C | |
319 | ||
567a9e6f RL |
320 | # The main targets ################################################### |
321 | ||
1842f369 | 322 | {- dependmagic('all'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils |
27c40a93 | 323 | {- dependmagic('build_libs'); -}: build_libs_nodep |
1842f369 | 324 | {- dependmagic('build_modules'); -}: build_modules_nodep |
1e3d16b0 | 325 | {- dependmagic('build_programs'); -}: build_programs_nodep |
567a9e6f | 326 | |
27c40a93 | 327 | build_generated: $(GENERATED_MANDATORY) |
c058fcd7 | 328 | build_libs_nodep: libcrypto.pc libssl.pc openssl.pc |
1842f369 | 329 | build_modules_nodep: $(MODULES) |
1e3d16b0 RL |
330 | build_programs_nodep: $(PROGRAMS) $(SCRIPTS) |
331 | ||
332 | # Kept around for backward compatibility | |
333 | build_apps build_tests: build_programs | |
68a5f1a2 | 334 | |
9b03b91b RL |
335 | # Convenience target to prebuild all generated files, not just the mandatory |
336 | # ones | |
337 | build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) | |
18d15882 AP |
338 | @ : {- output_off() if $disabled{makedepend}; "" -} |
339 | @echo "Warning: consider configuring with no-makedepend, because if" | |
340 | @echo " target system doesn't have $(PERL)," | |
341 | @echo " then make will fail..." | |
342 | @ : {- output_on() if $disabled{makedepend}; "" -} | |
9b03b91b | 343 | |
1b741653 | 344 | test: tests |
1842f369 | 345 | {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils |
d90a6beb | 346 | @ : {- output_off() if $disabled{tests}; "" -} |
567a9e6f | 347 | ( cd test; \ |
41f571e1 | 348 | mkdir -p test-runs; \ |
567a9e6f RL |
349 | SRCTOP=../$(SRCDIR) \ |
350 | BLDTOP=../$(BLDDIR) \ | |
41f571e1 | 351 | RESULT_D=test-runs \ |
cbece220 | 352 | PERL="$(PERL)" \ |
9dd4ed28 | 353 | EXE_EXT={- platform->binext() -} \ |
06444da4 | 354 | OPENSSL_ENGINES=`cd ../$(BLDDIR)/engines 2>/dev/null && pwd` \ |
6d4bc8a3 | 355 | OPENSSL_DEBUG_MEMORY=on \ |
567a9e6f | 356 | $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) ) |
d90a6beb MC |
357 | @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} |
358 | @echo "Tests are not supported with your chosen Configure options" | |
359 | @ : {- output_on() if !$disabled{tests}; "" -} | |
567a9e6f RL |
360 | |
361 | list-tests: | |
4813ad2d RL |
362 | @ : {- output_off() if $disabled{tests}; "" -} |
363 | @SRCTOP="$(SRCDIR)" \ | |
364 | $(PERL) $(SRCDIR)/test/run_tests.pl list | |
365 | @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} | |
366 | @echo "Tests are not supported with your chosen Configure options" | |
367 | @ : {- output_on() if !$disabled{tests}; "" -} | |
368 | ||
369 | install: install_sw install_ssldirs install_docs | |
370 | ||
371 | uninstall: uninstall_docs uninstall_sw | |
567a9e6f RL |
372 | |
373 | libclean: | |
f99f91f1 | 374 | @set -e; for s in $(SHLIB_INFO); do \ |
49bb4dd0 | 375 | if [ "$$s" = ";" ]; then continue; fi; \ |
f99f91f1 RL |
376 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
377 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
49bb4dd0 BE |
378 | $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\ |
379 | $(RM) apps/$$s1; \ | |
380 | $(RM) test/$$s1; \ | |
381 | $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\ | |
f99f91f1 RL |
382 | $(RM) $$s1; \ |
383 | if [ "$$s1" != "$$s2" ]; then \ | |
5407338a | 384 | $(ECHO) $(RM) $$s2; \ |
f99f91f1 RL |
385 | $(RM) $$s2; \ |
386 | fi; \ | |
387 | done | |
388 | $(RM) $(LIBS) | |
9dd4ed28 | 389 | $(RM) *{- platform->defext() -} |
567a9e6f RL |
390 | |
391 | clean: libclean | |
1842f369 | 392 | $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(SCRIPTS) |
b0a97931 | 393 | $(RM) $(GENERATED_MANDATORY) $(GENERATED) |
9dd4ed28 RL |
394 | -$(RM) `find . -name .git -prune -o -name '*{- platform->depext() -}' -print` |
395 | -$(RM) `find . -name .git -prune -o -name '*{- platform->objext() -}' -print` | |
4813ad2d | 396 | $(RM) core |
9e183d22 | 397 | $(RM) tags TAGS doc-nits |
d016d1ec | 398 | $(RM) -r test/test-runs |
4813ad2d | 399 | $(RM) openssl.pc libcrypto.pc libssl.pc |
d573ff17 | 400 | -$(RM) `find . -name .git -prune -o -type l -print` |
4813ad2d | 401 | $(RM) $(TARFILE) |
567a9e6f | 402 | |
7cae3864 | 403 | distclean: clean |
4813ad2d RL |
404 | $(RM) configdata.pm |
405 | $(RM) Makefile | |
7cae3864 | 406 | |
f8d9d6e4 | 407 | # We check if any depfile is newer than Makefile and decide to |
a6adf099 | 408 | # concatenate only if that is true. |
ea80a25e | 409 | depend: |
29eed3dd | 410 | @: {- output_off() if $disabled{makedepend}; "" -} |
c39785d4 RL |
411 | @$(PERL) $(SRCDIR)/util/add-depends.pl {- |
412 | defined $makedepprog && $makedepprog =~ /\/makedepend/ | |
413 | ? 'makedepend' : 'gcc' -} | |
29eed3dd | 414 | @: {- output_on() if $disabled{makedepend}; "" -} |
567a9e6f RL |
415 | |
416 | # Install helper targets ############################################# | |
417 | ||
e8d01a60 | 418 | install_sw: install_dev install_engines install_runtime |
567a9e6f | 419 | |
f99f91f1 | 420 | uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev |
567a9e6f RL |
421 | |
422 | install_docs: install_man_docs install_html_docs | |
423 | ||
424 | uninstall_docs: uninstall_man_docs uninstall_html_docs | |
3b8033f3 | 425 | $(RM) -r $(DESTDIR)$(DOCDIR) |
567a9e6f | 426 | |
dde10ab4 RL |
427 | install_ssldirs: |
428 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs | |
429 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private | |
66c2eb8b | 430 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc |
4813ad2d RL |
431 | @set -e; for x in dummy $(MISC_SCRIPTS); do \ |
432 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
d8356e1b RL |
433 | x1=`echo "$$x" | cut -f1 -d:`; \ |
434 | x2=`echo "$$x" | cut -f2 -d:`; \ | |
435 | fn=`basename $$x1`; \ | |
436 | $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ | |
437 | cp $$x1 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ | |
4813ad2d RL |
438 | chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ |
439 | mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \ | |
440 | $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \ | |
d8356e1b RL |
441 | if [ "$$x1" != "$$x2" ]; then \ |
442 | ln=`basename "$$x2"`; \ | |
443 | : {- output_off() unless windowsdll(); "" -}; \ | |
444 | $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ | |
445 | cp $(DESTDIR)$(OPENSSLDIR)/misc/$$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \ | |
446 | : {- output_on() unless windowsdll(); | |
447 | output_off() if windowsdll(); "" -}; \ | |
448 | $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ | |
449 | ln -sf $$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \ | |
450 | : {- output_on() if windowsdll(); "" -}; \ | |
451 | fi; \ | |
4813ad2d | 452 | done |
5407338a | 453 | @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" |
4813ad2d RL |
454 | @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new |
455 | @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new | |
cb926df2 | 456 | @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist |
c7af65c7 | 457 | @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \ |
5407338a | 458 | $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ |
cb926df2 RL |
459 | cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ |
460 | chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ | |
461 | fi | |
5407338a | 462 | @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" |
c7af65c7 RS |
463 | @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new |
464 | @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new | |
465 | @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist | |
466 | @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \ | |
5407338a | 467 | $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ |
c7af65c7 RS |
468 | cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \ |
469 | chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \ | |
470 | fi | |
dde10ab4 | 471 | |
c1123d9f | 472 | install_dev: install_runtime_libs |
567a9e6f | 473 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
5407338a | 474 | @$(ECHO) "*** Installing development files" |
3c65577f | 475 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl |
92ebf6c4 | 476 | @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} |
5407338a | 477 | @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" |
24c4f736 RL |
478 | @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c |
479 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c | |
92ebf6c4 | 480 | @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} |
567a9e6f RL |
481 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ |
482 | $(BLDDIR)/include/openssl/*.h; do \ | |
483 | fn=`basename $$i`; \ | |
5407338a | 484 | $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
3c65577f RL |
485 | cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ |
486 | chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ | |
567a9e6f | 487 | done |
e454f3ad | 488 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir) |
0f01b7bc | 489 | @set -e; for l in $(INSTALL_LIBS); do \ |
567a9e6f | 490 | fn=`basename $$l`; \ |
e454f3ad RL |
491 | $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \ |
492 | cp $$l $(DESTDIR)$(libdir)/$$fn.new; \ | |
493 | $(RANLIB) $(DESTDIR)$(libdir)/$$fn.new; \ | |
494 | chmod 644 $(DESTDIR)$(libdir)/$$fn.new; \ | |
495 | mv -f $(DESTDIR)$(libdir)/$$fn.new \ | |
496 | $(DESTDIR)$(libdir)/$$fn; \ | |
567a9e6f | 497 | done |
84af1bae | 498 | @ : {- output_off() if $disabled{shared}; "" -} |
0f01b7bc | 499 | @set -e; for s in $(INSTALL_SHLIB_INFO); do \ |
c8c2b779 RL |
500 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
501 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
502 | fn1=`basename $$s1`; \ | |
503 | fn2=`basename $$s2`; \ | |
cff89b17 | 504 | : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \ |
c8c2b779 | 505 | if [ "$$fn1" != "$$fn2" ]; then \ |
e454f3ad RL |
506 | $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \ |
507 | ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \ | |
567a9e6f | 508 | fi; \ |
cff89b17 | 509 | : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \ |
e454f3ad RL |
510 | $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \ |
511 | cp $$s2 $(DESTDIR)$(libdir)/$$fn2.new; \ | |
512 | chmod 755 $(DESTDIR)$(libdir)/$$fn2.new; \ | |
513 | mv -f $(DESTDIR)$(libdir)/$$fn2.new \ | |
514 | $(DESTDIR)$(libdir)/$$fn2; \ | |
cff89b17 AP |
515 | : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \ |
516 | a=$(DESTDIR)$(libdir)/$$fn2; \ | |
517 | $(ECHO) "install $$s1 -> $$a"; \ | |
518 | if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \ | |
519 | mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \ | |
520 | cp -f $$a $$a.new; \ | |
521 | for so in `$(AR) t $$a`; do \ | |
522 | $(AR) x $$a $$so; \ | |
523 | chmod u+w $$so; \ | |
524 | strip -X32_64 -e $$so; \ | |
525 | $(AR) r $$a.new $$so; \ | |
526 | done; \ | |
527 | )); fi; \ | |
528 | $(AR) r $$a.new $$s1; \ | |
529 | mv -f $$a.new $$a; \ | |
530 | : {- output_off() if sharedaix(); output_on(); "" -}; \ | |
567a9e6f | 531 | done |
84af1bae | 532 | @ : {- output_on() if $disabled{shared}; "" -} |
e454f3ad RL |
533 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig |
534 | @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc" | |
535 | @cp libcrypto.pc $(DESTDIR)$(libdir)/pkgconfig | |
536 | @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc | |
537 | @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc" | |
538 | @cp libssl.pc $(DESTDIR)$(libdir)/pkgconfig | |
539 | @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libssl.pc | |
540 | @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc" | |
541 | @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig | |
542 | @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc | |
567a9e6f | 543 | |
c1123d9f | 544 | uninstall_dev: uninstall_runtime_libs |
5407338a | 545 | @$(ECHO) "*** Uninstalling development files" |
92ebf6c4 | 546 | @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} |
5407338a | 547 | @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" |
24c4f736 | 548 | @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c |
92ebf6c4 | 549 | @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} |
567a9e6f RL |
550 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ |
551 | $(BLDDIR)/include/openssl/*.h; do \ | |
552 | fn=`basename $$i`; \ | |
5407338a | 553 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
3c65577f | 554 | $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ |
567a9e6f | 555 | done |
98e5534e RL |
556 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl |
557 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include | |
0f01b7bc | 558 | @set -e; for l in $(INSTALL_LIBS); do \ |
567a9e6f | 559 | fn=`basename $$l`; \ |
e454f3ad RL |
560 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \ |
561 | $(RM) $(DESTDIR)$(libdir)/$$fn; \ | |
567a9e6f | 562 | done |
84af1bae | 563 | @ : {- output_off() if $disabled{shared}; "" -} |
0f01b7bc | 564 | @set -e; for s in $(INSTALL_SHLIB_INFO); do \ |
c8c2b779 RL |
565 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
566 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
567 | fn1=`basename $$s1`; \ | |
568 | fn2=`basename $$s2`; \ | |
569 | : {- output_off() if windowsdll(); "" -}; \ | |
cff89b17 AP |
570 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ |
571 | $(RM) $(DESTDIR)$(libdir)/$$fn2; \ | |
572 | if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \ | |
573 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \ | |
574 | $(RM) $(DESTDIR)$(libdir)/$$fn1; \ | |
567a9e6f | 575 | fi; \ |
c8c2b779 | 576 | : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ |
e454f3ad RL |
577 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ |
578 | $(RM) $(DESTDIR)$(libdir)/$$fn2; \ | |
ce5ed82f | 579 | : {- output_on() unless windowsdll(); "" -}; \ |
567a9e6f | 580 | done |
c8cca980 | 581 | @ : {- output_on() if $disabled{shared}; "" -} |
e454f3ad RL |
582 | $(RM) $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc |
583 | $(RM) $(DESTDIR)$(libdir)/pkgconfig/libssl.pc | |
584 | $(RM) $(DESTDIR)$(libdir)/pkgconfig/openssl.pc | |
585 | -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig | |
586 | -$(RMDIR) $(DESTDIR)$(libdir) | |
567a9e6f | 587 | |
1842f369 | 588 | install_engines: install_runtime_libs build_modules |
567a9e6f | 589 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
b2de11c5 | 590 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/ |
1842f369 | 591 | @$(ECHO) "*** Installing ENGINE modules" |
0f01b7bc | 592 | @set -e; for e in dummy $(INSTALL_ENGINES); do \ |
2b364f61 | 593 | if [ "$$e" = "dummy" ]; then continue; fi; \ |
567a9e6f | 594 | fn=`basename $$e`; \ |
5407338a | 595 | $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \ |
b2de11c5 RL |
596 | cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \ |
597 | chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \ | |
598 | mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \ | |
599 | $(DESTDIR)$(ENGINESDIR)/$$fn; \ | |
567a9e6f RL |
600 | done |
601 | ||
602 | uninstall_engines: | |
1842f369 | 603 | @$(ECHO) "*** Uninstalling ENGINE modules" |
0f01b7bc | 604 | @set -e; for e in dummy $(INSTALL_ENGINES); do \ |
2b364f61 | 605 | if [ "$$e" = "dummy" ]; then continue; fi; \ |
567a9e6f | 606 | fn=`basename $$e`; \ |
9dd4ed28 | 607 | if [ "$$fn" = '{- platform->dso("ossltest") -}' ]; then \ |
f0c93a85 RL |
608 | continue; \ |
609 | fi; \ | |
5407338a | 610 | $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \ |
b2de11c5 | 611 | $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \ |
567a9e6f | 612 | done |
b2de11c5 | 613 | -$(RMDIR) $(DESTDIR)$(ENGINESDIR) |
567a9e6f | 614 | |
c1123d9f RL |
615 | install_runtime: install_programs |
616 | ||
e8d01a60 | 617 | install_runtime_libs: build_libs |
567a9e6f | 618 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
36b53720 | 619 | @ : {- output_off() if windowsdll(); "" -} |
e454f3ad | 620 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir) |
9694ebf7 RL |
621 | @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -} |
622 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin | |
623 | @ : {- output_on() unless windowsdll(); "" -} | |
c1123d9f | 624 | @$(ECHO) "*** Installing runtime libraries" |
0f01b7bc | 625 | @set -e; for s in dummy $(INSTALL_SHLIBS); do \ |
2b364f61 | 626 | if [ "$$s" = "dummy" ]; then continue; fi; \ |
f99f91f1 | 627 | fn=`basename $$s`; \ |
36b53720 | 628 | : {- output_off() unless windowsdll(); "" -}; \ |
5407338a | 629 | $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 630 | cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
fa63e452 | 631 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
3c65577f RL |
632 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ |
633 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
36b53720 | 634 | : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \ |
e454f3ad RL |
635 | $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \ |
636 | cp $$s $(DESTDIR)$(libdir)/$$fn.new; \ | |
637 | chmod 755 $(DESTDIR)$(libdir)/$$fn.new; \ | |
638 | mv -f $(DESTDIR)$(libdir)/$$fn.new \ | |
639 | $(DESTDIR)$(libdir)/$$fn; \ | |
36b53720 | 640 | : {- output_on() if windowsdll(); "" -}; \ |
fcf80c46 | 641 | done |
c1123d9f | 642 | |
e8d01a60 | 643 | install_programs: install_runtime_libs build_programs |
c1123d9f RL |
644 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
645 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin | |
646 | @$(ECHO) "*** Installing runtime programs" | |
0f01b7bc | 647 | @set -e; for x in dummy $(INSTALL_PROGRAMS); do \ |
2b364f61 | 648 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 649 | fn=`basename $$x`; \ |
5407338a | 650 | $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f RL |
651 | cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
652 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
653 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
654 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 655 | done |
2b364f61 RL |
656 | @set -e; for x in dummy $(BIN_SCRIPTS); do \ |
657 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
567a9e6f | 658 | fn=`basename $$x`; \ |
5407338a | 659 | $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f RL |
660 | cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
661 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
662 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
663 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 664 | done |
567a9e6f | 665 | |
c1123d9f RL |
666 | uninstall_runtime: uninstall_programs uninstall_runtime_libs |
667 | ||
668 | uninstall_programs: | |
669 | @$(ECHO) "*** Uninstalling runtime programs" | |
0f01b7bc | 670 | @set -e; for x in dummy $(INSTALL_PROGRAMS); \ |
567a9e6f | 671 | do \ |
2b364f61 | 672 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 673 | fn=`basename $$x`; \ |
5407338a | 674 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 675 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ |
567a9e6f | 676 | done; |
2b364f61 | 677 | @set -e; for x in dummy $(BIN_SCRIPTS); \ |
567a9e6f | 678 | do \ |
2b364f61 | 679 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 680 | fn=`basename $$x`; \ |
5407338a | 681 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 682 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ |
567a9e6f | 683 | done |
c1123d9f RL |
684 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin |
685 | ||
686 | uninstall_runtime_libs: | |
687 | @$(ECHO) "*** Uninstalling runtime libraries" | |
b1837abd | 688 | @ : {- output_off() unless windowsdll(); "" -} |
0f01b7bc | 689 | @set -e; for s in dummy $(INSTALL_SHLIBS); do \ |
2b364f61 | 690 | if [ "$$s" = "dummy" ]; then continue; fi; \ |
f99f91f1 | 691 | fn=`basename $$s`; \ |
5407338a | 692 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 693 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ |
fcf80c46 | 694 | done |
b1837abd | 695 | @ : {- output_on() unless windowsdll(); "" -} |
567a9e6f | 696 | |
567a9e6f RL |
697 | |
698 | install_man_docs: | |
699 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
5407338a | 700 | @$(ECHO) "*** Installing manpages" |
cadb015b RL |
701 | $(PERL) $(SRCDIR)/util/process_docs.pl \ |
702 | --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) | |
567a9e6f RL |
703 | |
704 | uninstall_man_docs: | |
5407338a | 705 | @$(ECHO) "*** Uninstalling manpages" |
cadb015b RL |
706 | $(PERL) $(SRCDIR)/util/process_docs.pl \ |
707 | --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \ | |
708 | --remove | |
567a9e6f RL |
709 | |
710 | install_html_docs: | |
711 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
5407338a | 712 | @$(ECHO) "*** Installing HTML manpages" |
cadb015b RL |
713 | $(PERL) $(SRCDIR)/util/process_docs.pl \ |
714 | --destdir=$(DESTDIR)$(HTMLDIR) --type=html | |
567a9e6f RL |
715 | |
716 | uninstall_html_docs: | |
5407338a | 717 | @$(ECHO) "*** Uninstalling manpages" |
cadb015b RL |
718 | $(PERL) $(SRCDIR)/util/process_docs.pl \ |
719 | --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove | |
567a9e6f RL |
720 | |
721 | ||
722 | # Developer targets (note: these are only available on Unix) ######### | |
723 | ||
6bb2106e RL |
724 | update: generate errors ordinals |
725 | ||
b7650c67 | 726 | generate: generate_apps generate_crypto_bn generate_crypto_objects \ |
8e32e1ab | 727 | generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids |
567a9e6f | 728 | |
c4fad5d3 | 729 | .PHONY: doc-nits |
32d40d0d | 730 | doc-nits: build_generated |
b5283535 | 731 | (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p -s ) >doc-nits |
c4fad5d3 DMSP |
732 | @if [ -s doc-nits ] ; then cat doc-nits ; exit 1; \ |
733 | else echo 'doc-nits: no errors.'; rm doc-nits ; fi | |
65c1f979 | 734 | |
567a9e6f RL |
735 | # Test coverage is a good idea for the future |
736 | #coverage: $(PROGRAMS) $(TESTPROGRAMS) | |
737 | # ... | |
738 | ||
567a9e6f RL |
739 | lint: |
740 | lint -DLINT $(INCLUDES) $(SRCS) | |
741 | ||
9a9f8ee7 RL |
742 | generate_apps: |
743 | ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \ | |
744 | < apps/openssl.cnf > apps/openssl-vms.cnf ) | |
4b62b8ed RL |
745 | @ : {- output_off() if $disabled{apps}; "" -} |
746 | ( b=`pwd`; cd $(SRCDIR); \ | |
747 | $(PERL) -I$$b apps/progs.pl -H $(APPS_OPENSSL) > apps/progs.h ) | |
748 | ( b=`pwd`; cd $(SRCDIR); \ | |
749 | $(PERL) -I$$b apps/progs.pl -C $(APPS_OPENSSL) > apps/progs.c ) | |
750 | @ : {- output_on() if $disabled{apps}; "" -} | |
9a9f8ee7 RL |
751 | |
752 | generate_crypto_bn: | |
753 | ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h ) | |
754 | ||
755 | generate_crypto_objects: | |
22defb43 RS |
756 | ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \ |
757 | crypto/objects/objects.txt \ | |
758 | crypto/objects/obj_mac.num \ | |
759 | > crypto/objects/obj_mac.new && \ | |
760 | mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num ) | |
9a9f8ee7 RL |
761 | ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \ |
762 | crypto/objects/objects.txt \ | |
763 | crypto/objects/obj_mac.num \ | |
22defb43 | 764 | > include/openssl/obj_mac.h ) |
e6f2bb66 KM |
765 | ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \ |
766 | include/openssl/obj_mac.h \ | |
22defb43 | 767 | > crypto/objects/obj_dat.h ) |
9a9f8ee7 RL |
768 | ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \ |
769 | crypto/objects/obj_mac.num \ | |
770 | crypto/objects/obj_xref.txt \ | |
771 | > crypto/objects/obj_xref.h ) | |
6bb2106e | 772 | |
b7650c67 RL |
773 | generate_crypto_conf: |
774 | ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \ | |
775 | > crypto/conf/conf_def.h ) | |
776 | ||
777 | generate_crypto_asn1: | |
778 | ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \ | |
779 | > crypto/asn1/charmap.h ) | |
780 | ||
8e32e1ab RL |
781 | generate_fuzz_oids: |
782 | ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \ | |
783 | crypto/objects/obj_dat.h \ | |
784 | > fuzz/oids.txt ) | |
785 | ||
52df25cf RS |
786 | # Set to -force to force a rebuild |
787 | ERROR_REBUILD= | |
567a9e6f | 788 | errors: |
aa6cc8d3 RL |
789 | ( b=`pwd`; set -e; cd $(SRCDIR); \ |
790 | $(PERL) util/ck_errf.pl -strict -internal; \ | |
cb7b7275 | 791 | $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal ) |
aa6cc8d3 | 792 | ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \ |
52df25cf | 793 | for E in *.ec ; do \ |
aa6cc8d3 RL |
794 | $(PERL) ../util/ck_errf.pl -strict \ |
795 | -conf $$E `basename $$E .ec`.c; \ | |
cb7b7275 | 796 | $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \ |
52df25cf RS |
797 | -conf $$E `basename $$E .ec`.c ; \ |
798 | done ) | |
567a9e6f | 799 | |
30699aa1 RL |
800 | {- use File::Basename; |
801 | ||
802 | our @sslheaders = | |
803 | qw( include/openssl/ssl.h | |
804 | include/openssl/ssl2.h | |
805 | include/openssl/ssl3.h | |
806 | include/openssl/sslerr.h | |
807 | include/openssl/tls1.h | |
808 | include/openssl/dtls1.h | |
809 | include/openssl/srtp.h ); | |
810 | our @cryptoheaders = | |
811 | qw( include/internal/dso.h | |
812 | include/internal/o_dir.h | |
30699aa1 RL |
813 | include/internal/err.h |
814 | include/internal/sslconf.h ); | |
df443918 | 815 | our @cryptoskipheaders = ( @sslheaders, |
30699aa1 RL |
816 | qw( include/openssl/conf_api.h |
817 | include/openssl/ebcdic.h | |
818 | include/openssl/opensslconf.h | |
819 | include/openssl/symhacks.h ) ); | |
820 | foreach my $f ( glob(catfile($config{sourcedir}, | |
821 | 'include','openssl','*.h')) ) { | |
822 | my $fn = "include/openssl/" . basename($f); | |
823 | push @cryptoheaders, $fn unless grep { $_ eq $fn } @cryptoskipheaders; | |
824 | } | |
825 | ""; | |
826 | -} | |
827 | CRYPTOHEADERS={- join(" \\\n\t", sort @cryptoheaders) -} | |
828 | SSLHEADERS={- join(" \\\n\t", sort @sslheaders) -} | |
567a9e6f | 829 | ordinals: |
30699aa1 RL |
830 | ( cd $(SRCDIR); \ |
831 | $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \ | |
832 | --ordinals util/libcrypto.num \ | |
833 | --symhacks include/openssl/symhacks.h \ | |
834 | $(CRYPTOHEADERS) ) | |
835 | ( cd $(SRCDIR); \ | |
836 | $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \ | |
837 | --ordinals util/libssl.num \ | |
838 | --symhacks include/openssl/symhacks.h \ | |
839 | $(SSLHEADERS)) | |
567a9e6f RL |
840 | |
841 | test_ordinals: | |
842 | ( cd test; \ | |
843 | SRCTOP=../$(SRCDIR) \ | |
844 | BLDTOP=../$(BLDDIR) \ | |
845 | $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals ) | |
846 | ||
847 | tags TAGS: FORCE | |
848 | rm -f TAGS tags | |
849 | -ctags -R . | |
850 | -etags `find . -name '*.[ch]' -o -name '*.pm'` | |
851 | ||
852 | # Release targets (note: only available on Unix) ##################### | |
853 | ||
854 | tar: | |
b741f153 | 855 | (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)') |
567a9e6f RL |
856 | |
857 | # Helper targets ##################################################### | |
858 | ||
342a1a23 | 859 | link-utils: $(BLDDIR)/util/opensslwrap.sh |
567a9e6f | 860 | |
27f42b46 | 861 | $(BLDDIR)/util/opensslwrap.sh: configdata.pm |
567a9e6f RL |
862 | @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ |
863 | mkdir -p "$(BLDDIR)/util"; \ | |
864 | ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \ | |
865 | fi | |
342a1a23 | 866 | |
c058fcd7 | 867 | FORCE: |
567a9e6f RL |
868 | |
869 | # Building targets ################################################### | |
870 | ||
9dd4ed28 | 871 | libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // () } @{$unified_info{libraries}}) -} |
567a9e6f RL |
872 | libcrypto.pc: |
873 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
874 | echo 'exec_prefix=$${prefix}'; \ | |
e454f3ad RL |
875 | if [ -n "$(LIBDIR)" ]; then \ |
876 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
877 | else \ | |
878 | echo 'libdir=$(libdir)'; \ | |
879 | fi; \ | |
567a9e6f | 880 | echo 'includedir=$${prefix}/include'; \ |
d4453024 | 881 | echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \ |
567a9e6f RL |
882 | echo ''; \ |
883 | echo 'Name: OpenSSL-libcrypto'; \ | |
884 | echo 'Description: OpenSSL cryptography library'; \ | |
885 | echo 'Version: '$(VERSION); \ | |
886 | echo 'Libs: -L$${libdir} -lcrypto'; \ | |
abe256e7 | 887 | echo 'Libs.private: $(LIB_EX_LIBS)'; \ |
567a9e6f RL |
888 | echo 'Cflags: -I$${includedir}' ) > libcrypto.pc |
889 | ||
890 | libssl.pc: | |
891 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
892 | echo 'exec_prefix=$${prefix}'; \ | |
e454f3ad RL |
893 | if [ -n "$(LIBDIR)" ]; then \ |
894 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
895 | else \ | |
896 | echo 'libdir=$(libdir)'; \ | |
897 | fi; \ | |
567a9e6f RL |
898 | echo 'includedir=$${prefix}/include'; \ |
899 | echo ''; \ | |
900 | echo 'Name: OpenSSL-libssl'; \ | |
901 | echo 'Description: Secure Sockets Layer and cryptography libraries'; \ | |
902 | echo 'Version: '$(VERSION); \ | |
903 | echo 'Requires.private: libcrypto'; \ | |
904 | echo 'Libs: -L$${libdir} -lssl'; \ | |
567a9e6f RL |
905 | echo 'Cflags: -I$${includedir}' ) > libssl.pc |
906 | ||
907 | openssl.pc: | |
908 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
909 | echo 'exec_prefix=$${prefix}'; \ | |
e454f3ad RL |
910 | if [ -n "$(LIBDIR)" ]; then \ |
911 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
912 | else \ | |
913 | echo 'libdir=$(libdir)'; \ | |
914 | fi; \ | |
567a9e6f RL |
915 | echo 'includedir=$${prefix}/include'; \ |
916 | echo ''; \ | |
917 | echo 'Name: OpenSSL'; \ | |
918 | echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \ | |
919 | echo 'Version: '$(VERSION); \ | |
920 | echo 'Requires: libssl libcrypto' ) > openssl.pc | |
921 | ||
41240e68 | 922 | configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -} |
27f42b46 | 923 | @echo "Detected changed: $?" |
a1b6933e | 924 | $(PERL) configdata.pm -r |
567a9e6f RL |
925 | @echo "**************************************************" |
926 | @echo "*** ***" | |
927 | @echo "*** Please run the same make command again ***" | |
928 | @echo "*** ***" | |
929 | @echo "**************************************************" | |
930 | @false | |
931 | ||
bf01fbbf | 932 | reconfigure reconf: |
a1b6933e | 933 | $(PERL) configdata.pm -r |
bf01fbbf | 934 | |
567a9e6f RL |
935 | {- |
936 | use File::Basename; | |
937 | use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; | |
cedbb146 RL |
938 | |
939 | # Helper function to figure out dependencies on libraries | |
940 | # It takes a list of library names and outputs a list of dependencies | |
941 | sub compute_lib_depends { | |
cedbb146 RL |
942 | # Depending on shared libraries: |
943 | # On Windows POSIX layers, we depend on {libname}.dll.a | |
944 | # On Unix platforms, we depend on {shlibname}.so | |
9dd4ed28 | 945 | return map { platform->sharedlib_simple($_) // platform->staticlib($_) } @_; |
cedbb146 RL |
946 | } |
947 | ||
66ddf178 RL |
948 | sub generatesrc { |
949 | my %args = @_; | |
950 | my $generator = join(" ", @{$args{generator}}); | |
8d34daf0 | 951 | my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}}); |
d4605727 | 952 | my $incs = join("", map { " -I".$_ } @{$args{incs}}); |
25628ab2 | 953 | my $defs = join("", map { " -D".$_ } @{$args{defs}}); |
8d34daf0 | 954 | my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}}); |
66ddf178 | 955 | |
9dd4ed28 RL |
956 | if (platform->isdef($args{src})) { |
957 | my $target = platform->def($args{src}); | |
ef2dfc99 | 958 | (my $mkdef_os = $target{shared_target}) =~ s|-shared$||; |
66a24ab8 | 959 | my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : ''; |
9dd4ed28 | 960 | my $ord_name = $args{generator}->[1] || $args{product}; |
ef2dfc99 | 961 | return <<"EOF"; |
66a24ab8 RL |
962 | $target: $args{generator}->[0] $deps \$(SRCDIR)/util/mkdef.pl |
963 | \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $args{generator}->[0] --name $ord_name --OS $mkdef_os > $target | |
ef2dfc99 | 964 | EOF |
9dd4ed28 | 965 | } elsif (!platform->isasm($args{src})) { |
7cae3864 RL |
966 | if ($args{generator}->[0] =~ m|^.*\.in$|) { |
967 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
968 | "util", "dofile.pl")), | |
969 | rel2abs($config{builddir})); | |
970 | return <<"EOF"; | |
971 | $args{src}: $args{generator}->[0] $deps | |
972 | \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ | |
973 | "-o$target{build_file}" $generator > \$@ | |
974 | EOF | |
975 | } else { | |
976 | return <<"EOF"; | |
769777b0 | 977 | $args{src}: $args{generator}->[0] $deps |
8d34daf0 | 978 | \$(PERL)$generator_incs $generator > \$@ |
66ddf178 | 979 | EOF |
7cae3864 | 980 | } |
66ddf178 | 981 | } else { |
8458f1bf | 982 | if ($args{generator}->[0] =~ /\.pl$/) { |
8d34daf0 | 983 | $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator; |
8458f1bf | 984 | } elsif ($args{generator}->[0] =~ /\.m4$/) { |
8d34daf0 | 985 | $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >' |
8458f1bf RL |
986 | } elsif ($args{generator}->[0] =~ /\.S$/) { |
987 | $generator = undef; | |
988 | } else { | |
989 | die "Generator type for $args{src} unknown: $generator\n"; | |
990 | } | |
991 | ||
722c9762 | 992 | my $cppflags = { |
9dfc8680 | 993 | shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', |
8bc0147f RL |
994 | lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', |
995 | dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', | |
996 | bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' | |
722c9762 | 997 | } -> {$args{intent}}; |
8458f1bf | 998 | if (defined($generator)) { |
66ddf178 | 999 | return <<"EOF"; |
769777b0 | 1000 | $args{src}: $args{generator}->[0] $deps |
8458f1bf | 1001 | $generator \$@ |
66ddf178 | 1002 | EOF |
66ddf178 | 1003 | } |
8458f1bf | 1004 | return <<"EOF"; |
769777b0 | 1005 | $args{src}: $args{generator}->[0] $deps |
25628ab2 | 1006 | \$(CC) $incs $cppflags $defs -E $args{generator}->[0] | \\ |
39199fb3 | 1007 | \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@ |
8458f1bf | 1008 | EOF |
66ddf178 RL |
1009 | } |
1010 | } | |
1011 | ||
bb26842d RL |
1012 | # Should one wonder about the end of the Perl snippet, it's because this |
1013 | # second regexp eats up line endings as well, if the removed path is the | |
1014 | # last in the line. We may therefore need to put back a line ending. | |
88297284 | 1015 | sub src2obj { |
567a9e6f | 1016 | my %args = @_; |
9dd4ed28 RL |
1017 | my $obj = platform->obj($args{obj}); |
1018 | my $dep = platform->dep($args{obj}); | |
a23f0316 | 1019 | my @srcs = @{$args{srcs}}; |
8458f1bf RL |
1020 | my $srcs = join(" ", @srcs); |
1021 | my $deps = join(" ", @srcs, @{$args{deps}}); | |
45502bfe | 1022 | my $incs = join("", map { " -I".$_ } @{$args{incs}}); |
25628ab2 | 1023 | my $defs = join("", map { " -D".$_ } @{$args{defs}}); |
722c9762 RL |
1024 | my $cmd; |
1025 | my $cmdflags; | |
1026 | my $cmdcompile; | |
81183680 RL |
1027 | if (grep /\.rc$/, @srcs) { |
1028 | $cmd = '$(RC)'; | |
1029 | $cmdflags = '$(RCFLAGS)'; | |
8c3bc594 | 1030 | $cmdcompile = ''; |
81183680 RL |
1031 | } elsif (grep /\.(cc|cpp)$/, @srcs) { |
1032 | $cmd = '$(CXX)'; | |
722c9762 RL |
1033 | $cmdcompile = ' -c'; |
1034 | $cmdflags = { | |
9dfc8680 | 1035 | shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)', |
722c9762 RL |
1036 | lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)', |
1037 | dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)', | |
1038 | bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)' | |
1039 | } -> {$args{intent}}; | |
7763472f | 1040 | } else { |
722c9762 RL |
1041 | $cmd = '$(CC)'; |
1042 | $cmdcompile = ' -c'; | |
1043 | $cmdflags = { | |
9dfc8680 | 1044 | shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', |
722c9762 RL |
1045 | lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', |
1046 | dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', | |
1047 | bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' | |
1048 | } -> {$args{intent}}; | |
7763472f | 1049 | } |
a23f0316 AP |
1050 | my $recipe; |
1051 | # extension-specific rules | |
1052 | if (grep /\.s$/, @srcs) { | |
1053 | $recipe .= <<"EOF"; | |
9dd4ed28 | 1054 | $obj: $deps |
a23f0316 | 1055 | $cmd $cmdflags -c -o \$\@ $srcs |
7e5b8b93 | 1056 | EOF |
a23f0316 | 1057 | } elsif (grep /\.S$/, @srcs) { |
18d15882 AP |
1058 | # Originally there was mutli-step rule with $(CC) -E file.S |
1059 | # followed by $(CC) -c file.s. It compensated for one of | |
1060 | # legacy platform compiler's inability to handle .S files. | |
1061 | # The platform is long discontinued by vendor so there is | |
1062 | # hardly a point to drag it along... | |
29eed3dd | 1063 | $recipe .= <<"EOF"; |
9dd4ed28 | 1064 | $obj: $deps |
25628ab2 | 1065 | $cmd $incs $defs $cmdflags -c -o \$\@ $srcs |
a23f0316 | 1066 | EOF |
49bb4dd0 BE |
1067 | } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/ |
1068 | && !grep /\.rc$/, @srcs) { | |
a23f0316 | 1069 | $recipe .= <<"EOF"; |
9dd4ed28 RL |
1070 | $obj: $deps |
1071 | $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs | |
1072 | \@touch $dep.tmp | |
1073 | \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\ | |
1074 | rm -f $dep.tmp; \\ | |
29b28eee | 1075 | else \\ |
9dd4ed28 | 1076 | mv $dep.tmp $dep; \\ |
987dbc7f | 1077 | fi |
29eed3dd | 1078 | EOF |
7e5b8b93 | 1079 | } else { |
29eed3dd | 1080 | $recipe .= <<"EOF"; |
9dd4ed28 | 1081 | $obj: $deps |
25628ab2 | 1082 | $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs |
567a9e6f | 1083 | EOF |
81183680 | 1084 | if (defined $makedepprog && $makedepprog =~ /\/makedepend/) { |
7e5b8b93 | 1085 | $recipe .= <<"EOF"; |
c39785d4 | 1086 | \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\ |
9dd4ed28 | 1087 | > $dep |
567a9e6f | 1088 | EOF |
7e5b8b93 | 1089 | } |
29eed3dd RL |
1090 | } |
1091 | return $recipe; | |
567a9e6f | 1092 | } |
d8cac50b | 1093 | # We *know* this routine is only called when we've configure 'shared'. |
f6196227 | 1094 | sub obj2shlib { |
567a9e6f | 1095 | my %args = @_; |
47eeaf45 RL |
1096 | my @linkdirs = (); |
1097 | foreach (@{args{deps}}) { | |
1098 | my $d = dirname($_); | |
1099 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
1100 | } | |
1101 | my $linkflags = join("", map { "-L$_ " } @linkdirs); | |
1102 | my $linklibs = join("", map { my $f = basename($_); | |
cedbb146 | 1103 | (my $l = $f) =~ s/^lib//; |
47eeaf45 | 1104 | " -l$l" } @{$args{deps}}); |
9dd4ed28 RL |
1105 | my @objs = map { platform->obj($_) } |
1106 | grep { !platform->isdef($_) } | |
ef2dfc99 | 1107 | @{$args{objs}}; |
9dd4ed28 RL |
1108 | my @defs = map { platform->def($_) } |
1109 | grep { platform->isdef($_) } | |
81183680 | 1110 | @{$args{objs}}; |
81183680 RL |
1111 | my @deps = compute_lib_depends(@{$args{deps}}); |
1112 | die "More than one exported symbol map" if scalar @defs > 1; | |
1113 | my $objs = join(" ", @objs); | |
1114 | my $deps = join(" ", @objs, @defs, @deps); | |
9dd4ed28 RL |
1115 | my $simple = platform->sharedlib_simple($args{lib}); |
1116 | my $full = platform->sharedlib($args{lib}); | |
81183680 | 1117 | my $shared_soname = ""; |
d8cac50b | 1118 | $shared_soname .= ' '.$target{shared_sonameflag}.basename($full) |
81183680 RL |
1119 | if defined $target{shared_sonameflag}; |
1120 | my $shared_imp = ""; | |
d8cac50b | 1121 | $shared_imp .= ' '.$target{shared_impflag}.basename($simple) |
81183680 RL |
1122 | if defined $target{shared_impflag}; |
1123 | my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); | |
1124 | my $recipe = <<"EOF"; | |
9dd4ed28 | 1125 | $simple: $full |
fcf80c46 | 1126 | EOF |
9dd4ed28 | 1127 | if (sharedaix()) { |
81183680 | 1128 | $recipe .= <<"EOF"; |
9dd4ed28 RL |
1129 | rm -f $simple && \\ |
1130 | \$(AR) r $simple $full | |
cff89b17 | 1131 | EOF |
9dd4ed28 | 1132 | } elsif ($simple ne $full) { |
cff89b17 | 1133 | $recipe .= <<"EOF"; |
d8cac50b | 1134 | rm -f $simple && \\ |
9dd4ed28 | 1135 | ln -s $full $simple |
81183680 | 1136 | EOF |
9dd4ed28 RL |
1137 | } |
1138 | $recipe .= <<"EOF"; | |
1139 | $full: $deps | |
1140 | \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\ | |
1141 | -o $full$shared_def $objs \\ | |
1142 | $linklibs \$(LIB_EX_LIBS) | |
1143 | EOF | |
1144 | if (windowsdll()) { | |
81183680 | 1145 | $recipe .= <<"EOF"; |
9dd4ed28 RL |
1146 | rm -f apps/$full |
1147 | rm -f test/$full | |
1148 | rm -f fuzz/$full | |
1149 | cp -p $full apps/ | |
1150 | cp -p $full test/ | |
1151 | cp -p $full fuzz/ | |
567a9e6f | 1152 | EOF |
81183680 | 1153 | } |
9dd4ed28 | 1154 | return $recipe; |
567a9e6f | 1155 | } |
5386287c | 1156 | sub obj2dso { |
567a9e6f | 1157 | my %args = @_; |
9dd4ed28 | 1158 | my $dso = platform->dso($args{lib}); |
47eeaf45 RL |
1159 | my @linkdirs = (); |
1160 | foreach (@{args{deps}}) { | |
1161 | my $d = dirname($_); | |
1162 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
1163 | } | |
1164 | my $linkflags = join("", map { "-L$_ " } @linkdirs); | |
1165 | my $linklibs = join("", map { my $f = basename($_); | |
81183680 | 1166 | (my $l = $f) =~ s/^lib//; |
47eeaf45 | 1167 | " -l$l" } @{$args{deps}}); |
9dd4ed28 RL |
1168 | my @objs = map { platform->obj($_) } |
1169 | grep { !platform->isdef($_) } | |
29f3cfdd | 1170 | @{$args{objs}}; |
9dd4ed28 RL |
1171 | my @defs = map { platform->def($_) } |
1172 | grep { platform->isdef($_) } | |
66a24ab8 | 1173 | @{$args{objs}}; |
81183680 RL |
1174 | my @deps = compute_lib_depends(@{$args{deps}}); |
1175 | my $objs = join(" ", @objs); | |
66a24ab8 | 1176 | my $deps = join(" ", @objs, @defs, @deps); |
66a24ab8 | 1177 | my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); |
567a9e6f | 1178 | return <<"EOF"; |
9dd4ed28 | 1179 | $dso: $deps |
722c9762 | 1180 | \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\ |
9dd4ed28 | 1181 | -o $dso$shared_def $objs \\ |
150624bc | 1182 | $linklibs \$(DSO_EX_LIBS) |
567a9e6f RL |
1183 | EOF |
1184 | } | |
1185 | sub obj2lib { | |
1186 | my %args = @_; | |
9dd4ed28 RL |
1187 | my $lib = platform->staticlib($args{lib}); |
1188 | my @objs = map { platform->obj($_) } @{$args{objs}}; | |
81183680 | 1189 | my $objs = join(" ", @objs); |
567a9e6f | 1190 | return <<"EOF"; |
9dd4ed28 | 1191 | $lib: $objs |
5b18235a | 1192 | \$(AR) \$(ARFLAGS) \$\@ \$\? |
567a9e6f RL |
1193 | \$(RANLIB) \$\@ || echo Never mind. |
1194 | EOF | |
1195 | } | |
1196 | sub obj2bin { | |
1197 | my %args = @_; | |
9dd4ed28 RL |
1198 | my $bin = platform->bin($args{bin}); |
1199 | my $objs = join(" ", map { platform->obj($_) } @{$args{objs}}); | |
1200 | my $deps = join(" ", compute_lib_depends(@{$args{deps}})); | |
47eeaf45 RL |
1201 | my @linkdirs = (); |
1202 | foreach (@{args{deps}}) { | |
1203 | next if $_ =~ /\.a$/; | |
1204 | my $d = dirname($_); | |
1205 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
1206 | } | |
1207 | my $linkflags = join("", map { "-L$_ " } @linkdirs); | |
dff29813 | 1208 | my $linklibs = join("", map { if ($_ =~ m/\.a$/) { |
9dd4ed28 | 1209 | " ".platform->staticlib($_); |
186a31e5 | 1210 | } else { |
186a31e5 | 1211 | my $f = basename($_); |
186a31e5 | 1212 | (my $l = $f) =~ s/^lib//; |
47eeaf45 | 1213 | " -l$l" |
186a31e5 RL |
1214 | } |
1215 | } @{$args{deps}}); | |
81183680 | 1216 | my $cmd = '$(CC)'; |
722c9762 | 1217 | my $cmdflags = '$(BIN_CFLAGS)'; |
81183680 RL |
1218 | if (grep /_cc\.o$/, @{$args{objs}}) { |
1219 | $cmd = '$(CXX)'; | |
722c9762 | 1220 | $cmdflags = '$(BIN_CXXFLAGS)'; |
7763472f | 1221 | } |
567a9e6f | 1222 | return <<"EOF"; |
9dd4ed28 RL |
1223 | $bin: $objs $deps |
1224 | rm -f $bin | |
722c9762 | 1225 | \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\ |
9dd4ed28 | 1226 | -o $bin $objs \\ |
150624bc | 1227 | $linklibs \$(BIN_EX_LIBS) |
567a9e6f RL |
1228 | EOF |
1229 | } | |
1230 | sub in2script { | |
1231 | my %args = @_; | |
1232 | my $script = $args{script}; | |
1233 | my $sources = join(" ", @{$args{sources}}); | |
1234 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
1235 | "util", "dofile.pl")), | |
1236 | rel2abs($config{builddir})); | |
1237 | return <<"EOF"; | |
88297284 | 1238 | $script: $sources |
4b799cea | 1239 | \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ |
ba327ade | 1240 | "-o$target{build_file}" $sources > "$script" |
567a9e6f | 1241 | chmod a+x $script |
0ad1d94d RL |
1242 | EOF |
1243 | } | |
1244 | sub generatedir { | |
1245 | my %args = @_; | |
1246 | my $dir = $args{dir}; | |
9dd4ed28 | 1247 | my @deps = map { platform->convertext($_) } @{$args{deps}}; |
0ad1d94d | 1248 | my @actions = (); |
9dd4ed28 RL |
1249 | my %extinfo = ( dso => platform->dsoext(), |
1250 | lib => platform->libext(), | |
1251 | bin => platform->binext() ); | |
0ad1d94d | 1252 | |
b6e66075 RL |
1253 | # We already have a 'test' target, and the top directory is just plain |
1254 | # silly | |
1255 | return if $dir eq "test" || $dir eq "."; | |
1256 | ||
0ad1d94d RL |
1257 | foreach my $type (("dso", "lib", "bin", "script")) { |
1258 | next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type}); | |
850000aa RL |
1259 | # For lib object files, we could update the library. However, it |
1260 | # was decided that it's enough to build the directory local object | |
1261 | # files, so we don't need to add any actions, and the dependencies | |
1262 | # are already taken care of. | |
1263 | if ($type ne "lib") { | |
0ad1d94d RL |
1264 | foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { |
1265 | if (dirname($prod) eq $dir) { | |
1266 | push @deps, $prod.$extinfo{$type}; | |
1267 | } else { | |
1268 | push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}}); | |
1269 | } | |
1270 | } | |
1271 | } | |
1272 | } | |
1273 | ||
1274 | my $deps = join(" ", @deps); | |
1275 | my $actions = join("\n", "", @actions); | |
1276 | return <<"EOF"; | |
b6e66075 | 1277 | $dir $dir/: $deps$actions |
567a9e6f RL |
1278 | EOF |
1279 | } | |
1280 | "" # Important! This becomes part of the template result. | |
1281 | -} |