grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
keys %{$unified_info{sources}}); -}
{- output_on() if $disabled{makedepend}; "" -}
+GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -}
GENERATED={- join(" ",
( map { (my $x = $_) =~ s|\.S$|\.s|; $x }
grep { defined $unified_info{generate}->{$_} }
{- output_off() if $disabled{apps}; "" -}
BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash
-MISC_SCRIPTS=$(SRCDIR)/tools/c_hash $(SRCDIR)/tools/c_info \
- $(SRCDIR)/tools/c_issuer $(SRCDIR)/tools/c_name \
- $(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget
+MISC_SCRIPTS=$(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget
{- output_on() if $disabled{apps}; "" -}
SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -}
# The main targets ###################################################
-all: configdata.pm build_libs_nodep build_engines_nodep build_apps_nodep \
+all: build_generated \
+ build_libs_nodep build_engines_nodep build_apps_nodep \
depend link-utils
-build_libs: configdata.pm build_libs_nodep depend
+build_libs: build_generated build_libs_nodep depend
build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
-build_engines: configdata.pm build_engines_nodep depend
+build_engines: build_generated build_engines_nodep depend
build_engines_nodep: $(ENGINES)
-build_apps: configdata.pm build_apps_nodep depend
+build_apps: build_generated build_apps_nodep depend
build_apps_nodep: $(PROGRAMS) $(SCRIPTS)
-build_tests: configdata.pm build_tests_nodep depend
+build_tests: build_generated build_tests_nodep depend
build_tests_nodep: $(TESTPROGS)
+build_generated: $(GENERATED_MANDATORY)
+
test: tests
-tests: build_tests_nodep build_apps_nodep build_engines_nodep \
+tests: build_generated \
+ build_tests_nodep build_apps_nodep build_engines_nodep \
depend link-utils
@ : {- output_off() if $disabled{tests}; "" -}
( cd test; \
@ : {- output_on() if !$disabled{tests}; "" -}
list-tests:
- @TOP="$(SRCDIR)" PERL="$(PERL)" $(PERL) $(SRCDIR)/test/run_tests.pl list
+ @ : {- output_off() if $disabled{tests}; "" -}
+ @SRCTOP="$(SRCDIR)" \
+ $(PERL) $(SRCDIR)/test/run_tests.pl list
+ @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
+ @echo "Tests are not supported with your chosen Configure options"
+ @ : {- output_on() if !$disabled{tests}; "" -}
+
+install: install_sw install_ssldirs install_docs
+
+uninstall: uninstall_docs uninstall_sw
libclean:
@set -e; for s in $(SHLIB_INFO); do \
fi; \
done
$(RM) $(LIBS)
-
-install: install_sw install_ssldirs install_docs
-
-uninstall: uninstall_docs uninstall_sw
+ $(RM) *.map
clean: libclean
- rm -f $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
- rm -f $(GENERATED)
- -rm -f `find . -name '*{- $depext -}'`
- -rm -f `find . -name '*{- $objext -}'`
- rm -f core
- rm -f tags TAGS
- rm -f openssl.pc libcrypto.pc libssl.pc
- -rm -f `find . -type l -a \! -path "./.git/*"`
- rm -f $(TARFILE)
+ $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
+ $(RM) $(GENERATED)
+ -$(RM) `find . -name '*{- $depext -}' -a \! -path "./.git/*"`
+ -$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"`
+ $(RM) core
+ $(RM) tags TAGS
+ $(RM) openssl.pc libcrypto.pc libssl.pc
+ -$(RM) `find . -type l -a \! -path "./.git/*"`
+ $(RM) $(TARFILE)
+
+distclean: clean
+ $(RM) configdata.pm
+ $(RM) Makefile
# This exists solely for those who still type 'make depend'
#
install_ssldirs:
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
+ @set -e; for x in dummy $(MISC_SCRIPTS); do \
+ if [ "$$x" = "dummy" ]; then continue; fi; \
+ fn=`basename $$x`; \
+ echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
+ cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
+ chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
+ mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
+ $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
+ done
+ @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"
+ @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
+ @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
+ @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf
install_dev:
@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
$(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
done
- @set -e; for x in dummy $(MISC_SCRIPTS); do \
- if [ "$$x" = "dummy" ]; then continue; fi; \
- fn=`basename $$x`; \
- echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
- cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
- chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
- mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
- $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
- done
- @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"
- @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
- @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
- @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf
uninstall_runtime:
@echo "*** Uninstalling runtime files"
#coverage: $(PROGRAMS) $(TESTPROGRAMS)
# ...
-# Currently disabled, util/selftest.pl needs a rewrite
-#report:
-# SRCDIR=$(SRCDIR) @$(PERL) util/selftest.pl
-
lint:
lint -DLINT $(INCLUDES) $(SRCS)
# Release targets (note: only available on Unix) #####################
-TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf -
+TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf -
PREPARE_CMD=:
tar:
TMPDIR=/var/tmp/openssl-copy.$$$$; \
mkdir -p $$TMPDIR/$$DISTDIR; \
(cd $(SRCDIR); \
git ls-tree -r --name-only --full-tree HEAD \
+ | grep -v '^fuzz/corpora' \
| while read F; do \
mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \
cp $$F $$TMPDIR/$$DISTDIR/$$F; \
echo 'Version: '$(VERSION); \
echo 'Requires: libssl libcrypto' ) > openssl.pc
-# Note on the use of $(MFLAGS): this was an older variant of MAKEFLAGS which
-# wasn't passed down automatically. It's quite safe to use it like we do
-# below; if it doesn't exist, the result will be empty and 'make' will pick
-# up $(MAKEFLAGS) which is passed down as an environment variable.
-configdata.pm: $(SRCDIR)/Configurations/unix-Makefile.tmpl $(SRCDIR)/Configurations/common.tmpl $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_infos}}) -}
+configdata.pm: {- $config{build_file_template} -} $(SRCDIR)/Configurations/common.tmpl $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_infos}}) -}
@echo "Detected changed: $?"
@echo "Reconfiguring..."
$(SRCDIR)/Configure reconf
my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
if ($args{src} !~ /\.[sS]$/) {
- return <<"EOF";
+ if ($args{generator}->[0] =~ m|^.*\.in$|) {
+ my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
+ "util", "dofile.pl")),
+ rel2abs($config{builddir}));
+ return <<"EOF";
+$args{src}: $args{generator}->[0] $deps
+ \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
+ "-o$target{build_file}" $generator > \$@
+EOF
+ } else {
+ return <<"EOF";
$args{src}: $args{generator}->[0] $deps
\$(PERL)$generator_incs $generator > \$@
EOF
+ }
} else {
if ($args{generator}->[0] =~ /\.pl$/) {
$generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
$target: $args{generator}->[0] $deps
( trap "rm -f \$@.*" INT 0; \\
$generator \$@.S; \\
- \$(CC) \$(CFLAGS) $incs -E \$@.S | \\
+ \$(CC) $incs \$(CFLAGS) -E \$@.S | \\
\$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\
mv -f \$@.i \$@ )
EOF
}
return <<"EOF";
$args{src}: $args{generator}->[0] $deps
- \$(CC) \$(CFLAGS) $incs -E \$< | \\
+ \$(CC) $incs \$(CFLAGS) -E \$< | \\
\$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
EOF
}
if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
$recipe .= <<"EOF";
$obj$depext: $deps
- -\$(MAKEDEPEND) -f- -o"|$obj$objext" -- \$(CFLAGS) $ecflags$incs -- $srcs \\
+ -\$(MAKEDEPEND) -f- -o"|$obj$objext" -- $incs \$(CFLAGS) $ecflags -- $srcs \\
>\$\@.tmp 2>/dev/null
-\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' \$\@.tmp
\@if cmp \$\@.tmp \$\@ > /dev/null 2> /dev/null; then \\
if ($disabled{makedepend} || $makedepprog =~ /\/makedepend/) {
$recipe .= <<"EOF";
$obj$objext: $deps
- \$(CC) \$(CFLAGS) $ecflags$incs -c -o \$\@ $srcs
+ \$(CC) $incs \$(CFLAGS) $ecflags -c -o \$\@ $srcs
EOF
}
if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) {
$recipe .= <<"EOF";
$obj$objext: $deps
- \$(CC) \$(CFLAGS) $ecflags$incs -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
+ \$(CC) $incs \$(CFLAGS) $ecflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
\@touch $obj$depext.tmp
\@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
rm -f $obj$depext.tmp; \\
\$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
"-o$target{build_file}" $sources > "$script"
chmod a+x $script
+EOF
+ }
+ sub generatedir {
+ my %args = @_;
+ my $dir = $args{dir};
+ my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
+ my @actions = ();
+ my %extinfo = ( dso => $dsoext,
+ lib => $libext,
+ bin => $exeext );
+
+ foreach my $type (("dso", "lib", "bin", "script")) {
+ next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
+ # For lib object files, we could update the library. However, it
+ # was decided that it's enough to build the directory local object
+ # files, so we don't need to add any actions, and the dependencies
+ # are already taken care of.
+ if ($type ne "lib") {
+ foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
+ if (dirname($prod) eq $dir) {
+ push @deps, $prod.$extinfo{$type};
+ } else {
+ push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
+ }
+ }
+ }
+ }
+
+ my $deps = join(" ", @deps);
+ my $actions = join("\n", "", @actions);
+ return <<"EOF";
+$args{dir} $args{dir}/: $deps$actions
EOF
}
"" # Important! This becomes part of the template result.