]>
Commit | Line | Data |
---|---|---|
567a9e6f RL |
1 | ## |
2 | ## Makefile for OpenSSL | |
3 | ## | |
4 | ## {- join("\n## ", @autowarntext) -} | |
5 | {- | |
834aae2a BL |
6 | our $objext = $target{obj_extension} || ".o"; |
7 | our $depext = $target{dep_extension} || ".d"; | |
8 | our $exeext = $target{exe_extension} || ""; | |
9 | our $libext = $target{lib_extension} || ".a"; | |
10 | our $shlibext = $target{shared_extension} || ".so"; | |
11 | our $shlibextsimple = $target{shared_extension_simple} || ".so"; | |
12 | our $shlibextimport = $target{shared_import_extension} || ""; | |
13 | our $dsoext = $target{dso_extension} || ".so"; | |
14 | ||
567a9e6f | 15 | sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ } |
f5c174ff | 16 | |
b2de11c5 RL |
17 | our $sover = $config{target} =~ /^mingw/ |
18 | ? $config{shlib_major}."_".$config{shlib_minor} | |
19 | : $config{shlib_major}.".".$config{shlib_minor}; | |
20 | ||
f5c174ff RL |
21 | # shlib and shlib_simple both take a static library name and figure |
22 | # out what the shlib name should be. | |
23 | # | |
24 | # When OpenSSL is configured "no-shared", these functions will just | |
25 | # return empty lists, making them suitable to join(). | |
26 | # | |
27 | # With Windows DLL producers, shlib($libname) will return the shared | |
28 | # library name (which usually is different from the static library | |
29 | # name) with the default shared extension appended to it, while | |
30 | # shlib_simple($libname) will return the static library name with | |
31 | # the shared extension followed by ".a" appended to it. The former | |
32 | # result is used as the runtime shared library while the latter is | |
33 | # used as the DLL import library. | |
34 | # | |
35 | # On all Unix systems, shlib($libname) will return the library name | |
36 | # with the default shared extension, while shlib_simple($libname) | |
37 | # will return the name from shlib($libname) with any SO version number | |
38 | # removed. On some systems, they may therefore return the exact same | |
39 | # string. | |
40 | sub shlib { | |
84af1bae | 41 | return () if $disabled{shared}; |
f5c174ff | 42 | my $lib = shift; |
834aae2a | 43 | return $unified_info{sharednames}->{$lib} . $shlibext; |
f5c174ff RL |
44 | } |
45 | sub shlib_simple { | |
84af1bae | 46 | return () if $disabled{shared}; |
f5c174ff RL |
47 | |
48 | my $lib = shift; | |
49 | if (windowsdll()) { | |
834aae2a | 50 | return $lib . $shlibextimport; |
f5c174ff | 51 | } |
834aae2a | 52 | return $lib . $shlibextsimple; |
f5c174ff RL |
53 | } |
54 | ||
55 | # dso is a complement to shlib / shlib_simple that returns the | |
56 | # given libname with the simple shared extension (possible SO version | |
57 | # removed). This differs from shlib_simple() by being unconditional. | |
58 | sub dso { | |
f5c174ff RL |
59 | my $engine = shift; |
60 | ||
834aae2a | 61 | return $engine . $dsoext; |
f5c174ff | 62 | } |
27c40a93 BL |
63 | # This makes sure things get built in the order they need |
64 | # to. You're welcome. | |
65 | sub dependmagic { | |
66 | my $target = shift; | |
67 | ||
68 | return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target"; | |
69 | } | |
834aae2a | 70 | ''; |
567a9e6f RL |
71 | -} |
72 | PLATFORM={- $config{target} -} | |
73 | OPTIONS={- $config{options} -} | |
74 | CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) | |
75 | SRCDIR={- $config{sourcedir} -} | |
76 | BLDDIR={- $config{builddir} -} | |
77 | ||
78 | VERSION={- $config{version} -} | |
79 | MAJOR={- $config{major} -} | |
80 | MINOR={- $config{minor} -} | |
81 | SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -} | |
82 | SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -} | |
83 | SHLIB_MAJOR={- $config{shlib_major} -} | |
84 | SHLIB_MINOR={- $config{shlib_minor} -} | |
85 | SHLIB_TARGET={- $target{shared_target} -} | |
86 | ||
834aae2a | 87 | LIBS={- join(" ", map { $_.$libext } @{$unified_info{libraries}}) -} |
f5c174ff | 88 | SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -} |
0f01b7bc | 89 | SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -} |
f5c174ff | 90 | ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -} |
1e3d16b0 | 91 | PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{programs}}) -} |
567a9e6f | 92 | SCRIPTS={- join(" ", @{$unified_info{scripts}}) -} |
29eed3dd | 93 | {- output_off() if $disabled{makedepend}; "" -} |
834aae2a | 94 | DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; } |
c058fcd7 RL |
95 | grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } |
96 | keys %{$unified_info{sources}}); -} | |
29eed3dd | 97 | {- output_on() if $disabled{makedepend}; "" -} |
7cae3864 | 98 | GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -} |
05a7aee0 RL |
99 | GENERATED={- join(" ", |
100 | ( map { (my $x = $_) =~ s|\.S$|\.s|; $x } | |
101 | grep { defined $unified_info{generate}->{$_} } | |
102 | map { @{$unified_info{sources}->{$_}} } | |
103 | grep { /\.o$/ } keys %{$unified_info{sources}} ), | |
104 | ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -} | |
c058fcd7 | 105 | |
0f01b7bc RL |
106 | INSTALL_LIBS={- join(" ", map { $_.$libext } @{$unified_info{install}->{libraries}}) -} |
107 | INSTALL_SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{install}->{libraries}}) -} | |
108 | INSTALL_SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{install}->{libraries}}) -} | |
109 | INSTALL_ENGINES={- join(" ", map { dso($_) } @{$unified_info{install}->{engines}}) -} | |
110 | INSTALL_PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{install}->{programs}}) -} | |
df653379 | 111 | {- output_off() if $disabled{apps}; "" -} |
567a9e6f | 112 | BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash |
b8a9af68 | 113 | MISC_SCRIPTS=$(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget |
df653379 | 114 | {- output_on() if $disabled{apps}; "" -} |
567a9e6f | 115 | |
3c65577f RL |
116 | # DESTDIR is for package builders so that they can configure for, say, |
117 | # /usr/ and yet have everything installed to /tmp/somedir/usr/. | |
567a9e6f | 118 | # Normally it is left empty. |
3c65577f | 119 | DESTDIR= |
567a9e6f RL |
120 | |
121 | # Do not edit these manually. Use Configure with --prefix or --openssldir | |
122 | # to change this! Short explanation in the top comment in Configure | |
123 | INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet | |
124 | # | |
125 | our $prefix = $config{prefix} || "/usr/local"; | |
126 | $prefix -} | |
127 | OPENSSLDIR={- # | |
128 | # The logic here is that if no --openssldir was given, | |
129 | # OPENSSLDIR will get the value from $prefix plus "/ssl". | |
130 | # If --openssldir was given and the value is an absolute | |
131 | # path, OPENSSLDIR will get its value without change. | |
132 | # If the value from --openssldir is a relative path, | |
133 | # OPENSSLDIR will get $prefix with the --openssldir | |
134 | # value appended as a subdirectory. | |
135 | # | |
136 | use File::Spec::Functions; | |
137 | our $openssldir = | |
138 | $config{openssldir} ? | |
139 | (file_name_is_absolute($config{openssldir}) ? | |
140 | $config{openssldir} | |
141 | : catdir($prefix, $config{openssldir})) | |
142 | : catdir($prefix, "ssl"); | |
143 | $openssldir -} | |
144 | LIBDIR={- # | |
145 | # if $prefix/lib$target{multilib} is not an existing | |
146 | # directory, then assume that it's not searched by linker | |
147 | # automatically, in which case adding $target{multilib} suffix | |
148 | # causes more grief than we're ready to tolerate, so don't... | |
149 | our $multilib = | |
150 | -d "$prefix/lib$target{multilib}" ? $target{multilib} : ""; | |
151 | our $libdir = $config{libdir} || "lib$multilib"; | |
152 | $libdir -} | |
153 | ENGINESDIR={- use File::Spec::Functions; | |
b2de11c5 | 154 | catdir($prefix,$libdir,"engines-$sover") -} |
567a9e6f | 155 | |
dde10ab4 | 156 | MANDIR=$(INSTALLTOP)/share/man |
8be7bdb5 RL |
157 | DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME) |
158 | HTMLDIR=$(DOCDIR)/html | |
567a9e6f | 159 | |
3544091a RL |
160 | # MANSUFFIX is for the benefit of anyone who may want to have a suffix |
161 | # appended after the manpage file section number. "ssl" is popular, | |
162 | # resulting in files such as config.5ssl rather than config.5. | |
163 | MANSUFFIX= | |
567a9e6f RL |
164 | HTMLSUFFIX=html |
165 | ||
166 | ||
167 | ||
168 | CROSS_COMPILE= {- $config{cross_compile_prefix} -} | |
169 | CC= $(CROSS_COMPILE){- $target{cc} -} | |
2952b9b8 | 170 | CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -} |
076e596f | 171 | CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -} |
940a09ba RL |
172 | LDFLAGS= {- $target{lflags} -} |
173 | PLIB_LDFLAGS= {- $target{plib_lflags} -} | |
2952b9b8 | 174 | EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -} |
bbd9a50f RL |
175 | LIB_CFLAGS={- $target{shared_cflag} || "" -} |
176 | LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} | |
177 | # Unlike other OSes (like Solaris, Linux, Tru64, | |
178 | # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD | |
179 | # and FreeBSD) "demand" RPATH set on .so objects. | |
180 | # Apparently application RPATH is not global and | |
181 | # does not apply to .so linked with other .so. | |
182 | # Problem manifests itself when libssl.so fails to | |
183 | # load libcrypto.so. One can argue that we should | |
184 | # engrave this into Makefile.shared rules or into | |
185 | # BSD-* config lines above. Meanwhile let's try to | |
186 | # be cautious and pass -rpath to linker only when | |
187 | # $prefix is not /usr. | |
188 | . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$| | |
189 | ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -} | |
45502bfe | 190 | DSO_CFLAGS={- $target{shared_cflag} || "" -} |
bbd9a50f | 191 | DSO_LDFLAGS=$(LIB_LDFLAGS) |
cba792a1 | 192 | BIN_CFLAGS={- $target{bin_cflags} -} |
567a9e6f RL |
193 | |
194 | PERL={- $config{perl} -} | |
195 | ||
196 | ARFLAGS= {- $target{arflags} -} | |
197 | AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r | |
198 | RANLIB= {- $target{ranlib} -} | |
199 | NM= $(CROSS_COMPILE){- $target{nm} || "nm" -} | |
8f41ff2d RL |
200 | RCFLAGS={- $target{shared_rcflag} -} |
201 | RC= $(CROSS_COMPILE){- $target{rc} || "windres" -} | |
567a9e6f | 202 | RM= rm -f |
98e5534e | 203 | RMDIR= rmdir |
567a9e6f RL |
204 | TAR= {- $target{tar} || "tar" -} |
205 | TARFLAGS= {- $target{tarflags} -} | |
29eed3dd | 206 | MAKEDEPEND={- $config{makedepprog} -} |
567a9e6f RL |
207 | |
208 | BASENAME= openssl | |
209 | NAME= $(BASENAME)-$(VERSION) | |
210 | TARFILE= ../$(NAME).tar | |
211 | ||
212 | # We let the C compiler driver to take care of .s files. This is done in | |
213 | # order to be excused from maintaining a separate set of architecture | |
214 | # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC | |
215 | # gcc, then the driver will automatically translate it to -xarch=v8plus | |
216 | # and pass it down to assembler. | |
217 | AS=$(CC) -c | |
218 | ASFLAG=$(CFLAGS) | |
219 | PERLASM_SCHEME= {- $target{perlasm_scheme} -} | |
220 | ||
221 | # For x86 assembler: Set PROCESSOR to 386 if you want to support | |
222 | # the 80386. | |
223 | PROCESSOR= {- $config{processor} -} | |
224 | ||
9c7ce40b AP |
225 | # We want error [and other] messages in English. Trouble is that make(1) |
226 | # doesn't pass macros down as environment variables unless there already | |
227 | # was corresponding variable originally set. In other words we can only | |
228 | # reassign environment variables, but not set new ones, not in portable | |
229 | # manner that is. That's why we reassign several, just to be sure... | |
230 | LC_ALL=C | |
231 | LC_MESSAGES=C | |
232 | LANG=C | |
233 | ||
567a9e6f RL |
234 | # The main targets ################################################### |
235 | ||
1e3d16b0 | 236 | {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep link-utils |
27c40a93 BL |
237 | {- dependmagic('build_libs'); -}: build_libs_nodep |
238 | {- dependmagic('build_engines'); -}: build_engines_nodep | |
1e3d16b0 | 239 | {- dependmagic('build_programs'); -}: build_programs_nodep |
567a9e6f | 240 | |
27c40a93 | 241 | build_generated: $(GENERATED_MANDATORY) |
c058fcd7 | 242 | build_libs_nodep: libcrypto.pc libssl.pc openssl.pc |
c058fcd7 | 243 | build_engines_nodep: $(ENGINES) |
1e3d16b0 RL |
244 | build_programs_nodep: $(PROGRAMS) $(SCRIPTS) |
245 | ||
246 | # Kept around for backward compatibility | |
247 | build_apps build_tests: build_programs | |
68a5f1a2 | 248 | |
1b741653 | 249 | test: tests |
1e3d16b0 | 250 | {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils |
d90a6beb | 251 | @ : {- output_off() if $disabled{tests}; "" -} |
567a9e6f RL |
252 | ( cd test; \ |
253 | SRCTOP=../$(SRCDIR) \ | |
254 | BLDTOP=../$(BLDDIR) \ | |
cbece220 | 255 | PERL="$(PERL)" \ |
834aae2a | 256 | EXE_EXT={- $exeext -} \ |
a717738b | 257 | OPENSSL_ENGINES=../$(BLDDIR)/engines \ |
567a9e6f | 258 | $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) ) |
d90a6beb MC |
259 | @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} |
260 | @echo "Tests are not supported with your chosen Configure options" | |
261 | @ : {- output_on() if !$disabled{tests}; "" -} | |
567a9e6f RL |
262 | |
263 | list-tests: | |
4813ad2d RL |
264 | @ : {- output_off() if $disabled{tests}; "" -} |
265 | @SRCTOP="$(SRCDIR)" \ | |
266 | $(PERL) $(SRCDIR)/test/run_tests.pl list | |
267 | @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} | |
268 | @echo "Tests are not supported with your chosen Configure options" | |
269 | @ : {- output_on() if !$disabled{tests}; "" -} | |
270 | ||
271 | install: install_sw install_ssldirs install_docs | |
272 | ||
273 | uninstall: uninstall_docs uninstall_sw | |
567a9e6f RL |
274 | |
275 | libclean: | |
f99f91f1 RL |
276 | @set -e; for s in $(SHLIB_INFO); do \ |
277 | s1=`echo "$$s" | cut -f1 -d";"`; \ | |
278 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
279 | echo $(RM) $$s1; \ | |
280 | $(RM) $$s1; \ | |
281 | if [ "$$s1" != "$$s2" ]; then \ | |
282 | echo $(RM) $$s2; \ | |
283 | $(RM) $$s2; \ | |
284 | fi; \ | |
285 | done | |
286 | $(RM) $(LIBS) | |
4813ad2d | 287 | $(RM) *.map |
567a9e6f RL |
288 | |
289 | clean: libclean | |
4813ad2d RL |
290 | $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS) |
291 | $(RM) $(GENERATED) | |
292 | -$(RM) `find . -name '*{- $depext -}' -a \! -path "./.git/*"` | |
293 | -$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"` | |
294 | $(RM) core | |
295 | $(RM) tags TAGS | |
296 | $(RM) openssl.pc libcrypto.pc libssl.pc | |
297 | -$(RM) `find . -type l -a \! -path "./.git/*"` | |
298 | $(RM) $(TARFILE) | |
567a9e6f | 299 | |
7cae3864 | 300 | distclean: clean |
4813ad2d RL |
301 | $(RM) configdata.pm |
302 | $(RM) Makefile | |
7cae3864 | 303 | |
c058fcd7 | 304 | # This exists solely for those who still type 'make depend' |
f8d9d6e4 RL |
305 | # |
306 | # We check if any depfile is newer than Makefile and decide to | |
a6adf099 | 307 | # concatenate only if that is true. |
ea80a25e | 308 | depend: |
29eed3dd | 309 | @: {- output_off() if $disabled{makedepend}; "" -} |
e3d81858 | 310 | @if [ -n "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then \ |
f8d9d6e4 RL |
311 | ( sed -e '/^# DO NOT DELETE THIS LINE.*/,$$d' < Makefile; \ |
312 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \ | |
313 | echo; \ | |
a6adf099 RL |
314 | for f in $(DEPS); do \ |
315 | if [ -f $$f ]; then cat $$f; fi; \ | |
f8d9d6e4 | 316 | done ) > Makefile.new; \ |
29b28eee | 317 | if cmp Makefile.new Makefile >/dev/null 2>&1; then \ |
f8d9d6e4 | 318 | rm -f Makefile.new; \ |
29b28eee RL |
319 | else \ |
320 | mv -f Makefile.new Makefile; \ | |
f8d9d6e4 | 321 | fi; \ |
c058fcd7 | 322 | fi |
29eed3dd | 323 | @: {- output_on() if $disabled{makedepend}; "" -} |
567a9e6f RL |
324 | |
325 | # Install helper targets ############################################# | |
326 | ||
327 | install_sw: all install_dev install_engines install_runtime | |
328 | ||
f99f91f1 | 329 | uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev |
567a9e6f RL |
330 | |
331 | install_docs: install_man_docs install_html_docs | |
332 | ||
333 | uninstall_docs: uninstall_man_docs uninstall_html_docs | |
8be7bdb5 | 334 | $(RM) -r -v $(DESTDIR)$(DOCDIR) |
567a9e6f | 335 | |
dde10ab4 RL |
336 | install_ssldirs: |
337 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs | |
338 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private | |
66c2eb8b | 339 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc |
4813ad2d RL |
340 | @set -e; for x in dummy $(MISC_SCRIPTS); do \ |
341 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
342 | fn=`basename $$x`; \ | |
343 | echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ | |
344 | cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ | |
345 | chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ | |
346 | mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \ | |
347 | $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \ | |
348 | done | |
cb926df2 | 349 | @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" |
4813ad2d RL |
350 | @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new |
351 | @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new | |
cb926df2 RL |
352 | @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist |
353 | @if ! [ -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \ | |
354 | echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ | |
355 | cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ | |
356 | chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ | |
357 | fi | |
dde10ab4 | 358 | |
567a9e6f RL |
359 | install_dev: |
360 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
361 | @echo "*** Installing development files" | |
3c65577f | 362 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl |
24c4f736 RL |
363 | @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} |
364 | @echo "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" | |
365 | @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c | |
366 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c | |
367 | @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} | |
567a9e6f RL |
368 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ |
369 | $(BLDDIR)/include/openssl/*.h; do \ | |
370 | fn=`basename $$i`; \ | |
3c65577f RL |
371 | echo "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
372 | cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ | |
373 | chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ | |
567a9e6f | 374 | done |
3c65577f | 375 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) |
0f01b7bc | 376 | @set -e; for l in $(INSTALL_LIBS); do \ |
567a9e6f | 377 | fn=`basename $$l`; \ |
3c65577f RL |
378 | echo "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ |
379 | cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
380 | $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
381 | chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
382 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \ | |
383 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ | |
567a9e6f | 384 | done |
84af1bae | 385 | @ : {- output_off() if $disabled{shared}; "" -} |
0f01b7bc | 386 | @set -e; for s in $(INSTALL_SHLIB_INFO); do \ |
c8c2b779 RL |
387 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
388 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
389 | fn1=`basename $$s1`; \ | |
390 | fn2=`basename $$s2`; \ | |
391 | : {- output_off() if windowsdll(); "" -}; \ | |
392 | echo "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \ | |
393 | cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \ | |
3503549e | 394 | chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \ |
c8c2b779 RL |
395 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \ |
396 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \ | |
397 | if [ "$$fn1" != "$$fn2" ]; then \ | |
398 | echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \ | |
399 | ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ | |
567a9e6f | 400 | fi; \ |
c8c2b779 RL |
401 | : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ |
402 | echo "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \ | |
403 | cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \ | |
3503549e | 404 | chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \ |
c8c2b779 RL |
405 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \ |
406 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ | |
ce5ed82f | 407 | : {- output_on() unless windowsdll(); "" -}; \ |
567a9e6f | 408 | done |
84af1bae | 409 | @ : {- output_on() if $disabled{shared}; "" -} |
3c65577f RL |
410 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig |
411 | @echo "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc" | |
412 | @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig | |
413 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc | |
414 | @echo "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc" | |
415 | @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig | |
416 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc | |
417 | @echo "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc" | |
418 | @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig | |
419 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc | |
567a9e6f RL |
420 | |
421 | uninstall_dev: | |
422 | @echo "*** Uninstalling development files" | |
24c4f736 RL |
423 | @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} |
424 | @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" | |
425 | @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c | |
426 | @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} | |
567a9e6f RL |
427 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ |
428 | $(BLDDIR)/include/openssl/*.h; do \ | |
429 | fn=`basename $$i`; \ | |
3c65577f RL |
430 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
431 | $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ | |
567a9e6f | 432 | done |
98e5534e RL |
433 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl |
434 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include | |
0f01b7bc | 435 | @set -e; for l in $(INSTALL_LIBS); do \ |
567a9e6f | 436 | fn=`basename $$l`; \ |
3c65577f RL |
437 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ |
438 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ | |
567a9e6f | 439 | done |
84af1bae | 440 | @ : {- output_off() if $disabled{shared}; "" -} |
0f01b7bc | 441 | @set -e; for s in $(INSTALL_SHLIB_INFO); do \ |
c8c2b779 RL |
442 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
443 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
444 | fn1=`basename $$s1`; \ | |
445 | fn2=`basename $$s2`; \ | |
446 | : {- output_off() if windowsdll(); "" -}; \ | |
447 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \ | |
448 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \ | |
449 | if [ "$$fn1" != "$$fn2" ]; then \ | |
3c65577f RL |
450 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \ |
451 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ | |
567a9e6f | 452 | fi; \ |
c8c2b779 RL |
453 | : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ |
454 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \ | |
455 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ | |
ce5ed82f | 456 | : {- output_on() unless windowsdll(); "" -}; \ |
567a9e6f | 457 | done |
c8cca980 | 458 | @ : {- output_on() if $disabled{shared}; "" -} |
b894054e RL |
459 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc |
460 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc | |
461 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc | |
462 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig | |
463 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) | |
567a9e6f RL |
464 | |
465 | install_engines: | |
466 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
b2de11c5 | 467 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/ |
567a9e6f | 468 | @echo "*** Installing engines" |
0f01b7bc | 469 | @set -e; for e in dummy $(INSTALL_ENGINES); do \ |
2b364f61 | 470 | if [ "$$e" = "dummy" ]; then continue; fi; \ |
567a9e6f | 471 | fn=`basename $$e`; \ |
b2de11c5 RL |
472 | echo "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \ |
473 | cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \ | |
474 | chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \ | |
475 | mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \ | |
476 | $(DESTDIR)$(ENGINESDIR)/$$fn; \ | |
567a9e6f RL |
477 | done |
478 | ||
479 | uninstall_engines: | |
480 | @echo "*** Uninstalling engines" | |
0f01b7bc | 481 | @set -e; for e in dummy $(INSTALL_ENGINES); do \ |
2b364f61 | 482 | if [ "$$e" = "dummy" ]; then continue; fi; \ |
567a9e6f | 483 | fn=`basename $$e`; \ |
f0c93a85 RL |
484 | if [ "$$fn" = '{- dso("ossltest") -}' ]; then \ |
485 | continue; \ | |
486 | fi; \ | |
b2de11c5 RL |
487 | echo "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \ |
488 | $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \ | |
567a9e6f | 489 | done |
b2de11c5 | 490 | -$(RMDIR) $(DESTDIR)$(ENGINESDIR) |
567a9e6f RL |
491 | |
492 | install_runtime: | |
493 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
3c65577f | 494 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin |
36b53720 RL |
495 | @ : {- output_off() if windowsdll(); "" -} |
496 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) | |
497 | @ : {- output_on() if windowsdll(); "" -} | |
567a9e6f | 498 | @echo "*** Installing runtime files" |
0f01b7bc | 499 | @set -e; for s in dummy $(INSTALL_SHLIBS); do \ |
2b364f61 | 500 | if [ "$$s" = "dummy" ]; then continue; fi; \ |
f99f91f1 | 501 | fn=`basename $$s`; \ |
36b53720 | 502 | : {- output_off() unless windowsdll(); "" -}; \ |
3c65577f RL |
503 | echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
504 | cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
505 | chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
506 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
507 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
36b53720 RL |
508 | : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \ |
509 | echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ | |
510 | cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
511 | chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
512 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \ | |
513 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ | |
514 | : {- output_on() if windowsdll(); "" -}; \ | |
fcf80c46 | 515 | done |
0f01b7bc | 516 | @set -e; for x in dummy $(INSTALL_PROGRAMS); do \ |
2b364f61 | 517 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 518 | fn=`basename $$x`; \ |
3c65577f RL |
519 | echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
520 | cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
521 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
522 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
523 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 524 | done |
2b364f61 RL |
525 | @set -e; for x in dummy $(BIN_SCRIPTS); do \ |
526 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
567a9e6f | 527 | fn=`basename $$x`; \ |
3c65577f RL |
528 | echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
529 | cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
530 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
531 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
532 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 533 | done |
567a9e6f RL |
534 | |
535 | uninstall_runtime: | |
536 | @echo "*** Uninstalling runtime files" | |
0f01b7bc | 537 | @set -e; for x in dummy $(INSTALL_PROGRAMS); \ |
567a9e6f | 538 | do \ |
2b364f61 | 539 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 540 | fn=`basename $$x`; \ |
3c65577f RL |
541 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
542 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 543 | done; |
2b364f61 | 544 | @set -e; for x in dummy $(BIN_SCRIPTS); \ |
567a9e6f | 545 | do \ |
2b364f61 | 546 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 547 | fn=`basename $$x`; \ |
3c65577f RL |
548 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
549 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 550 | done |
b1837abd | 551 | @ : {- output_off() unless windowsdll(); "" -} |
0f01b7bc | 552 | @set -e; for s in dummy $(INSTALL_SHLIBS); do \ |
2b364f61 | 553 | if [ "$$s" = "dummy" ]; then continue; fi; \ |
f99f91f1 | 554 | fn=`basename $$s`; \ |
3c65577f RL |
555 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
556 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
fcf80c46 | 557 | done |
b1837abd | 558 | @ : {- output_on() unless windowsdll(); "" -} |
b894054e | 559 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin |
567a9e6f RL |
560 | |
561 | # A method to extract all names from a .pod file | |
562 | # The first sed extracts everything between "=head1 NAME" and the next =head1 | |
5287761b RL |
563 | # The perl command joins all the lines into one |
564 | # The second sed removes the description and turns all commas into spaces | |
567a9e6f RL |
565 | # Voilà , you have a space separated list of names! |
566 | EXTRACT_NAMES=sed -e '1,/^=head1 *NAME *$$/d;/^=head1/,$$d' | \ | |
5287761b | 567 | $(PERL) -p -0 -e 's/\n/ /g; END {print "\n"}' | \ |
567a9e6f RL |
568 | sed -e 's/ - .*$$//;s/,/ /g' |
569 | PROCESS_PODS=\ | |
570 | set -e; \ | |
571 | here=`cd $(SRCDIR); pwd`; \ | |
572 | point=$$here/util/point.sh; \ | |
573 | for ds in apps:1 crypto:3 ssl:3; do \ | |
574 | defdir=`echo $$ds | cut -f1 -d:`; \ | |
575 | defsec=`echo $$ds | cut -f2 -d:`; \ | |
576 | for p in $(SRCDIR)/doc/$$defdir/*.pod; do \ | |
577 | SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \ | |
578 | [ -z "$$SEC" ] && SEC=$$defsec; \ | |
579 | fn=`basename $$p .pod`; \ | |
beadb441 | 580 | Name=$$fn; \ |
567a9e6f RL |
581 | NAME=`echo $$fn | tr [a-z] [A-Z]`; \ |
582 | suf=`eval "echo $$OUTSUFFIX"`; \ | |
583 | top=`eval "echo $$OUTTOP"`; \ | |
584 | $(PERL) $(SRCDIR)/util/mkdir-p.pl $$top/man$$SEC; \ | |
585 | echo "install $$p -> $$top/man$$SEC/$$fn$$suf"; \ | |
586 | cat $$p | eval "$$GENERATE" \ | |
587 | > $$top/man$$SEC/$$fn$$suf; \ | |
588 | names=`cat $$p | $(EXTRACT_NAMES)`; \ | |
589 | ( cd $$top/man$$SEC; \ | |
590 | for n in $$names; do \ | |
3af104f3 RL |
591 | comp_n="$$n"; \ |
592 | comp_fn="$$fn"; \ | |
593 | case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \ | |
594 | comp_n=`echo "$$n" | tr [A-Z] [a-z]`; \ | |
595 | comp_fn=`echo "$$fn" | tr [A-Z] [a-z]`; \ | |
596 | ;; \ | |
597 | esac; \ | |
598 | if [ "$$comp_n" != "$$comp_fn" ]; then \ | |
567a9e6f RL |
599 | echo "link $$top/man$$SEC/$$n$$suf -> $$top/man$$SEC/$$fn$$suf"; \ |
600 | PLATFORM=$(PLATFORM) $$point $$fn$$suf $$n$$suf; \ | |
601 | fi; \ | |
602 | done ); \ | |
603 | done; \ | |
604 | done | |
605 | UNINSTALL_DOCS=\ | |
606 | set -e; \ | |
607 | here=`cd $(SRCDIR); pwd`; \ | |
608 | for ds in apps:1 crypto:3 ssl:3; do \ | |
609 | defdir=`echo $$ds | cut -f1 -d:`; \ | |
610 | defsec=`echo $$ds | cut -f2 -d:`; \ | |
611 | for p in $(SRCDIR)/doc/$$defdir/*.pod; do \ | |
612 | SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \ | |
613 | [ -z "$$SEC" ] && SEC=$$defsec; \ | |
614 | fn=`basename $$p .pod`; \ | |
615 | suf=`eval "echo $$OUTSUFFIX"`; \ | |
616 | top=`eval "echo $$OUTTOP"`; \ | |
617 | echo "$(RM) $$top/man$$SEC/$$fn$$suf"; \ | |
618 | $(RM) $$top/man$$SEC/$$fn$$suf; \ | |
619 | names=`cat $$p | $(EXTRACT_NAMES)`; \ | |
620 | for n in $$names; do \ | |
3af104f3 RL |
621 | comp_n="$$n"; \ |
622 | comp_fn="$$fn"; \ | |
623 | case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \ | |
624 | comp_n=`echo "$$n" | tr [A-Z] [a-z]`; \ | |
625 | comp_fn=`echo "$$fn" | tr [A-Z] [a-z]`; \ | |
626 | ;; \ | |
627 | esac; \ | |
628 | if [ "$$comp_n" != "$$comp_fn" ]; then \ | |
567a9e6f RL |
629 | echo "$(RM) $$top/man$$SEC/$$n$$suf"; \ |
630 | $(RM) $$top/man$$SEC/$$n$$suf; \ | |
631 | fi; \ | |
632 | done; \ | |
8be7bdb5 | 633 | ( $(RMDIR) $$top/man$$SEC 2>/dev/null || exit 0 ); \ |
567a9e6f RL |
634 | done; \ |
635 | done | |
636 | ||
637 | install_man_docs: | |
638 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
639 | @echo "*** Installing manpages" | |
640 | @\ | |
641 | OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \ | |
3c65577f | 642 | OUTTOP="$(DESTDIR)$(MANDIR)"; \ |
567a9e6f RL |
643 | GENERATE='pod2man --name=$$NAME --section=$$SEC --center=OpenSSL --release=$(VERSION)'; \ |
644 | $(PROCESS_PODS) | |
645 | ||
646 | uninstall_man_docs: | |
647 | @echo "*** Uninstalling manpages" | |
648 | @\ | |
649 | OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \ | |
3c65577f | 650 | OUTTOP="$(DESTDIR)$(MANDIR)"; \ |
567a9e6f RL |
651 | $(UNINSTALL_DOCS) |
652 | ||
653 | install_html_docs: | |
654 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
655 | @echo "*** Installing HTML manpages" | |
656 | @\ | |
657 | OUTSUFFIX='.$(HTMLSUFFIX)'; \ | |
3c65577f | 658 | OUTTOP="$(DESTDIR)$(HTMLDIR)"; \ |
567a9e6f | 659 | GENERATE="pod2html --podroot=$(SRCDIR)/doc --htmldir=.. \ |
beadb441 | 660 | --podpath=apps:crypto:ssl --title=\$$Name \ |
15a1f19e | 661 | | perl -pe 's|href=\"http://man.he.net/man|href=\"../man|g; s|href=\"(.*/man.*)(?<!\.html)\">|href=\"\$$1.html\">|g;'"; \ |
567a9e6f RL |
662 | $(PROCESS_PODS) |
663 | ||
664 | uninstall_html_docs: | |
665 | @echo "*** Uninstalling manpages" | |
666 | @\ | |
667 | OUTSUFFIX='.$(HTMLSUFFIX)'; \ | |
3c65577f | 668 | OUTTOP="$(DESTDIR)$(HTMLDIR)"; \ |
567a9e6f RL |
669 | $(UNINSTALL_DOCS) |
670 | ||
671 | ||
672 | # Developer targets (note: these are only available on Unix) ######### | |
673 | ||
6bb2106e RL |
674 | update: generate errors ordinals |
675 | ||
b7650c67 RL |
676 | generate: generate_apps generate_crypto_bn generate_crypto_objects \ |
677 | generate_crypto_conf generate_crypto_asn1 | |
567a9e6f RL |
678 | |
679 | # Test coverage is a good idea for the future | |
680 | #coverage: $(PROGRAMS) $(TESTPROGRAMS) | |
681 | # ... | |
682 | ||
567a9e6f RL |
683 | lint: |
684 | lint -DLINT $(INCLUDES) $(SRCS) | |
685 | ||
9a9f8ee7 RL |
686 | {- # because the program apps/openssl has object files as sources, and |
687 | # they then have the corresponding C files as source, we need to chain | |
688 | # the lookups in %unified_info | |
689 | my $apps_openssl = catfile("apps","openssl"); | |
690 | our @openssl_source = map { @{$unified_info{sources}->{$_}} } | |
691 | @{$unified_info{sources}->{$apps_openssl}}; | |
692 | ""; -} | |
693 | generate_apps: | |
694 | ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \ | |
695 | < apps/openssl.cnf > apps/openssl-vms.cnf ) | |
696 | ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b apps/progs.pl \ | |
697 | {- join(" ", @openssl_source) -} \ | |
698 | > apps/progs.h ) | |
699 | ||
700 | generate_crypto_bn: | |
701 | ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h ) | |
702 | ||
703 | generate_crypto_objects: | |
9a9f8ee7 RL |
704 | ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \ |
705 | crypto/objects/objects.txt \ | |
706 | crypto/objects/obj_mac.num \ | |
707 | include/openssl/obj_mac.h ) | |
e6f2bb66 KM |
708 | ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \ |
709 | include/openssl/obj_mac.h \ | |
710 | crypto/objects/obj_dat.h ) | |
9a9f8ee7 RL |
711 | ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \ |
712 | crypto/objects/obj_mac.num \ | |
713 | crypto/objects/obj_xref.txt \ | |
714 | > crypto/objects/obj_xref.h ) | |
6bb2106e | 715 | |
b7650c67 RL |
716 | generate_crypto_conf: |
717 | ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \ | |
718 | > crypto/conf/conf_def.h ) | |
719 | ||
720 | generate_crypto_asn1: | |
721 | ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \ | |
722 | > crypto/asn1/charmap.h ) | |
723 | ||
567a9e6f RL |
724 | errors: |
725 | ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c ) | |
726 | ( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write ) | |
727 | ( cd $(SRCDIR)/engines; \ | |
728 | for e in *.ec; do \ | |
729 | $(PERL) ../util/mkerr.pl -conf $$e \ | |
730 | -nostatic -staticloader -write *.c; \ | |
731 | done ) | |
567a9e6f RL |
732 | |
733 | ordinals: | |
734 | ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update ) | |
735 | ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update ) | |
736 | ||
737 | test_ordinals: | |
738 | ( cd test; \ | |
739 | SRCTOP=../$(SRCDIR) \ | |
740 | BLDTOP=../$(BLDDIR) \ | |
741 | $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals ) | |
742 | ||
743 | tags TAGS: FORCE | |
744 | rm -f TAGS tags | |
745 | -ctags -R . | |
746 | -etags `find . -name '*.[ch]' -o -name '*.pm'` | |
747 | ||
748 | # Release targets (note: only available on Unix) ##################### | |
749 | ||
a1bce642 | 750 | TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf - |
54bb8f74 | 751 | PREPARE_CMD=: |
567a9e6f RL |
752 | tar: |
753 | TMPDIR=/var/tmp/openssl-copy.$$$$; \ | |
54bb8f74 | 754 | DISTDIR=$(NAME); \ |
567a9e6f RL |
755 | mkdir -p $$TMPDIR/$$DISTDIR; \ |
756 | (cd $(SRCDIR); \ | |
757 | git ls-tree -r --name-only --full-tree HEAD \ | |
a1bce642 | 758 | | grep -v '^fuzz/corpora' \ |
567a9e6f RL |
759 | | while read F; do \ |
760 | mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \ | |
761 | cp $$F $$TMPDIR/$$DISTDIR/$$F; \ | |
762 | done); \ | |
763 | (cd $$TMPDIR; \ | |
54bb8f74 | 764 | $(PREPARE_CMD); \ |
567a9e6f RL |
765 | find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \ |
766 | find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \ | |
767 | find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \ | |
54bb8f74 | 768 | $(TAR_COMMAND) $$DISTDIR) \ |
567a9e6f RL |
769 | | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \ |
770 | rm -rf $$TMPDIR | |
771 | cd $(SRCDIR); ls -l $(TARFILE).gz | |
772 | ||
773 | dist: | |
774 | @$(MAKE) PREPARE_CMD='./Configure dist' tar | |
775 | ||
776 | # Helper targets ##################################################### | |
777 | ||
53ff6ac1 | 778 | link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/shlib_wrap.sh |
567a9e6f | 779 | |
27f42b46 | 780 | $(BLDDIR)/util/opensslwrap.sh: configdata.pm |
567a9e6f RL |
781 | @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ |
782 | mkdir -p "$(BLDDIR)/util"; \ | |
783 | ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \ | |
784 | fi | |
27f42b46 | 785 | $(BLDDIR)/util/shlib_wrap.sh: configdata.pm |
567a9e6f RL |
786 | @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ |
787 | mkdir -p "$(BLDDIR)/util"; \ | |
788 | ln -sf "../$(SRCDIR)/util/shlib_wrap.sh" "$(BLDDIR)/util"; \ | |
789 | fi | |
c058fcd7 | 790 | FORCE: |
567a9e6f RL |
791 | |
792 | # Building targets ################################################### | |
793 | ||
8478a703 | 794 | libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -} |
567a9e6f RL |
795 | libcrypto.pc: |
796 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
797 | echo 'exec_prefix=$${prefix}'; \ | |
798 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
799 | echo 'includedir=$${prefix}/include'; \ | |
800 | echo ''; \ | |
801 | echo 'Name: OpenSSL-libcrypto'; \ | |
802 | echo 'Description: OpenSSL cryptography library'; \ | |
803 | echo 'Version: '$(VERSION); \ | |
804 | echo 'Libs: -L$${libdir} -lcrypto'; \ | |
805 | echo 'Libs.private: $(EX_LIBS)'; \ | |
806 | echo 'Cflags: -I$${includedir}' ) > libcrypto.pc | |
807 | ||
808 | libssl.pc: | |
809 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
810 | echo 'exec_prefix=$${prefix}'; \ | |
811 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
812 | echo 'includedir=$${prefix}/include'; \ | |
813 | echo ''; \ | |
814 | echo 'Name: OpenSSL-libssl'; \ | |
815 | echo 'Description: Secure Sockets Layer and cryptography libraries'; \ | |
816 | echo 'Version: '$(VERSION); \ | |
817 | echo 'Requires.private: libcrypto'; \ | |
818 | echo 'Libs: -L$${libdir} -lssl'; \ | |
819 | echo 'Libs.private: $(EX_LIBS)'; \ | |
820 | echo 'Cflags: -I$${includedir}' ) > libssl.pc | |
821 | ||
822 | openssl.pc: | |
823 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
824 | echo 'exec_prefix=$${prefix}'; \ | |
825 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
826 | echo 'includedir=$${prefix}/include'; \ | |
827 | echo ''; \ | |
828 | echo 'Name: OpenSSL'; \ | |
829 | echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \ | |
830 | echo 'Version: '$(VERSION); \ | |
831 | echo 'Requires: libssl libcrypto' ) > openssl.pc | |
832 | ||
4813ad2d | 833 | configdata.pm: {- $config{build_file_template} -} $(SRCDIR)/Configurations/common.tmpl $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_infos}}) -} |
27f42b46 | 834 | @echo "Detected changed: $?" |
567a9e6f RL |
835 | @echo "Reconfiguring..." |
836 | $(SRCDIR)/Configure reconf | |
837 | @echo "**************************************************" | |
838 | @echo "*** ***" | |
839 | @echo "*** Please run the same make command again ***" | |
840 | @echo "*** ***" | |
841 | @echo "**************************************************" | |
842 | @false | |
843 | ||
844 | {- | |
845 | use File::Basename; | |
846 | use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; | |
cedbb146 RL |
847 | |
848 | # Helper function to figure out dependencies on libraries | |
849 | # It takes a list of library names and outputs a list of dependencies | |
850 | sub compute_lib_depends { | |
84af1bae | 851 | if ($disabled{shared}) { |
834aae2a | 852 | return map { $_.$libext } @_; |
cedbb146 RL |
853 | } |
854 | ||
855 | # Depending on shared libraries: | |
856 | # On Windows POSIX layers, we depend on {libname}.dll.a | |
857 | # On Unix platforms, we depend on {shlibname}.so | |
f5c174ff | 858 | return map { shlib_simple($_) } @_; |
cedbb146 RL |
859 | } |
860 | ||
66ddf178 RL |
861 | sub generatesrc { |
862 | my %args = @_; | |
863 | my $generator = join(" ", @{$args{generator}}); | |
8d34daf0 | 864 | my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}}); |
d4605727 | 865 | my $incs = join("", map { " -I".$_ } @{$args{incs}}); |
8d34daf0 | 866 | my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}}); |
66ddf178 RL |
867 | |
868 | if ($args{src} !~ /\.[sS]$/) { | |
7cae3864 RL |
869 | if ($args{generator}->[0] =~ m|^.*\.in$|) { |
870 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
871 | "util", "dofile.pl")), | |
872 | rel2abs($config{builddir})); | |
873 | return <<"EOF"; | |
874 | $args{src}: $args{generator}->[0] $deps | |
875 | \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ | |
876 | "-o$target{build_file}" $generator > \$@ | |
877 | EOF | |
878 | } else { | |
879 | return <<"EOF"; | |
769777b0 | 880 | $args{src}: $args{generator}->[0] $deps |
8d34daf0 | 881 | \$(PERL)$generator_incs $generator > \$@ |
66ddf178 | 882 | EOF |
7cae3864 | 883 | } |
66ddf178 | 884 | } else { |
8458f1bf | 885 | if ($args{generator}->[0] =~ /\.pl$/) { |
8d34daf0 | 886 | $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator; |
8458f1bf | 887 | } elsif ($args{generator}->[0] =~ /\.m4$/) { |
8d34daf0 | 888 | $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >' |
8458f1bf RL |
889 | } elsif ($args{generator}->[0] =~ /\.S$/) { |
890 | $generator = undef; | |
891 | } else { | |
892 | die "Generator type for $args{src} unknown: $generator\n"; | |
893 | } | |
894 | ||
895 | if (defined($generator)) { | |
896 | # If the target is named foo.S in build.info, we want to | |
897 | # end up generating foo.s in two steps. | |
898 | if ($args{src} =~ /\.S$/) { | |
899 | (my $target = $args{src}) =~ s|\.S$|.s|; | |
900 | return <<"EOF"; | |
769777b0 | 901 | $target: $args{generator}->[0] $deps |
0218fc37 | 902 | ( trap "rm -f \$@.*" INT 0; \\ |
8458f1bf | 903 | $generator \$@.S; \\ |
57ade571 | 904 | \$(CC) $incs \$(CFLAGS) -E \$@.S | \\ |
39199fb3 AP |
905 | \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\ |
906 | mv -f \$@.i \$@ ) | |
66ddf178 | 907 | EOF |
8458f1bf RL |
908 | } |
909 | # Otherwise.... | |
66ddf178 | 910 | return <<"EOF"; |
769777b0 | 911 | $args{src}: $args{generator}->[0] $deps |
8458f1bf | 912 | $generator \$@ |
66ddf178 | 913 | EOF |
66ddf178 | 914 | } |
8458f1bf | 915 | return <<"EOF"; |
769777b0 | 916 | $args{src}: $args{generator}->[0] $deps |
57ade571 | 917 | \$(CC) $incs \$(CFLAGS) -E \$< | \\ |
39199fb3 | 918 | \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@ |
8458f1bf | 919 | EOF |
66ddf178 RL |
920 | } |
921 | } | |
922 | ||
bb26842d RL |
923 | # Should one wonder about the end of the Perl snippet, it's because this |
924 | # second regexp eats up line endings as well, if the removed path is the | |
925 | # last in the line. We may therefore need to put back a line ending. | |
88297284 | 926 | sub src2obj { |
567a9e6f | 927 | my %args = @_; |
88297284 | 928 | my $obj = $args{obj}; |
674d5858 RL |
929 | my @srcs = map { if ($unified_info{generate}->{$_}) { |
930 | (my $x = $_) =~ s/\.S$/.s/; $x | |
931 | } else { | |
932 | $_ | |
933 | } | |
934 | } ( @{$args{srcs}} ); | |
8458f1bf RL |
935 | my $srcs = join(" ", @srcs); |
936 | my $deps = join(" ", @srcs, @{$args{deps}}); | |
45502bfe | 937 | my $incs = join("", map { " -I".$_ } @{$args{incs}}); |
da430a55 RL |
938 | unless ($disabled{zlib}) { |
939 | if ($withargs{zlib_include}) { | |
940 | $incs .= " -I".$withargs{zlib_include}; | |
941 | } | |
942 | } | |
bbd9a50f | 943 | my $ecflags = { lib => '$(LIB_CFLAGS)', |
45502bfe RL |
944 | dso => '$(DSO_CFLAGS)', |
945 | bin => '$(BIN_CFLAGS)' } -> {$args{intent}}; | |
567a9e6f | 946 | my $makedepprog = $config{makedepprog}; |
29eed3dd RL |
947 | my $recipe = ""; |
948 | if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) { | |
949 | $recipe .= <<"EOF"; | |
834aae2a | 950 | $obj$depext: $deps |
57ade571 | 951 | -\$(MAKEDEPEND) -f- -o"|$obj$objext" -- $incs \$(CFLAGS) $ecflags -- $srcs \\ |
f3e5948a | 952 | >\$\@.tmp 2>/dev/null |
757c416c | 953 | -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' \$\@.tmp |
29b28eee | 954 | \@if cmp \$\@.tmp \$\@ > /dev/null 2> /dev/null; then \\ |
987dbc7f | 955 | rm -f \$\@.tmp; \\ |
29b28eee RL |
956 | else \\ |
957 | mv \$\@.tmp \$\@; \\ | |
987dbc7f | 958 | fi |
29eed3dd RL |
959 | EOF |
960 | $deps = $obj.$depext; | |
961 | } | |
962 | if ($disabled{makedepend} || $makedepprog =~ /\/makedepend/) { | |
963 | $recipe .= <<"EOF"; | |
964 | $obj$objext: $deps | |
57ade571 | 965 | \$(CC) $incs \$(CFLAGS) $ecflags -c -o \$\@ $srcs |
567a9e6f RL |
966 | EOF |
967 | } | |
29eed3dd RL |
968 | if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) { |
969 | $recipe .= <<"EOF"; | |
340da949 | 970 | $obj$objext: $deps |
57ade571 | 971 | \$(CC) $incs \$(CFLAGS) $ecflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs |
340da949 | 972 | \@touch $obj$depext.tmp |
29b28eee | 973 | \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\ |
987dbc7f | 974 | rm -f $obj$depext.tmp; \\ |
29b28eee RL |
975 | else \\ |
976 | mv $obj$depext.tmp $obj$depext; \\ | |
340da949 | 977 | fi |
567a9e6f | 978 | EOF |
29eed3dd RL |
979 | } |
980 | return $recipe; | |
567a9e6f RL |
981 | } |
982 | # On Unix, we build shlibs from static libs, so we're ignoring the | |
983 | # object file array. We *know* this routine is only called when we've | |
984 | # configure 'shared'. | |
985 | sub libobj2shlib { | |
986 | my %args = @_; | |
987 | my $lib = $args{lib}; | |
988 | my $shlib = $args{shlib}; | |
989 | my $libd = dirname($lib); | |
990 | my $libn = basename($lib); | |
991 | (my $libname = $libn) =~ s/^lib//; | |
cedbb146 RL |
992 | my $linklibs = join("", map { my $d = dirname($_); |
993 | my $f = basename($_); | |
994 | (my $l = $f) =~ s/^lib//; | |
995 | " -L$d -l$l" } @{$args{deps}}); | |
996 | my $deps = join(" ",compute_lib_depends(@{$args{deps}})); | |
567a9e6f RL |
997 | my $shlib_target = $target{shared_target}; |
998 | my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : ""; | |
f5c174ff | 999 | my $target = shlib_simple($lib); |
567a9e6f | 1000 | return <<"EOF" |
cedbb146 RL |
1001 | # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact |
1002 | # that two files get produced, {shlibname}.dll and {libname}.dll.a. | |
1003 | # With all other Unix platforms, we often build a shared library with the | |
1004 | # SO version built into the file name and a symlink without the SO version | |
1005 | # It's not necessary to have both as targets. The choice falls on the | |
834aae2a BL |
1006 | # simplest, {libname}$shlibextimport for Windows POSIX layers and |
1007 | # {libname}$shlibextsimple for the Unix platforms. | |
1008 | $target: $lib$libext $deps $ordinalsfile | |
567a9e6f | 1009 | \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ |
cedbb146 | 1010 | PLATFORM=\$(PLATFORM) \\ |
cbece220 | 1011 | PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\ |
8a0a3d29 RL |
1012 | INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\ |
1013 | LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\ | |
cedbb146 | 1014 | LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\ |
8a0a3d29 RL |
1015 | LIBCOMPATVERSIONS=';\$(SHLIB_VERSION_HISTORY)' \\ |
1016 | CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\ | |
8f41ff2d | 1017 | LDFLAGS='\$(LDFLAGS)' \\ |
8a0a3d29 | 1018 | SHARED_LDFLAGS='\$(LIB_LDFLAGS)' SHLIB_EXT=$shlibext \\ |
8f41ff2d | 1019 | RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\ |
e048fd51 | 1020 | link_shlib.$shlib_target |
fcf80c46 RL |
1021 | EOF |
1022 | . (windowsdll() ? <<"EOF" : ""); | |
834aae2a BL |
1023 | rm -f apps/$shlib$shlibext |
1024 | rm -f test/$shlib$shlibext | |
1025 | cp -p $shlib$shlibext apps/ | |
1026 | cp -p $shlib$shlibext test/ | |
567a9e6f RL |
1027 | EOF |
1028 | } | |
5386287c | 1029 | sub obj2dso { |
567a9e6f RL |
1030 | my %args = @_; |
1031 | my $lib = $args{lib}; | |
1032 | my $libd = dirname($lib); | |
1033 | my $libn = basename($lib); | |
1034 | (my $libname = $libn) =~ s/^lib//; | |
1035 | my $shlibdeps = join("", map { my $d = dirname($_); | |
1036 | my $f = basename($_); | |
1037 | (my $l = $f) =~ s/^lib//; | |
1038 | " -L$d -l$l" } @{$args{deps}}); | |
cedbb146 | 1039 | my $deps = join(" ",compute_lib_depends(@{$args{deps}})); |
567a9e6f | 1040 | my $shlib_target = $target{shared_target}; |
834aae2a | 1041 | my $objs = join(" ", map { $_.$objext } @{$args{objs}}); |
f5c174ff | 1042 | my $target = dso($lib); |
567a9e6f | 1043 | return <<"EOF"; |
f5c174ff | 1044 | $target: $objs $deps |
567a9e6f | 1045 | \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ |
cedbb146 | 1046 | PLATFORM=\$(PLATFORM) \\ |
cbece220 | 1047 | PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\ |
8a0a3d29 RL |
1048 | LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\ |
1049 | LIBNAME=$libname LDFLAGS='\$(LDFLAGS)' \\ | |
1050 | CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\ | |
1051 | SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\ | |
834aae2a | 1052 | SHLIB_EXT=$dsoext \\ |
567a9e6f | 1053 | LIBEXTRAS="$objs" \\ |
e048fd51 | 1054 | link_dso.$shlib_target |
567a9e6f RL |
1055 | EOF |
1056 | } | |
1057 | sub obj2lib { | |
1058 | my %args = @_; | |
1059 | my $lib = $args{lib}; | |
834aae2a | 1060 | my $objs = join(" ", map { $_.$objext } @{$args{objs}}); |
567a9e6f | 1061 | return <<"EOF"; |
834aae2a | 1062 | $lib$libext: $objs |
68cd4e3f | 1063 | \$(AR) \$\@ \$\? |
567a9e6f RL |
1064 | \$(RANLIB) \$\@ || echo Never mind. |
1065 | EOF | |
1066 | } | |
1067 | sub obj2bin { | |
1068 | my %args = @_; | |
1069 | my $bin = $args{bin}; | |
1070 | my $bind = dirname($bin); | |
1071 | my $binn = basename($bin); | |
834aae2a | 1072 | my $objs = join(" ", map { $_.$objext } @{$args{objs}}); |
cedbb146 RL |
1073 | my $deps = join(" ",compute_lib_depends(@{$args{deps}})); |
1074 | my $linklibs = join("", map { my $d = dirname($_); | |
1075 | my $f = basename($_); | |
1076 | $d = "." if $d eq $f; | |
1077 | (my $l = $f) =~ s/^lib//; | |
1078 | " -L$d -l$l" } @{$args{deps}}); | |
84af1bae | 1079 | my $shlib_target = $disabled{shared} ? "" : $target{shared_target}; |
567a9e6f | 1080 | return <<"EOF"; |
834aae2a BL |
1081 | $bin$exeext: $objs $deps |
1082 | \$(RM) $bin$exeext | |
567a9e6f | 1083 | \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ |
cbece220 | 1084 | PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\ |
834aae2a | 1085 | APPNAME=$bin$exeext OBJECTS="$objs" \\ |
8a0a3d29 RL |
1086 | LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\ |
1087 | CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\ | |
1088 | LDFLAGS='\$(LDFLAGS)' LIBRPATH='\$(INSTALLTOP)/\$(LIBDIR)' \\ | |
567a9e6f RL |
1089 | link_app.$shlib_target |
1090 | EOF | |
1091 | } | |
1092 | sub in2script { | |
1093 | my %args = @_; | |
1094 | my $script = $args{script}; | |
1095 | my $sources = join(" ", @{$args{sources}}); | |
1096 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
1097 | "util", "dofile.pl")), | |
1098 | rel2abs($config{builddir})); | |
1099 | return <<"EOF"; | |
88297284 | 1100 | $script: $sources |
4b799cea | 1101 | \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ |
ba327ade | 1102 | "-o$target{build_file}" $sources > "$script" |
567a9e6f | 1103 | chmod a+x $script |
0ad1d94d RL |
1104 | EOF |
1105 | } | |
1106 | sub generatedir { | |
1107 | my %args = @_; | |
1108 | my $dir = $args{dir}; | |
1109 | my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}}; | |
1110 | my @actions = (); | |
1111 | my %extinfo = ( dso => $dsoext, | |
1112 | lib => $libext, | |
1113 | bin => $exeext ); | |
1114 | ||
1115 | foreach my $type (("dso", "lib", "bin", "script")) { | |
1116 | next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type}); | |
850000aa RL |
1117 | # For lib object files, we could update the library. However, it |
1118 | # was decided that it's enough to build the directory local object | |
1119 | # files, so we don't need to add any actions, and the dependencies | |
1120 | # are already taken care of. | |
1121 | if ($type ne "lib") { | |
0ad1d94d RL |
1122 | foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { |
1123 | if (dirname($prod) eq $dir) { | |
1124 | push @deps, $prod.$extinfo{$type}; | |
1125 | } else { | |
1126 | push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}}); | |
1127 | } | |
1128 | } | |
1129 | } | |
1130 | } | |
1131 | ||
1132 | my $deps = join(" ", @deps); | |
1133 | my $actions = join("\n", "", @actions); | |
1134 | return <<"EOF"; | |
1135 | $args{dir} $args{dir}/: $deps$actions | |
567a9e6f RL |
1136 | EOF |
1137 | } | |
1138 | "" # Important! This becomes part of the template result. | |
1139 | -} |