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