X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=Configurations%2Funix-Makefile.tmpl;h=04964dcf5dd76a742cb30d43fdbb0d98001ebaee;hp=9054f6a863d66f76d876beaf5c688ca35f5d8923;hb=b867c7077a0ebf2ca17f9d020c112f790074571b;hpb=da430a5555b97cc0fe5e9bf6cfd64be98e8b5bcb diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index 9054f6a863..04964dcf5d 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -84,12 +84,18 @@ DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; } grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } keys %{$unified_info{sources}}); -} {- output_on() if $disabled{makedepend}; "" -} -GENERATED={- join(" ", map { (my $x = $_) =~ s|\.S$|\.s|; $x } keys %{$unified_info{generate}}) -} - +GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -} +GENERATED={- join(" ", + ( map { (my $x = $_) =~ s|\.S$|\.s|; $x } + grep { defined $unified_info{generate}->{$_} } + map { @{$unified_info{sources}->{$_}} } + grep { /\.o$/ } keys %{$unified_info{sources}} ), + ( grep { /\.h$/ } keys %{$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}}) -} @@ -167,10 +173,9 @@ LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} # $prefix is not /usr. . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$| ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -} -RCFLAGS={- $target{shared_rcflag} -} DSO_CFLAGS={- $target{shared_cflag} || "" -} DSO_LDFLAGS=$(LIB_LDFLAGS) -BIN_CFLAGS={- "" -} +BIN_CFLAGS={- $target{bin_cflags} -} PERL={- $config{perl} -} @@ -178,6 +183,8 @@ ARFLAGS= {- $target{arflags} -} AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r RANLIB= {- $target{ranlib} -} NM= $(CROSS_COMPILE){- $target{nm} || "nm" -} +RCFLAGS={- $target{shared_rcflag} -} +RC= $(CROSS_COMPILE){- $target{rc} || "windres" -} RM= rm -f RMDIR= rmdir TAR= {- $target{tar} || "tar" -} @@ -203,29 +210,39 @@ PROCESSOR= {- $config{processor} -} # 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) -test tests: build_tests_nodep build_apps_nodep build_engines_nodep \ - depend link-utils +build_generated: $(GENERATED_MANDATORY) + +test: tests +tests: build_generated \ + build_tests_nodep build_apps_nodep build_engines_nodep \ + depend link-utils + @ : {- output_off() if $disabled{tests}; "" -} ( cd test; \ SRCTOP=../$(SRCDIR) \ BLDTOP=../$(BLDDIR) \ + PERL="$(PERL)" \ EXE_EXT={- $exeext -} \ OPENSSL_ENGINES=../$(BLDDIR)/engines \ $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) ) + @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} + @echo "Tests are not supported with your chosen Configure options" + @ : {- output_on() if !$disabled{tests}; "" -} list-tests: - @TOP=$(SRCDIR) PERL=$(PERL) $(PERL) $(SRCDIR)/test/run_tests.pl list + @TOP="$(SRCDIR)" PERL="$(PERL)" $(PERL) $(SRCDIR)/test/run_tests.pl list libclean: @set -e; for s in $(SHLIB_INFO); do \ @@ -252,9 +269,13 @@ clean: libclean rm -f core rm -f tags TAGS rm -f openssl.pc libcrypto.pc libssl.pc - -rm -f `find . -type l` + -rm -f `find . -type l -a \! -path "./.git/*"` rm -f $(TARFILE) +distclean: clean + rm -f configdata.pm + rm -f Makefile + # This exists solely for those who still type 'make depend' # # We check if any depfile is newer than Makefile and decide to @@ -520,6 +541,7 @@ PROCESS_PODS=\ SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \ [ -z "$$SEC" ] && SEC=$$defsec; \ fn=`basename $$p .pod`; \ + Name=$$fn; \ NAME=`echo $$fn | tr [a-z] [A-Z]`; \ suf=`eval "echo $$OUTSUFFIX"`; \ top=`eval "echo $$OUTTOP"`; \ @@ -599,7 +621,7 @@ install_html_docs: OUTSUFFIX='.$(HTMLSUFFIX)'; \ OUTTOP="$(DESTDIR)$(HTMLDIR)"; \ GENERATE="pod2html --podroot=$(SRCDIR)/doc --htmldir=.. \ - --podpath=apps:crypto:ssl \ + --podpath=apps:crypto:ssl --title=\$$Name \ | sed -e 's|href=\"http://man.he.net/man|href=\"../man|g'"; \ $(PROCESS_PODS) @@ -615,7 +637,8 @@ uninstall_html_docs: update: generate errors ordinals -generate: generate_apps generate_crypto_bn generate_crypto_objects +generate: generate_apps generate_crypto_bn generate_crypto_objects \ + generate_crypto_conf generate_crypto_asn1 # Test coverage is a good idea for the future #coverage: $(PROGRAMS) $(TESTPROGRAMS) @@ -646,18 +669,26 @@ generate_crypto_bn: ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h ) generate_crypto_objects: - ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \ - include/openssl/obj_mac.h \ - crypto/objects/obj_dat.h ) ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \ crypto/objects/objects.txt \ crypto/objects/obj_mac.num \ include/openssl/obj_mac.h ) + ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \ + include/openssl/obj_mac.h \ + crypto/objects/obj_dat.h ) ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \ crypto/objects/obj_mac.num \ crypto/objects/obj_xref.txt \ > crypto/objects/obj_xref.h ) +generate_crypto_conf: + ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \ + > crypto/conf/conf_def.h ) + +generate_crypto_asn1: + ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \ + > crypto/asn1/charmap.h ) + errors: ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c ) ( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write ) @@ -684,7 +715,7 @@ tags TAGS: FORCE # 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.$$$$; \ @@ -692,6 +723,7 @@ tar: 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; \ @@ -801,19 +833,31 @@ configdata.pm: $(SRCDIR)/Configurations/unix-Makefile.tmpl $(SRCDIR)/Configurati sub generatesrc { my %args = @_; my $generator = join(" ", @{$args{generator}}); + my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}}); my $incs = join("", map { " -I".$_ } @{$args{incs}}); - my $deps = join(" ", @{$args{deps}}); + 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) $generator > \$@ + \$(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; + $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator; } elsif ($args{generator}->[0] =~ /\.m4$/) { - $generator = 'm4 -B 8192 '.$generator.' >' + $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >' } elsif ($args{generator}->[0] =~ /\.S$/) { $generator = undef; } else { @@ -829,7 +873,9 @@ EOF $target: $args{generator}->[0] $deps ( trap "rm -f \$@.*" INT 0; \\ $generator \$@.S; \\ - \$(CC) \$(CFLAGS) $incs -E -P \$@.S > \$@.i && mv -f \$@.i \$@ ) + \$(CC) \$(CFLAGS) $incs -E \$@.S | \\ + \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\ + mv -f \$@.i \$@ ) EOF } # Otherwise.... @@ -840,7 +886,8 @@ EOF } return <<"EOF"; $args{src}: $args{generator}->[0] $deps - \$(CC) \$(CFLAGS) $incs -E -P \$< > \$@ + \$(CC) \$(CFLAGS) $incs -E \$< | \\ + \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@ EOF } } @@ -933,15 +980,15 @@ EOF $target: $lib$libext $deps $ordinalsfile \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ PLATFORM=\$(PLATFORM) \\ - PERL=\$(PERL) SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\ + PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\ INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\ LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\ LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\ LIBCOMPATVERSIONS=';\$(SHLIB_VERSION_HISTORY)' \\ CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\ - CROSS_COMPILE='\$(CROSS_COMPILE)' LDFLAGS='\$(LDFLAGS)' \\ + LDFLAGS='\$(LDFLAGS)' \\ SHARED_LDFLAGS='\$(LIB_LDFLAGS)' SHLIB_EXT=$shlibext \\ - SHARED_RCFLAGS='\$(RCFLAGS)' \\ + RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\ link_shlib.$shlib_target EOF . (windowsdll() ? <<"EOF" : ""); @@ -969,7 +1016,7 @@ EOF $target: $objs $deps \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ PLATFORM=\$(PLATFORM) \\ - PERL=\$(PERL) SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\ + PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\ LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\ LIBNAME=$libname LDFLAGS='\$(LDFLAGS)' \\ CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\ @@ -1006,7 +1053,7 @@ EOF $bin$exeext: $objs $deps \$(RM) $bin$exeext \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ - PERL=\$(PERL) SRCDIR=\$(SRCDIR) \\ + PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\ APPNAME=$bin$exeext OBJECTS="$objs" \\ LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\ CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\ @@ -1026,6 +1073,41 @@ $script: $sources \$(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}); + if ($type eq "lib") { + foreach my $lib (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { + push @actions, <<"EOF"; + \$(AR) $lib$libext \$\? + \$(RANLIB) $lib$libext || echo Never mind. +EOF + } + } else { + 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.