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