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