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