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