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