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