]>
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 | } | |
c00d9311 RL |
23 | |
24 | our $COLUMNS = $ENV{COLUMNS}; | |
25 | if ($COLUMNS =~ /^\d+$/) { | |
26 | $COLUMNS = int($COLUMNS) - 2; # 2 to leave space for ending ' \' | |
27 | } else { | |
28 | $COLUMNS = 76; | |
29 | } | |
30 | ||
31 | sub fill_lines { | |
32 | my $item_sep = shift; # string | |
33 | my $line_length = shift; # number of chars | |
34 | ||
35 | my @result = (); | |
36 | my $resultpos = 0; | |
37 | ||
38 | foreach (@_) { | |
39 | my $fill_line = $result[$resultpos] // ''; | |
40 | my $newline = | |
41 | ($fill_line eq '' ? '' : $fill_line . $item_sep) . $_; | |
42 | ||
43 | if (length($newline) > $line_length) { | |
44 | # If this is a single item and the intended result line | |
45 | # is empty, we put it there anyway | |
46 | if ($fill_line eq '') { | |
47 | $result[$resultpos++] = $newline; | |
48 | } else { | |
49 | $result[++$resultpos] = $_; | |
50 | } | |
51 | } else { | |
52 | $result[$resultpos] = $newline; | |
53 | } | |
54 | } | |
55 | return @result; | |
56 | } | |
834aae2a | 57 | ''; |
567a9e6f RL |
58 | -} |
59 | PLATFORM={- $config{target} -} | |
60 | OPTIONS={- $config{options} -} | |
61 | CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) | |
62 | SRCDIR={- $config{sourcedir} -} | |
63 | BLDDIR={- $config{builddir} -} | |
31214258 | 64 | FIPSKEY={- $config{FIPSKEY} -} |
567a9e6f | 65 | |
16942e08 | 66 | VERSION={- "$config{full_version}" -} |
567a9e6f RL |
67 | MAJOR={- $config{major} -} |
68 | MINOR={- $config{minor} -} | |
3a63dbef | 69 | SHLIB_VERSION_NUMBER={- $config{shlib_version} -} |
567a9e6f | 70 | SHLIB_TARGET={- $target{shared_target} -} |
9dd4ed28 | 71 | |
c00d9311 RL |
72 | LIBS={- join(" \\\n" . ' ' x 5, |
73 | fill_lines(" ", $COLUMNS - 5, | |
74 | map { platform->staticlib($_) // () } | |
75 | @{$unified_info{libraries}})) -} | |
76 | SHLIBS={- join(" \\\n" . ' ' x 7, | |
77 | fill_lines(" ", $COLUMNS - 7, | |
78 | map { platform->sharedlib($_) // () } | |
79 | @{$unified_info{libraries}})) -} | |
80 | SHLIB_INFO={- join(" \\\n" . ' ' x 11, | |
81 | fill_lines(" ", $COLUMNS - 11, | |
82 | map { my $x = platform->sharedlib($_); | |
ef161e7b RL |
83 | my $y = platform->sharedlib_simple($_) // ''; |
84 | my $z = platform->sharedlib_import($_) // ''; | |
85 | $x ? "\"$x;$y;$z\"" : () } | |
c00d9311 RL |
86 | @{$unified_info{libraries}})) -} |
87 | MODULES={- join(" \\\n" . ' ' x 8, | |
88 | fill_lines(" ", $COLUMNS - 8, | |
89 | map { platform->dso($_) } | |
90 | @{$unified_info{modules}})) -} | |
a1bfcb15 RL |
91 | FIPSMODULENAME={- # We do some extra checking here, as there should be only one |
92 | my @fipsmodules = | |
93 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
94 | && $unified_info{attributes}->{modules}->{$_}->{fips} } | |
95 | @{$unified_info{modules}}; | |
96 | die "More that one FIPS module" if scalar @fipsmodules > 1; | |
97 | join(" ", map { basename platform->dso($_) } @fipsmodules) -} | |
98 | ||
c00d9311 RL |
99 | PROGRAMS={- join(" \\\n" . ' ' x 9, |
100 | fill_lines(" ", $COLUMNS - 9, | |
101 | map { platform->bin($_) } | |
102 | @{$unified_info{programs}})) -} | |
103 | SCRIPTS={- join(" \\\n" . ' ' x 8, | |
104 | fill_lines(" ", $COLUMNS - 8, @{$unified_info{scripts}})) -} | |
29eed3dd | 105 | {- output_off() if $disabled{makedepend}; "" -} |
c00d9311 RL |
106 | DEPS={- join(" \\\n" . ' ' x 5, |
107 | fill_lines(" ", $COLUMNS - 5, | |
108 | map { platform->isobj($_) ? platform->dep($_) : () } | |
109 | grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } | |
110 | keys %{$unified_info{sources}})); -} | |
29eed3dd | 111 | {- output_on() if $disabled{makedepend}; "" -} |
c00d9311 RL |
112 | GENERATED_MANDATORY={- join(" \\\n" . ' ' x 20, |
113 | fill_lines(" ", $COLUMNS - 20, | |
114 | @{$unified_info{depends}->{""}})) -} | |
9ca08f91 RL |
115 | GENERATED_PODS={- # common0.tmpl provides @generated |
116 | join(" \\\n" . ' ' x 15, | |
117 | fill_lines(" ", $COLUMNS - 15, | |
118 | map { my $x = $_; | |
119 | ( | |
120 | grep { | |
121 | $unified_info{attributes}->{depends} | |
122 | ->{$x}->{$_}->{pod} // 0 | |
123 | } | |
124 | keys %{$unified_info{attributes}->{depends}->{$x}} | |
125 | ) ? $x : (); | |
126 | } | |
127 | @generated)) -} | |
8258975c | 128 | GENERATED={- # common0.tmpl provides @generated |
c00d9311 RL |
129 | join(" \\\n" . ' ' x 5, |
130 | fill_lines(" ", $COLUMNS - 5, | |
131 | map { platform->convertext($_) } @generated )) -} | |
9dd4ed28 | 132 | |
ac6bba6f | 133 | INSTALL_LIBS={- |
c00d9311 RL |
134 | join(" \\\n" . ' ' x 13, |
135 | fill_lines(" ", $COLUMNS - 13, | |
136 | map { platform->staticlib($_) // () } | |
137 | grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } | |
138 | @{$unified_info{libraries}})) | |
ac6bba6f RL |
139 | -} |
140 | INSTALL_SHLIBS={- | |
c00d9311 RL |
141 | join(" \\\n" . ' ' x 15, |
142 | fill_lines(" ", $COLUMNS - 15, | |
143 | map { platform->sharedlib($_) // () } | |
144 | grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } | |
145 | @{$unified_info{libraries}})) | |
ac6bba6f RL |
146 | -} |
147 | INSTALL_SHLIB_INFO={- | |
c00d9311 RL |
148 | join(" \\\n" . ' ' x 19, |
149 | fill_lines(" ", $COLUMNS - 19, | |
150 | map { my $x = platform->sharedlib($_); | |
ef161e7b RL |
151 | my $y = platform->sharedlib_simple($_) // ''; |
152 | my $z = platform->sharedlib_import($_) // ''; | |
153 | $x ? "\"$x;$y;$z\"" : () } | |
c00d9311 RL |
154 | grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } |
155 | @{$unified_info{libraries}})) | |
ac6bba6f RL |
156 | -} |
157 | INSTALL_ENGINES={- | |
c00d9311 RL |
158 | join(" \\\n" . ' ' x 16, |
159 | fill_lines(" ", $COLUMNS - 16, | |
160 | map { platform->dso($_) } | |
161 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
162 | && $unified_info{attributes}->{modules}->{$_}->{engine} } | |
163 | @{$unified_info{modules}})) | |
ac6bba6f | 164 | -} |
32a5dc9e | 165 | INSTALL_MODULES={- |
41149648 RL |
166 | join(" \\\n" . ' ' x 16, |
167 | fill_lines(" ", $COLUMNS - 16, | |
168 | map { platform->dso($_) } | |
169 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
170 | && !$unified_info{attributes}->{modules}->{$_}->{engine} } | |
171 | @{$unified_info{modules}})) | |
172 | -} | |
ac6bba6f | 173 | INSTALL_PROGRAMS={- |
c00d9311 RL |
174 | join(" \\\n" . ' ' x 16, |
175 | fill_lines(" ", $COLUMNS - 16, map { platform->bin($_) } | |
176 | grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} } | |
177 | @{$unified_info{programs}})) | |
ac6bba6f | 178 | -} |
994e86a9 | 179 | BIN_SCRIPTS={- |
c00d9311 RL |
180 | join(" \\\n" . ' ' x 12, |
181 | fill_lines(" ", $COLUMNS - 12, | |
182 | map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname}; | |
183 | $x ? "$_:$x" : $_ } | |
184 | grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} | |
185 | && !$unified_info{attributes}->{scripts}->{$_}->{misc} } | |
186 | @{$unified_info{scripts}})) | |
994e86a9 RL |
187 | -} |
188 | MISC_SCRIPTS={- | |
c00d9311 RL |
189 | join(" \\\n" . ' ' x 13, |
190 | fill_lines(" ", $COLUMNS - 13, | |
191 | map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname}; | |
192 | $x ? "$_:$x" : $_ } | |
193 | grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} | |
194 | && $unified_info{attributes}->{scripts}->{$_}->{misc} } | |
195 | @{$unified_info{scripts}})) | |
994e86a9 | 196 | -} |
b0940b33 RL |
197 | HTMLDOCS1={- |
198 | join(" \\\n" . ' ' x 10, | |
f6f159e7 | 199 | fill_lines(" ", $COLUMNS - 10, |
b0940b33 RL |
200 | @{$unified_info{htmldocs}->{man1}})) -} |
201 | HTMLDOCS3={- | |
202 | join(" \\\n" . ' ' x 10, | |
f6f159e7 | 203 | fill_lines(" ", $COLUMNS - 10, |
b0940b33 RL |
204 | @{$unified_info{htmldocs}->{man3}})) -} |
205 | HTMLDOCS5={- | |
206 | join(" \\\n" . ' ' x 10, | |
f6f159e7 | 207 | fill_lines(" ", $COLUMNS - 10, |
b0940b33 RL |
208 | @{$unified_info{htmldocs}->{man5}})) -} |
209 | HTMLDOCS7={- | |
210 | join(" \\\n" . ' ' x 10, | |
f6f159e7 | 211 | fill_lines(" ", $COLUMNS - 10, |
b0940b33 RL |
212 | @{$unified_info{htmldocs}->{man7}})) -} |
213 | MANDOCS1={- | |
214 | join(" \\\n" . ' ' x 9, | |
f6f159e7 | 215 | fill_lines(" ", $COLUMNS - 9, |
b0940b33 RL |
216 | @{$unified_info{mandocs}->{man1}})) -} |
217 | MANDOCS3={- | |
218 | join(" \\\n" . ' ' x 9, | |
f6f159e7 | 219 | fill_lines(" ", $COLUMNS - 9, |
b0940b33 RL |
220 | @{$unified_info{mandocs}->{man3}})) -} |
221 | MANDOCS5={- | |
222 | join(" \\\n" . ' ' x 9, | |
f6f159e7 | 223 | fill_lines(" ", $COLUMNS - 9, |
b0940b33 RL |
224 | @{$unified_info{mandocs}->{man5}})) -} |
225 | MANDOCS7={- | |
226 | join(" \\\n" . ' ' x 9, | |
f6f159e7 | 227 | fill_lines(" ", $COLUMNS - 9, |
b0940b33 | 228 | @{$unified_info{mandocs}->{man7}})) -} |
567a9e6f | 229 | |
a3f1fc25 RL |
230 | APPS_OPENSSL="{- use File::Spec::Functions; |
231 | catfile("apps","openssl") -}" | |
6a74806e | 232 | |
3c65577f RL |
233 | # DESTDIR is for package builders so that they can configure for, say, |
234 | # /usr/ and yet have everything installed to /tmp/somedir/usr/. | |
567a9e6f | 235 | # Normally it is left empty. |
3c65577f | 236 | DESTDIR= |
567a9e6f RL |
237 | |
238 | # Do not edit these manually. Use Configure with --prefix or --openssldir | |
239 | # to change this! Short explanation in the top comment in Configure | |
240 | INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet | |
241 | # | |
242 | our $prefix = $config{prefix} || "/usr/local"; | |
243 | $prefix -} | |
244 | OPENSSLDIR={- # | |
245 | # The logic here is that if no --openssldir was given, | |
246 | # OPENSSLDIR will get the value from $prefix plus "/ssl". | |
247 | # If --openssldir was given and the value is an absolute | |
248 | # path, OPENSSLDIR will get its value without change. | |
249 | # If the value from --openssldir is a relative path, | |
250 | # OPENSSLDIR will get $prefix with the --openssldir | |
251 | # value appended as a subdirectory. | |
252 | # | |
253 | use File::Spec::Functions; | |
254 | our $openssldir = | |
255 | $config{openssldir} ? | |
256 | (file_name_is_absolute($config{openssldir}) ? | |
257 | $config{openssldir} | |
258 | : catdir($prefix, $config{openssldir})) | |
259 | : catdir($prefix, "ssl"); | |
260 | $openssldir -} | |
e454f3ad RL |
261 | LIBDIR={- our $libdir = $config{libdir}; |
262 | unless ($libdir) { | |
263 | # | |
264 | # if $prefix/lib$target{multilib} is not an existing | |
265 | # directory, then assume that it's not searched by linker | |
266 | # automatically, in which case adding $target{multilib} suffix | |
267 | # causes more grief than we're ready to tolerate, so don't... | |
268 | our $multilib = | |
269 | -d "$prefix/lib$target{multilib}" ? $target{multilib} : ""; | |
270 | $libdir = "lib$multilib"; | |
271 | } | |
272 | file_name_is_absolute($libdir) ? "" : $libdir -} | |
273 | # $(libdir) is chosen to be compatible with the GNU coding standards | |
274 | libdir={- file_name_is_absolute($libdir) | |
275 | ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -} | |
276 | ENGINESDIR=$(libdir)/engines-{- $sover_dirname -} | |
3f4e8d66 | 277 | MODULESDIR=$(libdir)/ossl-modules |
567a9e6f | 278 | |
fad599f7 RL |
279 | # Convenience variable for those who want to set the rpath in shared |
280 | # libraries and applications | |
e454f3ad | 281 | LIBRPATH=$(libdir) |
fad599f7 | 282 | |
dde10ab4 | 283 | MANDIR=$(INSTALLTOP)/share/man |
8be7bdb5 RL |
284 | DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME) |
285 | HTMLDIR=$(DOCDIR)/html | |
567a9e6f | 286 | |
3544091a RL |
287 | # MANSUFFIX is for the benefit of anyone who may want to have a suffix |
288 | # appended after the manpage file section number. "ssl" is popular, | |
289 | # resulting in files such as config.5ssl rather than config.5. | |
290 | MANSUFFIX= | |
567a9e6f RL |
291 | HTMLSUFFIX=html |
292 | ||
5407338a RS |
293 | # For "optional" echo messages, to get "real" silence |
294 | ECHO = echo | |
567a9e6f | 295 | |
abe256e7 RL |
296 | ##### User defined commands and flags ################################ |
297 | ||
298 | # We let the C compiler driver to take care of .s files. This is done in | |
299 | # order to be excused from maintaining a separate set of architecture | |
300 | # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC | |
301 | # gcc, then the driver will automatically translate it to -xarch=v8plus | |
302 | # and pass it down to assembler. In any case, we do not define AS or | |
303 | # ASFLAGS for this reason. | |
304 | ||
305 | CROSS_COMPILE={- $config{CROSS_COMPILE} -} | |
306 | CC=$(CROSS_COMPILE){- $config{CC} -} | |
307 | CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -} | |
308 | CPPFLAGS={- our $cppflags1 = join(" ", | |
309 | (map { "-D".$_} @{$config{CPPDEFINES}}), | |
310 | (map { "-I".$_} @{$config{CPPINCLUDES}}), | |
311 | @{$config{CPPFLAGS}}) -} | |
312 | CFLAGS={- join(' ', @{$config{CFLAGS}}) -} | |
313 | CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -} | |
314 | LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -} | |
315 | EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -} | |
316 | ||
317 | MAKEDEPEND={- $config{makedepprog} -} | |
567a9e6f | 318 | |
9e265322 | 319 | PERL={- $config{PERL} -} |
567a9e6f | 320 | |
abe256e7 RL |
321 | AR=$(CROSS_COMPILE){- $config{AR} -} |
322 | ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -} | |
323 | RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -} | |
324 | RC= $(CROSS_COMPILE){- $config{RC} -} | |
325 | RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -} | |
326 | ||
567a9e6f | 327 | RM= rm -f |
98e5534e | 328 | RMDIR= rmdir |
abe256e7 RL |
329 | TAR= {- $target{TAR} || "tar" -} |
330 | TARFLAGS= {- $target{TARFLAGS} -} | |
567a9e6f RL |
331 | |
332 | BASENAME= openssl | |
333 | NAME= $(BASENAME)-$(VERSION) | |
b741f153 | 334 | # Relative to $(SRCDIR) |
567a9e6f RL |
335 | TARFILE= ../$(NAME).tar |
336 | ||
abe256e7 RL |
337 | ##### Project flags ################################################## |
338 | ||
339 | # Variables starting with CNF_ are common variables for all product types | |
340 | ||
341 | CNF_CPPFLAGS={- our $cppflags2 = | |
342 | join(' ', $target{cppflags} || (), | |
343 | (map { "-D".$_} @{$target{defines}}, | |
344 | @{$config{defines}}), | |
345 | (map { "-I".$_} @{$target{includes}}, | |
346 | @{$config{includes}}), | |
347 | @{$config{cppflags}}) -} | |
348 | CNF_CFLAGS={- join(' ', $target{cflags} || (), | |
349 | @{$config{cflags}}) -} | |
350 | CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (), | |
351 | @{$config{cxxflags}}) -} | |
352 | CNF_LDFLAGS={- join(' ', $target{lflags} || (), | |
353 | @{$config{lflags}}) -} | |
354 | CNF_EX_LIBS={- join(' ', $target{ex_libs} || (), | |
355 | @{$config{ex_libs}}) -} | |
356 | ||
357 | # Variables starting with LIB_ are used to build library object files | |
358 | # and shared libraries. | |
359 | # Variables starting with DSO_ are used to build DSOs and their object files. | |
360 | # Variables starting with BIN_ are used to build programs and their object | |
361 | # files. | |
362 | ||
58d6be5b RL |
363 | LIB_CPPFLAGS={- our $lib_cppflags = |
364 | join(' ', $target{lib_cppflags} || (), | |
abe256e7 RL |
365 | $target{shared_cppflag} || (), |
366 | (map { '-D'.$_ } | |
d368d9d2 RL |
367 | @{$target{lib_defines} || ()}, |
368 | @{$target{shared_defines} || ()}, | |
2fce15b5 RL |
369 | @{$config{lib_defines} || ()}, |
370 | @{$config{shared_defines} || ()}), | |
d368d9d2 RL |
371 | (map { '-I'.quotify1($_) } |
372 | @{$target{lib_includes}}, | |
373 | @{$target{shared_includes}}, | |
374 | @{$config{lib_includes}}, | |
375 | @{$config{shared_includes}}), | |
58d6be5b RL |
376 | @{$config{lib_cppflags}}, |
377 | @{$config{shared_cppflag}}); | |
378 | join(' ', $lib_cppflags, | |
379 | (map { '-D'.$_ } | |
abe256e7 | 380 | 'OPENSSLDIR="\"$(OPENSSLDIR)\""', |
3f4e8d66 RL |
381 | 'ENGINESDIR="\"$(ENGINESDIR)\""', |
382 | 'MODULESDIR="\"$(MODULESDIR)\""'), | |
abe256e7 RL |
383 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} |
384 | LIB_CFLAGS={- join(' ', $target{lib_cflags} || (), | |
385 | $target{shared_cflag} || (), | |
386 | @{$config{lib_cflags}}, | |
387 | @{$config{shared_cflag}}, | |
388 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
389 | LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (), | |
390 | $target{shared_cxxflag} || (), | |
391 | @{$config{lib_cxxflags}}, | |
392 | @{$config{shared_cxxflag}}, | |
393 | '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} | |
394 | LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (), | |
395 | $config{shared_ldflag} || (), | |
396 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
397 | LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
398 | DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (), | |
399 | $target{module_cppflags} || (), | |
2fce15b5 | 400 | (map { '-D'.$_ } |
d368d9d2 RL |
401 | @{$target{dso_defines}}, |
402 | @{$target{module_defines}}, | |
2fce15b5 RL |
403 | @{$config{dso_defines} || ()}, |
404 | @{$config{module_defines} || ()}), | |
d368d9d2 RL |
405 | (map { '-I'.quotify1($_) } |
406 | @{$target{dso_includes}}, | |
407 | @{$target{module_includes}}, | |
408 | @{$config{dso_includes}}, | |
409 | @{$config{module_includes}}), | |
abe256e7 RL |
410 | @{$config{dso_cppflags}}, |
411 | @{$config{module_cppflags}}, | |
412 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} | |
413 | DSO_CFLAGS={- join(' ', $target{dso_cflags} || (), | |
414 | $target{module_cflags} || (), | |
415 | @{$config{dso_cflags}}, | |
416 | @{$config{module_cflags}}, | |
417 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
418 | DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (), | |
419 | $target{module_cxxflags} || (), | |
420 | @{$config{dso_cxxflags}}, | |
421 | @{$config{module_cxxflag}}, | |
422 | '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} | |
423 | DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (), | |
424 | $target{module_ldflags} || (), | |
425 | @{$config{dso_ldflags}}, | |
426 | @{$config{module_ldflags}}, | |
427 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
428 | DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
429 | BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (), | |
2fce15b5 | 430 | (map { '-D'.$_ } @{$config{bin_defines} || ()}), |
abe256e7 RL |
431 | @{$config{bin_cppflags}}, |
432 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} | |
433 | BIN_CFLAGS={- join(' ', $target{bin_cflags} || (), | |
434 | @{$config{bin_cflags}}, | |
435 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
436 | BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (), | |
437 | @{$config{bin_cxxflags}}, | |
438 | '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} | |
439 | BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (), | |
440 | @{$config{bin_lflags}}, | |
441 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
442 | BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
443 | ||
444 | # CPPFLAGS_Q is used for one thing only: to build up buildinf.h | |
445 | CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g; | |
446 | $cppflags2 =~ s|([\\"])|\\$1|g; | |
58d6be5b RL |
447 | $lib_cppflags =~ s|([\\"])|\\$1|g; |
448 | join(' ', $lib_cppflags || (), $cppflags2 || (), | |
449 | $cppflags1 || ()) -} | |
abe256e7 | 450 | |
567a9e6f RL |
451 | PERLASM_SCHEME= {- $target{perlasm_scheme} -} |
452 | ||
453 | # For x86 assembler: Set PROCESSOR to 386 if you want to support | |
454 | # the 80386. | |
455 | PROCESSOR= {- $config{processor} -} | |
456 | ||
9c7ce40b AP |
457 | # We want error [and other] messages in English. Trouble is that make(1) |
458 | # doesn't pass macros down as environment variables unless there already | |
459 | # was corresponding variable originally set. In other words we can only | |
460 | # reassign environment variables, but not set new ones, not in portable | |
461 | # manner that is. That's why we reassign several, just to be sure... | |
462 | LC_ALL=C | |
463 | LC_MESSAGES=C | |
464 | LANG=C | |
465 | ||
567a9e6f RL |
466 | # The main targets ################################################### |
467 | ||
b0940b33 | 468 | {- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils |
27c40a93 | 469 | {- dependmagic('build_libs'); -}: build_libs_nodep |
1842f369 | 470 | {- dependmagic('build_modules'); -}: build_modules_nodep |
1e3d16b0 | 471 | {- dependmagic('build_programs'); -}: build_programs_nodep |
567a9e6f | 472 | |
9ca08f91 | 473 | build_generated_pods: $(GENERATED_PODS) |
b0940b33 RL |
474 | build_docs: build_man_docs build_html_docs |
475 | build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7) | |
476 | build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7) | |
477 | ||
27c40a93 | 478 | build_generated: $(GENERATED_MANDATORY) |
c058fcd7 | 479 | build_libs_nodep: libcrypto.pc libssl.pc openssl.pc |
1842f369 | 480 | build_modules_nodep: $(MODULES) |
1e3d16b0 RL |
481 | build_programs_nodep: $(PROGRAMS) $(SCRIPTS) |
482 | ||
483 | # Kept around for backward compatibility | |
484 | build_apps build_tests: build_programs | |
68a5f1a2 | 485 | |
9b03b91b RL |
486 | # Convenience target to prebuild all generated files, not just the mandatory |
487 | # ones | |
b0940b33 | 488 | build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs |
18d15882 AP |
489 | @ : {- output_off() if $disabled{makedepend}; "" -} |
490 | @echo "Warning: consider configuring with no-makedepend, because if" | |
491 | @echo " target system doesn't have $(PERL)," | |
492 | @echo " then make will fail..." | |
493 | @ : {- output_on() if $disabled{makedepend}; "" -} | |
9b03b91b | 494 | |
b0940b33 RL |
495 | all: build_sw build_docs |
496 | ||
1b741653 | 497 | test: tests |
1842f369 | 498 | {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils |
d90a6beb | 499 | @ : {- output_off() if $disabled{tests}; "" -} |
f0790d4d RL |
500 | ( SRCTOP=$(SRCDIR) \ |
501 | BLDTOP=$(BLDDIR) \ | |
cbece220 | 502 | PERL="$(PERL)" \ |
31214258 | 503 | FIPSKEY="$(FIPSKEY)" \ |
9dd4ed28 | 504 | EXE_EXT={- platform->binext() -} \ |
f0790d4d | 505 | $(PERL) $(SRCDIR)/test/run_tests.pl $(TESTS) ) |
d90a6beb MC |
506 | @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} |
507 | @echo "Tests are not supported with your chosen Configure options" | |
508 | @ : {- output_on() if !$disabled{tests}; "" -} | |
567a9e6f RL |
509 | |
510 | list-tests: | |
4813ad2d RL |
511 | @ : {- output_off() if $disabled{tests}; "" -} |
512 | @SRCTOP="$(SRCDIR)" \ | |
513 | $(PERL) $(SRCDIR)/test/run_tests.pl list | |
514 | @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} | |
515 | @echo "Tests are not supported with your chosen Configure options" | |
516 | @ : {- output_on() if !$disabled{tests}; "" -} | |
517 | ||
518 | install: install_sw install_ssldirs install_docs | |
519 | ||
520 | uninstall: uninstall_docs uninstall_sw | |
567a9e6f RL |
521 | |
522 | libclean: | |
f99f91f1 | 523 | @set -e; for s in $(SHLIB_INFO); do \ |
49bb4dd0 | 524 | if [ "$$s" = ";" ]; then continue; fi; \ |
f99f91f1 RL |
525 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
526 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
ef161e7b | 527 | s3=`echo "$$s" | cut -f3 -d";"`; \ |
49bb4dd0 BE |
528 | $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\ |
529 | $(RM) apps/$$s1; \ | |
530 | $(RM) test/$$s1; \ | |
531 | $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\ | |
f99f91f1 | 532 | $(RM) $$s1; \ |
ef161e7b | 533 | if [ "$$s2" != "" ]; then \ |
5407338a | 534 | $(ECHO) $(RM) $$s2; \ |
f99f91f1 RL |
535 | $(RM) $$s2; \ |
536 | fi; \ | |
ef161e7b RL |
537 | if [ "$$s3" != "" ]; then \ |
538 | $(ECHO) $(RM) $$s3; \ | |
539 | $(RM) $$s3; \ | |
540 | fi; \ | |
f99f91f1 RL |
541 | done |
542 | $(RM) $(LIBS) | |
9dd4ed28 | 543 | $(RM) *{- platform->defext() -} |
567a9e6f RL |
544 | |
545 | clean: libclean | |
b0940b33 RL |
546 | $(RM) $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7) |
547 | $(RM) $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7) | |
1842f369 | 548 | $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(SCRIPTS) |
b0a97931 | 549 | $(RM) $(GENERATED_MANDATORY) $(GENERATED) |
0ce47b35 RL |
550 | -find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -exec $(RM) {} \; |
551 | -find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -exec $(RM) {} \; | |
4813ad2d | 552 | $(RM) core |
a51f225d | 553 | $(RM) tags TAGS doc-nits cmd-nits md-nits |
d016d1ec | 554 | $(RM) -r test/test-runs |
4813ad2d | 555 | $(RM) openssl.pc libcrypto.pc libssl.pc |
0ce47b35 | 556 | -find . -type l \! -name '.*' -exec $(RM) {} \; |
4813ad2d | 557 | $(RM) $(TARFILE) |
567a9e6f | 558 | |
7cae3864 | 559 | distclean: clean |
4813ad2d RL |
560 | $(RM) configdata.pm |
561 | $(RM) Makefile | |
7cae3864 | 562 | |
f8d9d6e4 | 563 | # We check if any depfile is newer than Makefile and decide to |
a6adf099 | 564 | # concatenate only if that is true. |
ea80a25e | 565 | depend: |
29eed3dd | 566 | @: {- output_off() if $disabled{makedepend}; "" -} |
c39785d4 RL |
567 | @$(PERL) $(SRCDIR)/util/add-depends.pl {- |
568 | defined $makedepprog && $makedepprog =~ /\/makedepend/ | |
569 | ? 'makedepend' : 'gcc' -} | |
29eed3dd | 570 | @: {- output_on() if $disabled{makedepend}; "" -} |
567a9e6f RL |
571 | |
572 | # Install helper targets ############################################# | |
573 | ||
41149648 | 574 | install_sw: install_dev install_engines install_modules install_runtime |
567a9e6f | 575 | |
41149648 | 576 | uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev |
567a9e6f RL |
577 | |
578 | install_docs: install_man_docs install_html_docs | |
579 | ||
580 | uninstall_docs: uninstall_man_docs uninstall_html_docs | |
3b8033f3 | 581 | $(RM) -r $(DESTDIR)$(DOCDIR) |
567a9e6f | 582 | |
a1bfcb15 RL |
583 | install_fips: install_sw |
584 | @$(ECHO) "*** Installing FIPS module configuration" | |
585 | @$(ECHO) "fipsinstall $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf" | |
586 | @openssl fipsinstall -module $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME) \ | |
587 | -out $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf \ | |
588 | -macopt 'key:$(FIPSKEY)' | |
589 | ||
590 | uninstall_fips: uninstall_sw | |
591 | @$(ECHO) "*** Uninstalling FIPS module configuration" | |
592 | @$(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf" | |
593 | @$(RM) $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf | |
594 | ||
dde10ab4 RL |
595 | install_ssldirs: |
596 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs | |
597 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private | |
66c2eb8b | 598 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc |
4813ad2d RL |
599 | @set -e; for x in dummy $(MISC_SCRIPTS); do \ |
600 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
d8356e1b RL |
601 | x1=`echo "$$x" | cut -f1 -d:`; \ |
602 | x2=`echo "$$x" | cut -f2 -d:`; \ | |
603 | fn=`basename $$x1`; \ | |
604 | $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ | |
605 | cp $$x1 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ | |
4813ad2d RL |
606 | chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ |
607 | mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \ | |
608 | $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \ | |
d8356e1b RL |
609 | if [ "$$x1" != "$$x2" ]; then \ |
610 | ln=`basename "$$x2"`; \ | |
611 | : {- output_off() unless windowsdll(); "" -}; \ | |
612 | $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ | |
613 | cp $(DESTDIR)$(OPENSSLDIR)/misc/$$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \ | |
614 | : {- output_on() unless windowsdll(); | |
615 | output_off() if windowsdll(); "" -}; \ | |
616 | $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ | |
617 | ln -sf $$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \ | |
618 | : {- output_on() if windowsdll(); "" -}; \ | |
619 | fi; \ | |
4813ad2d | 620 | done |
5407338a | 621 | @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" |
4813ad2d RL |
622 | @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new |
623 | @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new | |
cb926df2 | 624 | @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist |
c7af65c7 | 625 | @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \ |
5407338a | 626 | $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ |
cb926df2 RL |
627 | cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ |
628 | chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ | |
629 | fi | |
5407338a | 630 | @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" |
c7af65c7 RS |
631 | @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new |
632 | @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new | |
633 | @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist | |
634 | @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \ | |
5407338a | 635 | $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ |
c7af65c7 RS |
636 | cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \ |
637 | chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \ | |
638 | fi | |
dde10ab4 | 639 | |
c1123d9f | 640 | install_dev: install_runtime_libs |
567a9e6f | 641 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
5407338a | 642 | @$(ECHO) "*** Installing development files" |
3c65577f | 643 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl |
92ebf6c4 | 644 | @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} |
5407338a | 645 | @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" |
24c4f736 RL |
646 | @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c |
647 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c | |
92ebf6c4 | 648 | @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} |
567a9e6f RL |
649 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ |
650 | $(BLDDIR)/include/openssl/*.h; do \ | |
651 | fn=`basename $$i`; \ | |
5407338a | 652 | $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
3c65577f RL |
653 | cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ |
654 | chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ | |
567a9e6f | 655 | done |
e454f3ad | 656 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir) |
0f01b7bc | 657 | @set -e; for l in $(INSTALL_LIBS); do \ |
567a9e6f | 658 | fn=`basename $$l`; \ |
e454f3ad RL |
659 | $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \ |
660 | cp $$l $(DESTDIR)$(libdir)/$$fn.new; \ | |
661 | $(RANLIB) $(DESTDIR)$(libdir)/$$fn.new; \ | |
662 | chmod 644 $(DESTDIR)$(libdir)/$$fn.new; \ | |
663 | mv -f $(DESTDIR)$(libdir)/$$fn.new \ | |
664 | $(DESTDIR)$(libdir)/$$fn; \ | |
567a9e6f | 665 | done |
84af1bae | 666 | @ : {- output_off() if $disabled{shared}; "" -} |
0f01b7bc | 667 | @set -e; for s in $(INSTALL_SHLIB_INFO); do \ |
c8c2b779 RL |
668 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
669 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
ef161e7b | 670 | s3=`echo "$$s" | cut -f3 -d";"`; \ |
d9c22dde RL |
671 | fn1=`basename "$$s1"`; \ |
672 | fn2=`basename "$$s2"`; \ | |
673 | fn3=`basename "$$s3"`; \ | |
cff89b17 | 674 | : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \ |
ef161e7b | 675 | if [ "$$fn2" != "" ]; then \ |
e454f3ad RL |
676 | $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \ |
677 | ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \ | |
567a9e6f | 678 | fi; \ |
cff89b17 | 679 | : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \ |
d9c22dde RL |
680 | if [ "$$fn3" != "" ]; then \ |
681 | $(ECHO) "install $$s3 -> $(DESTDIR)$(libdir)/$$fn3"; \ | |
682 | cp $$s3 $(DESTDIR)$(libdir)/$$fn3.new; \ | |
683 | chmod 755 $(DESTDIR)$(libdir)/$$fn3.new; \ | |
684 | mv -f $(DESTDIR)$(libdir)/$$fn3.new \ | |
685 | $(DESTDIR)$(libdir)/$$fn3; \ | |
686 | fi; \ | |
cff89b17 AP |
687 | : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \ |
688 | a=$(DESTDIR)$(libdir)/$$fn2; \ | |
689 | $(ECHO) "install $$s1 -> $$a"; \ | |
690 | if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \ | |
691 | mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \ | |
692 | cp -f $$a $$a.new; \ | |
693 | for so in `$(AR) t $$a`; do \ | |
694 | $(AR) x $$a $$so; \ | |
695 | chmod u+w $$so; \ | |
696 | strip -X32_64 -e $$so; \ | |
697 | $(AR) r $$a.new $$so; \ | |
698 | done; \ | |
699 | )); fi; \ | |
700 | $(AR) r $$a.new $$s1; \ | |
701 | mv -f $$a.new $$a; \ | |
702 | : {- output_off() if sharedaix(); output_on(); "" -}; \ | |
567a9e6f | 703 | done |
84af1bae | 704 | @ : {- output_on() if $disabled{shared}; "" -} |
e454f3ad RL |
705 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig |
706 | @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc" | |
707 | @cp libcrypto.pc $(DESTDIR)$(libdir)/pkgconfig | |
708 | @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc | |
709 | @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc" | |
710 | @cp libssl.pc $(DESTDIR)$(libdir)/pkgconfig | |
711 | @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libssl.pc | |
712 | @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc" | |
713 | @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig | |
714 | @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc | |
567a9e6f | 715 | |
c1123d9f | 716 | uninstall_dev: uninstall_runtime_libs |
5407338a | 717 | @$(ECHO) "*** Uninstalling development files" |
92ebf6c4 | 718 | @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} |
5407338a | 719 | @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" |
24c4f736 | 720 | @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c |
92ebf6c4 | 721 | @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} |
567a9e6f RL |
722 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ |
723 | $(BLDDIR)/include/openssl/*.h; do \ | |
724 | fn=`basename $$i`; \ | |
5407338a | 725 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
3c65577f | 726 | $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ |
567a9e6f | 727 | done |
98e5534e RL |
728 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl |
729 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include | |
0f01b7bc | 730 | @set -e; for l in $(INSTALL_LIBS); do \ |
567a9e6f | 731 | fn=`basename $$l`; \ |
e454f3ad RL |
732 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \ |
733 | $(RM) $(DESTDIR)$(libdir)/$$fn; \ | |
567a9e6f | 734 | done |
84af1bae | 735 | @ : {- output_off() if $disabled{shared}; "" -} |
0f01b7bc | 736 | @set -e; for s in $(INSTALL_SHLIB_INFO); do \ |
c8c2b779 RL |
737 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
738 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
ef161e7b | 739 | s3=`echo "$$s" | cut -f3 -d";"`; \ |
d9c22dde RL |
740 | fn1=`basename "$$s1"`; \ |
741 | fn2=`basename "$$s2"`; \ | |
742 | fn3=`basename "$$s3"`; \ | |
c8c2b779 | 743 | : {- output_off() if windowsdll(); "" -}; \ |
ef161e7b RL |
744 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \ |
745 | $(RM) $(DESTDIR)$(libdir)/$$fn1; \ | |
746 | if [ -n "$$fn2" ]; then \ | |
747 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ | |
748 | $(RM) $(DESTDIR)$(libdir)/$$fn2; \ | |
567a9e6f | 749 | fi; \ |
c8c2b779 | 750 | : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ |
d9c22dde RL |
751 | if [ -n "$$fn3" ]; then \ |
752 | $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn3"; \ | |
753 | $(RM) $(DESTDIR)$(libdir)/$$fn3; \ | |
754 | fi; \ | |
ce5ed82f | 755 | : {- output_on() unless windowsdll(); "" -}; \ |
567a9e6f | 756 | done |
c8cca980 | 757 | @ : {- output_on() if $disabled{shared}; "" -} |
e454f3ad RL |
758 | $(RM) $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc |
759 | $(RM) $(DESTDIR)$(libdir)/pkgconfig/libssl.pc | |
760 | $(RM) $(DESTDIR)$(libdir)/pkgconfig/openssl.pc | |
761 | -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig | |
762 | -$(RMDIR) $(DESTDIR)$(libdir) | |
567a9e6f | 763 | |
41149648 RL |
764 | _install_modules_deps: install_runtime_libs build_modules |
765 | ||
766 | install_engines: _install_modules_deps | |
567a9e6f | 767 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
b2de11c5 | 768 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/ |
41149648 | 769 | @$(ECHO) "*** Installing engines" |
0f01b7bc | 770 | @set -e; for e in dummy $(INSTALL_ENGINES); do \ |
2b364f61 | 771 | if [ "$$e" = "dummy" ]; then continue; fi; \ |
567a9e6f | 772 | fn=`basename $$e`; \ |
5407338a | 773 | $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \ |
b2de11c5 RL |
774 | cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \ |
775 | chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \ | |
776 | mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \ | |
777 | $(DESTDIR)$(ENGINESDIR)/$$fn; \ | |
567a9e6f RL |
778 | done |
779 | ||
780 | uninstall_engines: | |
41149648 | 781 | @$(ECHO) "*** Uninstalling engines" |
0f01b7bc | 782 | @set -e; for e in dummy $(INSTALL_ENGINES); do \ |
2b364f61 | 783 | if [ "$$e" = "dummy" ]; then continue; fi; \ |
567a9e6f | 784 | fn=`basename $$e`; \ |
5407338a | 785 | $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \ |
b2de11c5 | 786 | $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \ |
567a9e6f | 787 | done |
b2de11c5 | 788 | -$(RMDIR) $(DESTDIR)$(ENGINESDIR) |
567a9e6f | 789 | |
41149648 RL |
790 | install_modules: _install_modules_deps |
791 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
792 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MODULESDIR)/ | |
793 | @$(ECHO) "*** Installing modules" | |
794 | @set -e; for e in dummy $(INSTALL_MODULES); do \ | |
795 | if [ "$$e" = "dummy" ]; then continue; fi; \ | |
796 | fn=`basename $$e`; \ | |
797 | $(ECHO) "install $$e -> $(DESTDIR)$(MODULESDIR)/$$fn"; \ | |
798 | cp $$e $(DESTDIR)$(MODULESDIR)/$$fn.new; \ | |
799 | chmod 755 $(DESTDIR)$(MODULESDIR)/$$fn.new; \ | |
800 | mv -f $(DESTDIR)$(MODULESDIR)/$$fn.new \ | |
801 | $(DESTDIR)$(MODULESDIR)/$$fn; \ | |
802 | done | |
803 | ||
804 | uninstall_modules: | |
805 | @$(ECHO) "*** Uninstalling modules" | |
806 | @set -e; for e in dummy $(INSTALL_MODULES); do \ | |
807 | if [ "$$e" = "dummy" ]; then continue; fi; \ | |
808 | fn=`basename $$e`; \ | |
41149648 RL |
809 | $(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$$fn"; \ |
810 | $(RM) $(DESTDIR)$(MODULESDIR)/$$fn; \ | |
811 | done | |
812 | -$(RMDIR) $(DESTDIR)$(MODULESDIR) | |
813 | ||
c1123d9f RL |
814 | install_runtime: install_programs |
815 | ||
e8d01a60 | 816 | install_runtime_libs: build_libs |
567a9e6f | 817 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
36b53720 | 818 | @ : {- output_off() if windowsdll(); "" -} |
e454f3ad | 819 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir) |
9694ebf7 RL |
820 | @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -} |
821 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin | |
822 | @ : {- output_on() unless windowsdll(); "" -} | |
c1123d9f | 823 | @$(ECHO) "*** Installing runtime libraries" |
0f01b7bc | 824 | @set -e; for s in dummy $(INSTALL_SHLIBS); do \ |
2b364f61 | 825 | if [ "$$s" = "dummy" ]; then continue; fi; \ |
f99f91f1 | 826 | fn=`basename $$s`; \ |
36b53720 | 827 | : {- output_off() unless windowsdll(); "" -}; \ |
5407338a | 828 | $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 829 | cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
fa63e452 | 830 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
3c65577f RL |
831 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ |
832 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
36b53720 | 833 | : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \ |
e454f3ad RL |
834 | $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \ |
835 | cp $$s $(DESTDIR)$(libdir)/$$fn.new; \ | |
836 | chmod 755 $(DESTDIR)$(libdir)/$$fn.new; \ | |
837 | mv -f $(DESTDIR)$(libdir)/$$fn.new \ | |
838 | $(DESTDIR)$(libdir)/$$fn; \ | |
36b53720 | 839 | : {- output_on() if windowsdll(); "" -}; \ |
fcf80c46 | 840 | done |
c1123d9f | 841 | |
e8d01a60 | 842 | install_programs: install_runtime_libs build_programs |
c1123d9f RL |
843 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
844 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin | |
845 | @$(ECHO) "*** Installing runtime programs" | |
0f01b7bc | 846 | @set -e; for x in dummy $(INSTALL_PROGRAMS); do \ |
2b364f61 | 847 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 848 | fn=`basename $$x`; \ |
5407338a | 849 | $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f RL |
850 | cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
851 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
852 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
853 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 854 | done |
2b364f61 RL |
855 | @set -e; for x in dummy $(BIN_SCRIPTS); do \ |
856 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
567a9e6f | 857 | fn=`basename $$x`; \ |
5407338a | 858 | $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f RL |
859 | cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
860 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
861 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
862 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 863 | done |
567a9e6f | 864 | |
c1123d9f RL |
865 | uninstall_runtime: uninstall_programs uninstall_runtime_libs |
866 | ||
867 | uninstall_programs: | |
868 | @$(ECHO) "*** Uninstalling runtime programs" | |
0f01b7bc | 869 | @set -e; for x in dummy $(INSTALL_PROGRAMS); \ |
567a9e6f | 870 | do \ |
2b364f61 | 871 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 872 | fn=`basename $$x`; \ |
5407338a | 873 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 874 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ |
567a9e6f | 875 | done; |
2b364f61 | 876 | @set -e; for x in dummy $(BIN_SCRIPTS); \ |
567a9e6f | 877 | do \ |
2b364f61 | 878 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 879 | fn=`basename $$x`; \ |
5407338a | 880 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 881 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ |
567a9e6f | 882 | done |
c1123d9f RL |
883 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin |
884 | ||
885 | uninstall_runtime_libs: | |
886 | @$(ECHO) "*** Uninstalling runtime libraries" | |
b1837abd | 887 | @ : {- output_off() unless windowsdll(); "" -} |
0f01b7bc | 888 | @set -e; for s in dummy $(INSTALL_SHLIBS); do \ |
2b364f61 | 889 | if [ "$$s" = "dummy" ]; then continue; fi; \ |
f99f91f1 | 890 | fn=`basename $$s`; \ |
5407338a | 891 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 892 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ |
fcf80c46 | 893 | done |
b1837abd | 894 | @ : {- output_on() unless windowsdll(); "" -} |
567a9e6f | 895 | |
567a9e6f | 896 | |
b0940b33 | 897 | install_man_docs: build_man_docs |
567a9e6f | 898 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
b0940b33 RL |
899 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man1 |
900 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man3 | |
901 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man5 | |
902 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MANDIR)/man7 | |
5407338a | 903 | @$(ECHO) "*** Installing manpages" |
b0940b33 RL |
904 | @set -e; for x in dummy $(MANDOCS1); do \ |
905 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
906 | fn=`basename $$x`; \ | |
cf86057a SAS |
907 | $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ |
908 | cp $$x $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \ | |
d685fc7a | 909 | chmod 644 $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \ |
b0940b33 RL |
910 | done |
911 | @set -e; for x in dummy $(MANDOCS3); do \ | |
912 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
913 | fn=`basename $$x`; \ | |
cf86057a SAS |
914 | $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ |
915 | cp $$x $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \ | |
d685fc7a | 916 | chmod 644 $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \ |
b0940b33 RL |
917 | done |
918 | @set -e; for x in dummy $(MANDOCS5); do \ | |
919 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
920 | fn=`basename $$x`; \ | |
cf86057a SAS |
921 | $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ |
922 | cp $$x $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \ | |
d685fc7a | 923 | chmod 644 $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \ |
b0940b33 RL |
924 | done |
925 | @set -e; for x in dummy $(MANDOCS7); do \ | |
926 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
927 | fn=`basename $$x`; \ | |
cf86057a SAS |
928 | $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ |
929 | cp $$x $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \ | |
d685fc7a | 930 | chmod 644 $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \ |
b0940b33 | 931 | done |
567a9e6f RL |
932 | |
933 | uninstall_man_docs: | |
5407338a | 934 | @$(ECHO) "*** Uninstalling manpages" |
b0940b33 RL |
935 | @set -e; for x in dummy $(MANDOCS1); do \ |
936 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
937 | fn=`basename $$x`; \ | |
cf86057a SAS |
938 | $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ |
939 | $(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX); \ | |
b0940b33 RL |
940 | done |
941 | @set -e; for x in dummy $(MANDOCS3); do \ | |
942 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
943 | fn=`basename $$x`; \ | |
cf86057a SAS |
944 | $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ |
945 | $(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX); \ | |
b0940b33 RL |
946 | done |
947 | @set -e; for x in dummy $(MANDOCS5); do \ | |
948 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
949 | fn=`basename $$x`; \ | |
cf86057a SAS |
950 | $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ |
951 | $(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX); \ | |
b0940b33 RL |
952 | done |
953 | @set -e; for x in dummy $(MANDOCS7); do \ | |
954 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
955 | fn=`basename $$x`; \ | |
cf86057a SAS |
956 | $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ |
957 | $(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX); \ | |
b0940b33 | 958 | done |
567a9e6f | 959 | |
b0940b33 | 960 | install_html_docs: build_html_docs |
567a9e6f | 961 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
b0940b33 RL |
962 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man1 |
963 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man3 | |
964 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man5 | |
965 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(HTMLDIR)/man7 | |
5407338a | 966 | @$(ECHO) "*** Installing HTML manpages" |
b0940b33 RL |
967 | @set -e; for x in dummy $(HTMLDOCS1); do \ |
968 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
969 | fn=`basename $$x`; \ | |
970 | $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \ | |
971 | cp $$x $(DESTDIR)$(HTMLDIR)/man1/$$fn; \ | |
d685fc7a | 972 | chmod 644 $(DESTDIR)$(HTMLDIR)/man1/$$fn; \ |
b0940b33 RL |
973 | done |
974 | @set -e; for x in dummy $(HTMLDOCS3); do \ | |
975 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
976 | fn=`basename $$x`; \ | |
977 | $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \ | |
978 | cp $$x $(DESTDIR)$(HTMLDIR)/man3/$$fn; \ | |
d685fc7a | 979 | chmod 644 $(DESTDIR)$(HTMLDIR)/man3/$$fn; \ |
b0940b33 RL |
980 | done |
981 | @set -e; for x in dummy $(HTMLDOCS5); do \ | |
982 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
983 | fn=`basename $$x`; \ | |
984 | $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \ | |
985 | cp $$x $(DESTDIR)$(HTMLDIR)/man5/$$fn; \ | |
d685fc7a | 986 | chmod 644 $(DESTDIR)$(HTMLDIR)/man5/$$fn; \ |
b0940b33 RL |
987 | done |
988 | @set -e; for x in dummy $(HTMLDOCS7); do \ | |
989 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
990 | fn=`basename $$x`; \ | |
991 | $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \ | |
992 | cp $$x $(DESTDIR)$(HTMLDIR)/man7/$$fn; \ | |
d685fc7a | 993 | chmod 644 $(DESTDIR)$(HTMLDIR)/man7/$$fn; \ |
b0940b33 | 994 | done |
567a9e6f RL |
995 | |
996 | uninstall_html_docs: | |
b0940b33 RL |
997 | @$(ECHO) "*** Uninstalling HTML manpages" |
998 | @set -e; for x in dummy $(HTMLDOCS1); do \ | |
999 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1000 | fn=`basename $$x`; \ | |
1001 | $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \ | |
1002 | $(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn; \ | |
1003 | done | |
1004 | @set -e; for x in dummy $(HTMLDOCS3); do \ | |
1005 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1006 | fn=`basename $$x`; \ | |
1007 | $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \ | |
1008 | $(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn; \ | |
1009 | done | |
1010 | @set -e; for x in dummy $(HTMLDOCS5); do \ | |
1011 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1012 | fn=`basename $$x`; \ | |
1013 | $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \ | |
1014 | $(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn; \ | |
1015 | done | |
1016 | @set -e; for x in dummy $(HTMLDOCS7); do \ | |
1017 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
1018 | fn=`basename $$x`; \ | |
1019 | $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \ | |
1020 | $(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn; \ | |
1021 | done | |
567a9e6f RL |
1022 | |
1023 | # Developer targets (note: these are only available on Unix) ######### | |
1024 | ||
6bb2106e RL |
1025 | update: generate errors ordinals |
1026 | ||
b7650c67 | 1027 | generate: generate_apps generate_crypto_bn generate_crypto_objects \ |
8e32e1ab | 1028 | generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids |
567a9e6f | 1029 | |
a51f225d | 1030 | .PHONY: doc-nits cmd-nits md-nits |
9ca08f91 | 1031 | doc-nits: build_generated_pods |
1624ebdb | 1032 | $(PERL) $(SRCDIR)/util/find-doc-nits -n -l -e |
65c1f979 | 1033 | |
9ca08f91 | 1034 | cmd-nits: build_generated apps/openssl build_generated_pods |
1624ebdb | 1035 | $(PERL) $(SRCDIR)/util/find-doc-nits -c |
65718c51 | 1036 | |
a51f225d RS |
1037 | # This uses "mdl", the markdownlint application, which is written in ruby. |
1038 | # The source is at https://github.com/markdownlint/markdownlint | |
1039 | # If you have ruby installed, "gem install mdl" should work. | |
1040 | # Another option is at https://snapcraft.io/install/mdl/debian | |
1041 | # Finally, there's a Node.js version, which we haven't tried, that | |
1042 | # can be found at https://github.com/DavidAnson/markdownlint | |
1043 | md-nits: | |
9f1fe6a9 | 1044 | mdl -s util/markdownlint.rb . |
a51f225d | 1045 | |
567a9e6f RL |
1046 | # Test coverage is a good idea for the future |
1047 | #coverage: $(PROGRAMS) $(TESTPROGRAMS) | |
1048 | # ... | |
1049 | ||
567a9e6f RL |
1050 | lint: |
1051 | lint -DLINT $(INCLUDES) $(SRCS) | |
1052 | ||
9a9f8ee7 RL |
1053 | generate_apps: |
1054 | ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \ | |
1055 | < apps/openssl.cnf > apps/openssl-vms.cnf ) | |
9a9f8ee7 RL |
1056 | |
1057 | generate_crypto_bn: | |
1058 | ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h ) | |
1059 | ||
1060 | generate_crypto_objects: | |
22defb43 RS |
1061 | ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \ |
1062 | crypto/objects/objects.txt \ | |
1063 | crypto/objects/obj_mac.num \ | |
1064 | > crypto/objects/obj_mac.new && \ | |
1065 | mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num ) | |
9a9f8ee7 RL |
1066 | ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \ |
1067 | crypto/objects/objects.txt \ | |
1068 | crypto/objects/obj_mac.num \ | |
22defb43 | 1069 | > include/openssl/obj_mac.h ) |
e6f2bb66 KM |
1070 | ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \ |
1071 | include/openssl/obj_mac.h \ | |
22defb43 | 1072 | > crypto/objects/obj_dat.h ) |
9a9f8ee7 RL |
1073 | ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \ |
1074 | crypto/objects/obj_mac.num \ | |
1075 | crypto/objects/obj_xref.txt \ | |
1076 | > crypto/objects/obj_xref.h ) | |
ad16671d | 1077 | ( cd $(SRCDIR); cat crypto/objects/obj_compat.h >> include/openssl/obj_mac.h ) |
6bb2106e | 1078 | |
b7650c67 RL |
1079 | generate_crypto_conf: |
1080 | ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \ | |
1081 | > crypto/conf/conf_def.h ) | |
1082 | ||
1083 | generate_crypto_asn1: | |
1084 | ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \ | |
1085 | > crypto/asn1/charmap.h ) | |
1086 | ||
8e32e1ab RL |
1087 | generate_fuzz_oids: |
1088 | ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \ | |
1089 | crypto/objects/obj_dat.h \ | |
1090 | > fuzz/oids.txt ) | |
1091 | ||
52df25cf RS |
1092 | # Set to -force to force a rebuild |
1093 | ERROR_REBUILD= | |
567a9e6f | 1094 | errors: |
aa6cc8d3 RL |
1095 | ( b=`pwd`; set -e; cd $(SRCDIR); \ |
1096 | $(PERL) util/ck_errf.pl -strict -internal; \ | |
cb7b7275 | 1097 | $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal ) |
aa6cc8d3 | 1098 | ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \ |
52df25cf | 1099 | for E in *.ec ; do \ |
aa6cc8d3 RL |
1100 | $(PERL) ../util/ck_errf.pl -strict \ |
1101 | -conf $$E `basename $$E .ec`.c; \ | |
cb7b7275 | 1102 | $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \ |
52df25cf RS |
1103 | -conf $$E `basename $$E .ec`.c ; \ |
1104 | done ) | |
567a9e6f | 1105 | |
30699aa1 RL |
1106 | {- use File::Basename; |
1107 | ||
96296339 | 1108 | my @sslheaders_tmpl = |
30699aa1 RL |
1109 | qw( include/openssl/ssl.h |
1110 | include/openssl/ssl2.h | |
1111 | include/openssl/ssl3.h | |
1112 | include/openssl/sslerr.h | |
1113 | include/openssl/tls1.h | |
1114 | include/openssl/dtls1.h | |
f5a46ed7 RL |
1115 | include/openssl/srtp.h |
1116 | include/openssl/sslerr_legacy.h ); | |
96296339 | 1117 | my @cryptoheaders_tmpl = |
30699aa1 RL |
1118 | qw( include/internal/dso.h |
1119 | include/internal/o_dir.h | |
30699aa1 | 1120 | include/internal/err.h |
c2041da8 | 1121 | include/internal/evp.h |
16feca71 RL |
1122 | include/internal/pem.h |
1123 | include/internal/asn1.h | |
30699aa1 | 1124 | include/internal/sslconf.h ); |
96296339 | 1125 | my @cryptoskipheaders = ( @sslheaders_tmpl, |
30699aa1 RL |
1126 | qw( include/openssl/conf_api.h |
1127 | include/openssl/ebcdic.h | |
1128 | include/openssl/opensslconf.h | |
1129 | include/openssl/symhacks.h ) ); | |
5d942028 RL |
1130 | our %cryptoheaders = (); |
1131 | our %sslheaders = (); | |
96296339 RL |
1132 | foreach my $d ( qw( include/openssl include/internal ) ) { |
1133 | my @header_patterns = | |
1134 | map { catfile($config{sourcedir}, $d, $_) } ( '*.h', '*.h.in' ); | |
1135 | foreach my $f ( map { glob($_) } @header_patterns ) { | |
1136 | my $base = basename($f); | |
1137 | my $base_in = basename($f, '.in'); | |
1138 | my $dir = catfile($config{sourcedir}, $d); | |
1139 | if ($base ne $base_in) { | |
1140 | # We have a .h.in file, which means the header file is in the | |
1141 | # build tree. | |
1142 | $base = $base_in; | |
1143 | $dir = catfile($config{builddir}, $d); | |
1144 | } | |
1145 | my $new_f = catfile($dir, $base); | |
1146 | my $fn = "$d/$base"; | |
1147 | # The logic to add files to @cryptoheaders is a bit complex. The | |
1148 | # file to be added must be either in the public header directory | |
1149 | # or one of the pre-declared internal headers, and must under no | |
1150 | # circumstances be one of those that must be skipped. | |
5d942028 | 1151 | $cryptoheaders{$new_f} = 1 |
96296339 RL |
1152 | if (($d eq 'include/openssl' |
1153 | || ( grep { $_ eq $fn } @cryptoheaders_tmpl )) | |
1154 | && !( grep { $_ eq $fn } @cryptoskipheaders )); | |
1155 | # The logic to add files to @sslheaders is much simpler... | |
5d942028 | 1156 | $sslheaders{$new_f} = 1 if grep { $_ eq $fn } @sslheaders_tmpl; |
96296339 | 1157 | } |
30699aa1 RL |
1158 | } |
1159 | ""; | |
1160 | -} | |
c00d9311 | 1161 | CRYPTOHEADERS={- join(" \\\n" . ' ' x 14, |
5d942028 | 1162 | fill_lines(" ", $COLUMNS - 14, sort keys %cryptoheaders)) -} |
c00d9311 | 1163 | SSLHEADERS={- join(" \\\n" . ' ' x 11, |
5d942028 | 1164 | fill_lines(" ", $COLUMNS - 11, sort keys %sslheaders)) -} |
96296339 RL |
1165 | ordinals: build_generated |
1166 | $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \ | |
1167 | --ordinals $(SRCDIR)/util/libcrypto.num \ | |
1168 | --symhacks $(SRCDIR)/include/openssl/symhacks.h \ | |
1169 | $(CRYPTOHEADERS) | |
1170 | $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \ | |
1171 | --ordinals $(SRCDIR)/util/libssl.num \ | |
1172 | --symhacks $(SRCDIR)/include/openssl/symhacks.h \ | |
1173 | $(SSLHEADERS) | |
567a9e6f RL |
1174 | |
1175 | test_ordinals: | |
1176 | ( cd test; \ | |
1177 | SRCTOP=../$(SRCDIR) \ | |
1178 | BLDTOP=../$(BLDDIR) \ | |
1179 | $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals ) | |
1180 | ||
1181 | tags TAGS: FORCE | |
1182 | rm -f TAGS tags | |
1183 | -ctags -R . | |
1184 | -etags `find . -name '*.[ch]' -o -name '*.pm'` | |
1185 | ||
1186 | # Release targets (note: only available on Unix) ##################### | |
1187 | ||
1188 | tar: | |
b741f153 | 1189 | (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)') |
567a9e6f RL |
1190 | |
1191 | # Helper targets ##################################################### | |
1192 | ||
c3845ceb | 1193 | link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl |
567a9e6f | 1194 | |
c3845ceb | 1195 | $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/wrap.pl: configdata.pm |
567a9e6f RL |
1196 | @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ |
1197 | mkdir -p "$(BLDDIR)/util"; \ | |
c3845ceb | 1198 | ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \ |
567a9e6f | 1199 | fi |
342a1a23 | 1200 | |
c058fcd7 | 1201 | FORCE: |
567a9e6f RL |
1202 | |
1203 | # Building targets ################################################### | |
1204 | ||
ef161e7b | 1205 | libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // platform->sharedlib_import($_) // () } @{$unified_info{libraries}}) -} |
567a9e6f RL |
1206 | libcrypto.pc: |
1207 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
1208 | echo 'exec_prefix=$${prefix}'; \ | |
e454f3ad RL |
1209 | if [ -n "$(LIBDIR)" ]; then \ |
1210 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
1211 | else \ | |
1212 | echo 'libdir=$(libdir)'; \ | |
1213 | fi; \ | |
567a9e6f | 1214 | echo 'includedir=$${prefix}/include'; \ |
d4453024 | 1215 | echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \ |
567a9e6f RL |
1216 | echo ''; \ |
1217 | echo 'Name: OpenSSL-libcrypto'; \ | |
1218 | echo 'Description: OpenSSL cryptography library'; \ | |
1219 | echo 'Version: '$(VERSION); \ | |
1220 | echo 'Libs: -L$${libdir} -lcrypto'; \ | |
abe256e7 | 1221 | echo 'Libs.private: $(LIB_EX_LIBS)'; \ |
567a9e6f RL |
1222 | echo 'Cflags: -I$${includedir}' ) > libcrypto.pc |
1223 | ||
1224 | libssl.pc: | |
1225 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
1226 | echo 'exec_prefix=$${prefix}'; \ | |
e454f3ad RL |
1227 | if [ -n "$(LIBDIR)" ]; then \ |
1228 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
1229 | else \ | |
1230 | echo 'libdir=$(libdir)'; \ | |
1231 | fi; \ | |
567a9e6f RL |
1232 | echo 'includedir=$${prefix}/include'; \ |
1233 | echo ''; \ | |
1234 | echo 'Name: OpenSSL-libssl'; \ | |
1235 | echo 'Description: Secure Sockets Layer and cryptography libraries'; \ | |
1236 | echo 'Version: '$(VERSION); \ | |
1237 | echo 'Requires.private: libcrypto'; \ | |
1238 | echo 'Libs: -L$${libdir} -lssl'; \ | |
567a9e6f RL |
1239 | echo 'Cflags: -I$${includedir}' ) > libssl.pc |
1240 | ||
1241 | openssl.pc: | |
1242 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
1243 | echo 'exec_prefix=$${prefix}'; \ | |
e454f3ad RL |
1244 | if [ -n "$(LIBDIR)" ]; then \ |
1245 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
1246 | else \ | |
1247 | echo 'libdir=$(libdir)'; \ | |
1248 | fi; \ | |
567a9e6f RL |
1249 | echo 'includedir=$${prefix}/include'; \ |
1250 | echo ''; \ | |
1251 | echo 'Name: OpenSSL'; \ | |
1252 | echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \ | |
1253 | echo 'Version: '$(VERSION); \ | |
1254 | echo 'Requires: libssl libcrypto' ) > openssl.pc | |
1255 | ||
c00d9311 RL |
1256 | configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \ |
1257 | {- join(" \\\n" . ' ' x 15, | |
1258 | fill_lines(" ", $COLUMNS - 15, | |
1259 | @{$config{build_file_templates}}, | |
1260 | @{$config{build_infos}}, | |
1261 | @{$config{conf_files}})) -} | |
27f42b46 | 1262 | @echo "Detected changed: $?" |
a1b6933e | 1263 | $(PERL) configdata.pm -r |
567a9e6f RL |
1264 | @echo "**************************************************" |
1265 | @echo "*** ***" | |
1266 | @echo "*** Please run the same make command again ***" | |
1267 | @echo "*** ***" | |
1268 | @echo "**************************************************" | |
1269 | @false | |
1270 | ||
bf01fbbf | 1271 | reconfigure reconf: |
a1b6933e | 1272 | $(PERL) configdata.pm -r |
bf01fbbf | 1273 | |
567a9e6f RL |
1274 | {- |
1275 | use File::Basename; | |
1276 | use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; | |
cedbb146 RL |
1277 | |
1278 | # Helper function to figure out dependencies on libraries | |
1279 | # It takes a list of library names and outputs a list of dependencies | |
1280 | sub compute_lib_depends { | |
cedbb146 RL |
1281 | # Depending on shared libraries: |
1282 | # On Windows POSIX layers, we depend on {libname}.dll.a | |
1283 | # On Unix platforms, we depend on {shlibname}.so | |
ef161e7b RL |
1284 | return map { platform->sharedlib_simple($_) |
1285 | // platform->sharedlib_import($_) | |
1286 | // platform->staticlib($_) | |
1287 | } @_; | |
cedbb146 RL |
1288 | } |
1289 | ||
66ddf178 RL |
1290 | sub generatesrc { |
1291 | my %args = @_; | |
1292 | my $generator = join(" ", @{$args{generator}}); | |
8d34daf0 | 1293 | my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}}); |
d4605727 | 1294 | my $incs = join("", map { " -I".$_ } @{$args{incs}}); |
25628ab2 | 1295 | my $defs = join("", map { " -D".$_ } @{$args{defs}}); |
8d34daf0 | 1296 | my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}}); |
66ddf178 | 1297 | |
b0940b33 RL |
1298 | if ($args{src} =~ /\.html$/) { |
1299 | my $title = basename($args{src}, ".html"); | |
98706c5a | 1300 | my $pod = $args{generator}->[0]; |
b0940b33 | 1301 | return <<"EOF"; |
98706c5a | 1302 | $args{src}: $pod |
1ec45fab | 1303 | \$(PERL) \$(SRCDIR)/util/mkpod2html.pl -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc" |
b0940b33 RL |
1304 | EOF |
1305 | } elsif ($args{src} =~ /\.(\d)$/) { | |
1306 | my $section = $1; | |
1307 | my $name = uc basename($args{src}, ".$section"); | |
98706c5a | 1308 | my $pod = $args{generator}->[0]; |
b0940b33 | 1309 | return <<"EOF"; |
98706c5a | 1310 | $args{src}: $pod |
b0940b33 | 1311 | pod2man --name=$name --section=$section --center=OpenSSL \\ |
1ec45fab | 1312 | --release=\$(VERSION) $pod >\$\@ |
b0940b33 RL |
1313 | EOF |
1314 | } elsif (platform->isdef($args{src})) { | |
9dd4ed28 | 1315 | my $target = platform->def($args{src}); |
ef2dfc99 | 1316 | (my $mkdef_os = $target{shared_target}) =~ s|-shared$||; |
66a24ab8 | 1317 | my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : ''; |
9dd4ed28 | 1318 | my $ord_name = $args{generator}->[1] || $args{product}; |
ef2dfc99 | 1319 | return <<"EOF"; |
66a24ab8 RL |
1320 | $target: $args{generator}->[0] $deps \$(SRCDIR)/util/mkdef.pl |
1321 | \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $args{generator}->[0] --name $ord_name --OS $mkdef_os > $target | |
ef2dfc99 | 1322 | EOF |
9dd4ed28 | 1323 | } elsif (!platform->isasm($args{src})) { |
7cae3864 RL |
1324 | if ($args{generator}->[0] =~ m|^.*\.in$|) { |
1325 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
1326 | "util", "dofile.pl")), | |
1327 | rel2abs($config{builddir})); | |
70d96753 RL |
1328 | my @modules = ( 'configdata.pm', |
1329 | grep { $_ =~ m|\.pm$| } @{$args{deps}} ); | |
1330 | my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules; | |
1331 | @modules = map { "-M".basename($_, '.pm') } @modules; | |
1332 | my $modules = join(' ', '', sort keys %moduleincs, @modules); | |
7cae3864 | 1333 | return <<"EOF"; |
70d96753 RL |
1334 | $args{src}: $args{generator}->[0] $deps \$(BLDDIR)/configdata.pm |
1335 | \$(PERL)$modules "$dofile" "-o$target{build_file}" $generator > \$@ | |
7cae3864 RL |
1336 | EOF |
1337 | } else { | |
1338 | return <<"EOF"; | |
769777b0 | 1339 | $args{src}: $args{generator}->[0] $deps |
8d34daf0 | 1340 | \$(PERL)$generator_incs $generator > \$@ |
66ddf178 | 1341 | EOF |
7cae3864 | 1342 | } |
66ddf178 | 1343 | } else { |
593d5c2f RL |
1344 | my $cppflags = { |
1345 | shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', | |
1346 | lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', | |
1347 | dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', | |
1348 | bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' | |
1349 | } -> {$args{intent}}; | |
1350 | ||
8458f1bf | 1351 | if ($args{generator}->[0] =~ /\.pl$/) { |
593d5c2f | 1352 | $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator |
cf076a3f | 1353 | .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)'; |
8458f1bf | 1354 | } elsif ($args{generator}->[0] =~ /\.m4$/) { |
8d34daf0 | 1355 | $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >' |
8458f1bf RL |
1356 | } elsif ($args{generator}->[0] =~ /\.S$/) { |
1357 | $generator = undef; | |
1358 | } else { | |
1359 | die "Generator type for $args{src} unknown: $generator\n"; | |
1360 | } | |
1361 | ||
1362 | if (defined($generator)) { | |
66ddf178 | 1363 | return <<"EOF"; |
769777b0 | 1364 | $args{src}: $args{generator}->[0] $deps |
8458f1bf | 1365 | $generator \$@ |
66ddf178 | 1366 | EOF |
66ddf178 | 1367 | } |
8458f1bf | 1368 | return <<"EOF"; |
769777b0 | 1369 | $args{src}: $args{generator}->[0] $deps |
25628ab2 | 1370 | \$(CC) $incs $cppflags $defs -E $args{generator}->[0] | \\ |
39199fb3 | 1371 | \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@ |
8458f1bf | 1372 | EOF |
66ddf178 RL |
1373 | } |
1374 | } | |
1375 | ||
bb26842d RL |
1376 | # Should one wonder about the end of the Perl snippet, it's because this |
1377 | # second regexp eats up line endings as well, if the removed path is the | |
1378 | # last in the line. We may therefore need to put back a line ending. | |
88297284 | 1379 | sub src2obj { |
567a9e6f | 1380 | my %args = @_; |
e805c2d6 | 1381 | my $obj = platform->convertext($args{obj}); |
9dd4ed28 | 1382 | my $dep = platform->dep($args{obj}); |
a23f0316 | 1383 | my @srcs = @{$args{srcs}}; |
8458f1bf RL |
1384 | my $srcs = join(" ", @srcs); |
1385 | my $deps = join(" ", @srcs, @{$args{deps}}); | |
45502bfe | 1386 | my $incs = join("", map { " -I".$_ } @{$args{incs}}); |
25628ab2 | 1387 | my $defs = join("", map { " -D".$_ } @{$args{defs}}); |
722c9762 RL |
1388 | my $cmd; |
1389 | my $cmdflags; | |
1390 | my $cmdcompile; | |
81183680 RL |
1391 | if (grep /\.rc$/, @srcs) { |
1392 | $cmd = '$(RC)'; | |
1393 | $cmdflags = '$(RCFLAGS)'; | |
8c3bc594 | 1394 | $cmdcompile = ''; |
81183680 RL |
1395 | } elsif (grep /\.(cc|cpp)$/, @srcs) { |
1396 | $cmd = '$(CXX)'; | |
722c9762 RL |
1397 | $cmdcompile = ' -c'; |
1398 | $cmdflags = { | |
9dfc8680 | 1399 | shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)', |
722c9762 RL |
1400 | lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)', |
1401 | dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)', | |
1402 | bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)' | |
1403 | } -> {$args{intent}}; | |
7763472f | 1404 | } else { |
722c9762 RL |
1405 | $cmd = '$(CC)'; |
1406 | $cmdcompile = ' -c'; | |
1407 | $cmdflags = { | |
9dfc8680 | 1408 | shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', |
722c9762 RL |
1409 | lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', |
1410 | dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', | |
1411 | bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' | |
1412 | } -> {$args{intent}}; | |
7763472f | 1413 | } |
a23f0316 AP |
1414 | my $recipe; |
1415 | # extension-specific rules | |
1416 | if (grep /\.s$/, @srcs) { | |
1417 | $recipe .= <<"EOF"; | |
9dd4ed28 | 1418 | $obj: $deps |
a23f0316 | 1419 | $cmd $cmdflags -c -o \$\@ $srcs |
7e5b8b93 | 1420 | EOF |
a23f0316 | 1421 | } elsif (grep /\.S$/, @srcs) { |
18d15882 AP |
1422 | # Originally there was mutli-step rule with $(CC) -E file.S |
1423 | # followed by $(CC) -c file.s. It compensated for one of | |
1424 | # legacy platform compiler's inability to handle .S files. | |
1425 | # The platform is long discontinued by vendor so there is | |
1426 | # hardly a point to drag it along... | |
29eed3dd | 1427 | $recipe .= <<"EOF"; |
9dd4ed28 | 1428 | $obj: $deps |
25628ab2 | 1429 | $cmd $incs $defs $cmdflags -c -o \$\@ $srcs |
a23f0316 | 1430 | EOF |
49bb4dd0 BE |
1431 | } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/ |
1432 | && !grep /\.rc$/, @srcs) { | |
a23f0316 | 1433 | $recipe .= <<"EOF"; |
9dd4ed28 RL |
1434 | $obj: $deps |
1435 | $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs | |
1436 | \@touch $dep.tmp | |
1437 | \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\ | |
1438 | rm -f $dep.tmp; \\ | |
29b28eee | 1439 | else \\ |
9dd4ed28 | 1440 | mv $dep.tmp $dep; \\ |
987dbc7f | 1441 | fi |
29eed3dd | 1442 | EOF |
7e5b8b93 | 1443 | } else { |
29eed3dd | 1444 | $recipe .= <<"EOF"; |
9dd4ed28 | 1445 | $obj: $deps |
25628ab2 | 1446 | $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs |
567a9e6f | 1447 | EOF |
81183680 | 1448 | if (defined $makedepprog && $makedepprog =~ /\/makedepend/) { |
7e5b8b93 | 1449 | $recipe .= <<"EOF"; |
c39785d4 | 1450 | \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\ |
9dd4ed28 | 1451 | > $dep |
567a9e6f | 1452 | EOF |
7e5b8b93 | 1453 | } |
29eed3dd RL |
1454 | } |
1455 | return $recipe; | |
567a9e6f | 1456 | } |
d8cac50b | 1457 | # We *know* this routine is only called when we've configure 'shared'. |
f6196227 | 1458 | sub obj2shlib { |
567a9e6f | 1459 | my %args = @_; |
47eeaf45 | 1460 | my @linkdirs = (); |
e805c2d6 RL |
1461 | my @linklibs = (); |
1462 | foreach (@{$args{deps}}) { | |
1463 | if (platform->isstaticlib($_)) { | |
1464 | push @linklibs, platform->convertext($_); | |
1465 | } else { | |
1466 | my $d = "-L" . dirname($_); | |
1467 | my $l = basename($_); | |
1468 | $l =~ s/^lib//; | |
1469 | $l = "-l" . $l; | |
1470 | push @linklibs, $l; | |
1471 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
1472 | } | |
47eeaf45 | 1473 | } |
e805c2d6 RL |
1474 | my $linkflags = join("", map { $_." " } @linkdirs); |
1475 | my $linklibs = join("", map { $_." " } @linklibs); | |
1476 | my @objs = map { platform->convertext($_) } | |
9dd4ed28 | 1477 | grep { !platform->isdef($_) } |
ef2dfc99 | 1478 | @{$args{objs}}; |
9dd4ed28 RL |
1479 | my @defs = map { platform->def($_) } |
1480 | grep { platform->isdef($_) } | |
81183680 | 1481 | @{$args{objs}}; |
81183680 RL |
1482 | my @deps = compute_lib_depends(@{$args{deps}}); |
1483 | die "More than one exported symbol map" if scalar @defs > 1; | |
c00d9311 | 1484 | |
9dd4ed28 | 1485 | my $full = platform->sharedlib($args{lib}); |
ef161e7b RL |
1486 | # $import is for Windows and subsystems thereof, where static import |
1487 | # libraries for DLLs are a thing. On platforms that have this mechanism, | |
1488 | # $import has the name of this import library. On platforms that don't | |
1489 | # have this mechanism, $import will be |undef|. | |
1490 | my $import = platform->sharedlib_import($args{lib}); | |
1491 | # $simple is for platforms where full shared library names include the | |
1492 | # shared library version, and there's a simpler name that doesn't include | |
1493 | # that version. On such platforms, $simple has the simpler name. On | |
1494 | # other platforms, it will be |undef|. | |
1495 | my $simple = platform->sharedlib_simple($args{lib}); | |
1496 | ||
e07a7892 | 1497 | my $argfile = defined $target{shared_argfileflag} ? $full.".args" : undef; |
81183680 | 1498 | my $shared_soname = ""; |
d8cac50b | 1499 | $shared_soname .= ' '.$target{shared_sonameflag}.basename($full) |
81183680 RL |
1500 | if defined $target{shared_sonameflag}; |
1501 | my $shared_imp = ""; | |
ef161e7b RL |
1502 | $shared_imp .= ' '.$target{shared_impflag}.basename($import) |
1503 | if defined $target{shared_impflag} && defined $import; | |
81183680 | 1504 | my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); |
c00d9311 | 1505 | |
e07a7892 RL |
1506 | # There is at least one platform where the compiler-as-linker needs to |
1507 | # have one object file directly on the command line. That won't hurt | |
1508 | # any other platform, so we do that for everyone when there's an argfile | |
1509 | # to be had. This depends heavily on splice, which removes elements from | |
1510 | # the given array, and returns them so they can be captured. | |
1511 | my @argfileobjs = $argfile | |
1512 | ? splice(@objs, 1) | |
1513 | : (); | |
1514 | my $argfilecmds = $argfile | |
1515 | ? join("\n\t", map { "echo $_ >> $argfile" } @argfileobjs) | |
1516 | : undef; | |
1517 | my $argfiledeps = $argfile | |
1518 | ? join(" \\\n" . ' ' x (length($argfile) + 2), | |
1519 | fill_lines(' ', $COLUMNS - length($full) - 2, @argfileobjs)) | |
1520 | : undef; | |
1521 | my @fulldeps = (@objs, ($argfile ? $argfile : ()), @defs, @deps); | |
1522 | my @fullobjs = ( | |
1523 | @objs, | |
1524 | ($argfile ? $target{shared_argfileflag}.$argfile : ()) | |
1525 | ); | |
1526 | my $fulldeps = | |
1527 | join(" \\\n" . ' ' x (length($full) + 2), | |
1528 | fill_lines(' ', $COLUMNS - length($full) - 2, @fulldeps)); | |
1529 | my $fullobjs = | |
1530 | join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @fullobjs)); | |
c00d9311 | 1531 | |
294e3802 RL |
1532 | my $recipe = ''; |
1533 | ||
ef161e7b | 1534 | if (defined $simple) { |
294e3802 RL |
1535 | if (sharedaix()) { |
1536 | $recipe .= <<"EOF"; | |
9dd4ed28 | 1537 | $simple: $full |
9dd4ed28 RL |
1538 | rm -f $simple && \\ |
1539 | \$(AR) r $simple $full | |
cff89b17 | 1540 | EOF |
294e3802 RL |
1541 | } else { |
1542 | $recipe .= <<"EOF"; | |
1543 | $simple: $full | |
d8cac50b | 1544 | rm -f $simple && \\ |
9dd4ed28 | 1545 | ln -s $full $simple |
81183680 | 1546 | EOF |
294e3802 | 1547 | } |
9dd4ed28 | 1548 | } |
ef161e7b RL |
1549 | if (defined $import) { |
1550 | $recipe .= <<"EOF"; | |
1551 | $import: $full | |
1552 | EOF | |
1553 | } | |
9dd4ed28 | 1554 | $recipe .= <<"EOF"; |
e07a7892 | 1555 | $full: $fulldeps |
9dd4ed28 | 1556 | \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\ |
c00d9311 | 1557 | -o $full$shared_def \\ |
e07a7892 | 1558 | $fullobjs \\ |
c00d9311 | 1559 | $linklibs \$(LIB_EX_LIBS) |
9dd4ed28 RL |
1560 | EOF |
1561 | if (windowsdll()) { | |
81183680 | 1562 | $recipe .= <<"EOF"; |
9dd4ed28 | 1563 | rm -f apps/$full |
9dd4ed28 RL |
1564 | rm -f fuzz/$full |
1565 | cp -p $full apps/ | |
9dd4ed28 | 1566 | cp -p $full fuzz/ |
567a9e6f | 1567 | EOF |
f16f363a MC |
1568 | if (!$disabled{tests}) { |
1569 | $recipe .= <<"EOF"; | |
1570 | rm -f test/$full | |
1571 | cp -p $full test/ | |
1572 | EOF | |
1573 | } | |
81183680 | 1574 | } |
e07a7892 RL |
1575 | $recipe .= <<"EOF" if defined $argfile; |
1576 | $argfile: $argfiledeps | |
1577 | \$(RM) $argfile | |
1578 | $argfilecmds | |
1579 | EOF | |
9dd4ed28 | 1580 | return $recipe; |
567a9e6f | 1581 | } |
5386287c | 1582 | sub obj2dso { |
567a9e6f | 1583 | my %args = @_; |
285daccd | 1584 | my $dso = platform->dso($args{module}); |
47eeaf45 | 1585 | my @linkdirs = (); |
e805c2d6 RL |
1586 | my @linklibs = (); |
1587 | foreach (@{$args{deps}}) { | |
1588 | next unless defined $_; | |
1589 | if (platform->isstaticlib($_)) { | |
1590 | push @linklibs, platform->convertext($_); | |
1591 | } else { | |
1592 | my $d = "-L" . dirname($_); | |
1593 | my $l = basename($_); | |
1594 | $l =~ s/^lib//; | |
1595 | $l = "-l" . $l; | |
1596 | push @linklibs, $l; | |
1597 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
1598 | } | |
47eeaf45 | 1599 | } |
e805c2d6 RL |
1600 | my $linkflags = join("", map { $_." " } @linkdirs); |
1601 | my $linklibs = join("", map { $_." " } @linklibs); | |
1602 | my @objs = map { platform->convertext($_) } | |
9dd4ed28 | 1603 | grep { !platform->isdef($_) } |
29f3cfdd | 1604 | @{$args{objs}}; |
9dd4ed28 RL |
1605 | my @defs = map { platform->def($_) } |
1606 | grep { platform->isdef($_) } | |
66a24ab8 | 1607 | @{$args{objs}}; |
81183680 | 1608 | my @deps = compute_lib_depends(@{$args{deps}}); |
66a24ab8 | 1609 | my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); |
9a7319b0 MK |
1610 | # TODO(3.0): next line needs to become "less magic" (see PR #11950) |
1611 | $shared_def .= ' '.$target{shared_fipsflag} if (m/providers\/fips/ && defined $target{shared_fipsflag}); | |
c00d9311 RL |
1612 | my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs)); |
1613 | my $deps = join(" \\\n" . ' ' x (length($dso) + 2), | |
1614 | fill_lines(' ', $COLUMNS - length($dso) - 2, | |
1615 | @objs, @defs, @deps)); | |
1616 | ||
567a9e6f | 1617 | return <<"EOF"; |
9dd4ed28 | 1618 | $dso: $deps |
722c9762 | 1619 | \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\ |
c00d9311 RL |
1620 | -o $dso$shared_def \\ |
1621 | $objs \\ | |
1622 | $linklibs\$(DSO_EX_LIBS) | |
567a9e6f RL |
1623 | EOF |
1624 | } | |
1625 | sub obj2lib { | |
1626 | my %args = @_; | |
9dd4ed28 RL |
1627 | my $lib = platform->staticlib($args{lib}); |
1628 | my @objs = map { platform->obj($_) } @{$args{objs}}; | |
385deae7 | 1629 | my $deps = join(" \\\n" . ' ' x (length($lib) + 2), |
c00d9311 | 1630 | fill_lines(' ', $COLUMNS - length($lib) - 2, @objs)); |
0e60ce63 | 1631 | my $max_per_call = 500; |
385deae7 RL |
1632 | my @objs_grouped; |
1633 | push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs; | |
1634 | my $fill_lib = | |
1635 | join("\n\t", (map { "\$(AR) \$(ARFLAGS) $lib $_" } @objs_grouped)); | |
567a9e6f | 1636 | return <<"EOF"; |
385deae7 | 1637 | $lib: $deps |
0e60ce63 | 1638 | \$(RM) $lib |
385deae7 | 1639 | $fill_lib |
567a9e6f RL |
1640 | \$(RANLIB) \$\@ || echo Never mind. |
1641 | EOF | |
1642 | } | |
1643 | sub obj2bin { | |
1644 | my %args = @_; | |
9dd4ed28 | 1645 | my $bin = platform->bin($args{bin}); |
c00d9311 RL |
1646 | my @objs = map { platform->obj($_) } @{$args{objs}}; |
1647 | my @deps = compute_lib_depends(@{$args{deps}}); | |
1648 | my $objs = join(" \\\n" . ' ' x (length($bin) + 2), | |
1649 | fill_lines(' ', $COLUMNS - length($bin) - 2, @objs)); | |
47eeaf45 | 1650 | my @linkdirs = (); |
e805c2d6 RL |
1651 | my @linklibs = (); |
1652 | foreach (@{$args{deps}}) { | |
1653 | next unless defined $_; | |
1654 | if (platform->isstaticlib($_)) { | |
1655 | push @linklibs, platform->convertext($_); | |
1656 | } else { | |
1657 | my $d = "-L" . dirname($_); | |
1658 | my $l = basename($_); | |
1659 | $l =~ s/^lib//; | |
1660 | $l = "-l" . $l; | |
1661 | push @linklibs, $l; | |
1662 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
1663 | } | |
47eeaf45 | 1664 | } |
e805c2d6 RL |
1665 | my $linkflags = join("", map { $_." " } @linkdirs); |
1666 | my $linklibs = join("", map { $_." " } @linklibs); | |
81183680 | 1667 | my $cmd = '$(CC)'; |
722c9762 | 1668 | my $cmdflags = '$(BIN_CFLAGS)'; |
81183680 RL |
1669 | if (grep /_cc\.o$/, @{$args{objs}}) { |
1670 | $cmd = '$(CXX)'; | |
722c9762 | 1671 | $cmdflags = '$(BIN_CXXFLAGS)'; |
7763472f | 1672 | } |
c00d9311 RL |
1673 | |
1674 | my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs)); | |
1675 | my $deps = join(" \\\n" . ' ' x (length($bin) + 2), | |
1676 | fill_lines(' ', $COLUMNS - length($bin) - 2, | |
1677 | @objs, @deps)); | |
1678 | ||
567a9e6f | 1679 | return <<"EOF"; |
c00d9311 | 1680 | $bin: $deps |
9dd4ed28 | 1681 | rm -f $bin |
722c9762 | 1682 | \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\ |
c00d9311 RL |
1683 | -o $bin \\ |
1684 | $objs \\ | |
e805c2d6 | 1685 | $linklibs\$(BIN_EX_LIBS) |
567a9e6f RL |
1686 | EOF |
1687 | } | |
1688 | sub in2script { | |
1689 | my %args = @_; | |
1690 | my $script = $args{script}; | |
1691 | my $sources = join(" ", @{$args{sources}}); | |
1692 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
1693 | "util", "dofile.pl")), | |
1694 | rel2abs($config{builddir})); | |
1695 | return <<"EOF"; | |
88297284 | 1696 | $script: $sources |
4b799cea | 1697 | \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ |
ba327ade | 1698 | "-o$target{build_file}" $sources > "$script" |
567a9e6f | 1699 | chmod a+x $script |
0ad1d94d RL |
1700 | EOF |
1701 | } | |
1702 | sub generatedir { | |
1703 | my %args = @_; | |
1704 | my $dir = $args{dir}; | |
9dd4ed28 | 1705 | my @deps = map { platform->convertext($_) } @{$args{deps}}; |
c00d9311 | 1706 | my @comments = (); |
9dd4ed28 RL |
1707 | my %extinfo = ( dso => platform->dsoext(), |
1708 | lib => platform->libext(), | |
1709 | bin => platform->binext() ); | |
0ad1d94d | 1710 | |
b6e66075 RL |
1711 | # We already have a 'test' target, and the top directory is just plain |
1712 | # silly | |
1713 | return if $dir eq "test" || $dir eq "."; | |
1714 | ||
0ad1d94d RL |
1715 | foreach my $type (("dso", "lib", "bin", "script")) { |
1716 | next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type}); | |
850000aa RL |
1717 | # For lib object files, we could update the library. However, it |
1718 | # was decided that it's enough to build the directory local object | |
1719 | # files, so we don't need to add any actions, and the dependencies | |
1720 | # are already taken care of. | |
1721 | if ($type ne "lib") { | |
0ad1d94d RL |
1722 | foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { |
1723 | if (dirname($prod) eq $dir) { | |
1724 | push @deps, $prod.$extinfo{$type}; | |
1725 | } else { | |
c00d9311 | 1726 | push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}}); |
0ad1d94d RL |
1727 | } |
1728 | } | |
1729 | } | |
1730 | } | |
1731 | ||
c00d9311 RL |
1732 | my $target = "$dir $dir/"; |
1733 | my $deps = join(" \\\n\t", | |
1734 | fill_lines(' ', $COLUMNS - 8, @deps)); | |
1735 | my $comments = join("\n", "", @comments); | |
0ad1d94d | 1736 | return <<"EOF"; |
c00d9311 RL |
1737 | $target: \\ |
1738 | $deps$comments | |
567a9e6f RL |
1739 | EOF |
1740 | } | |
1741 | "" # Important! This becomes part of the template result. | |
1742 | -} |