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