X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=Configurations%2Funix-Makefile.tmpl;h=f60a11f6c33e32841edb40eba062877e904c1cf8;hp=3718467fac5ed334f7833f2c21107bd98d94f077;hb=04e2a527379ad12ca512aef4e838f94af22d7f79;hpb=987dbc7fbf9ae95430649662141ebb26bcd5ecad diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index 3718467fac..f60a11f6c3 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -84,6 +84,7 @@ 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}}) -} BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash MISC_SCRIPTS=$(SRCDIR)/tools/c_hash $(SRCDIR)/tools/c_info \ @@ -151,23 +152,24 @@ CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -} LDFLAGS= {- $target{lflags} -} PLIB_LDFLAGS= {- $target{plib_lflags} -} EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -} -SHARED_CFLAGS={- $target{shared_cflag} || "" -} -SHARED_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} - # Unlike other OSes (like Solaris, Linux, Tru64, - # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD - # and FreeBSD) "demand" RPATH set on .so objects. - # Apparently application RPATH is not global and - # does not apply to .so linked with other .so. - # Problem manifests itself when libssl.so fails to - # load libcrypto.so. One can argue that we should - # engrave this into Makefile.shared rules or into - # BSD-* config lines above. Meanwhile let's try to - # be cautious and pass -rpath to linker only when - # $prefix is not /usr. - . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$| - ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -} -SHARED_RCFLAGS={- $target{shared_rcflag} -} +LIB_CFLAGS={- $target{shared_cflag} || "" -} +LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} + # Unlike other OSes (like Solaris, Linux, Tru64, + # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD + # and FreeBSD) "demand" RPATH set on .so objects. + # Apparently application RPATH is not global and + # does not apply to .so linked with other .so. + # Problem manifests itself when libssl.so fails to + # load libcrypto.so. One can argue that we should + # engrave this into Makefile.shared rules or into + # BSD-* config lines above. Meanwhile let's try to + # be cautious and pass -rpath to linker only when + # $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={- "" -} PERL={- $config{perl} -} @@ -218,6 +220,7 @@ test tests: build_tests_nodep build_apps_nodep build_engines_nodep depend SRCTOP=../$(SRCDIR) \ BLDTOP=../$(BLDDIR) \ EXE_EXT={- $exeext -} \ + OPENSSL_ENGINES=../$(BLDDIR)/engines \ $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) ) list-tests: @@ -241,49 +244,33 @@ install: install_sw install_ssldirs install_docs uninstall: uninstall_docs uninstall_sw clean: libclean - rm -f $(PROGRAMS) $(TESTPROGS) - rm -f `find $(BLDDIR) -name '*{- $depext -}'` - rm -f `find $(BLDDIR) -name '*{- $objext -}'` - rm -f $(BLDDIR)/core - rm -f $(BLDDIR)/tags $(BLDDIR)/TAGS - rm -f $(BLDDIR)/openssl.pc $(BLDDIR)/libcrypto.pc $(BLDDIR)/libssl.pc - -rm -f `find $(BLDDIR) -type l` + 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` rm -f $(TARFILE) # This exists solely for those who still type 'make depend' # # We check if any depfile is newer than Makefile and decide to -# concatenate only if that is true, or if 'test' (a.k.a [ ) -# doesn't have the option to figure it out (-nt). -# -# To check if test has the file age comparison operator, we -# simply try, and rely test to exit with 0 if the comparison -# was true, 1 if false, and most importantly, 2 if it doesn't -# recognise the operator. +# concatenate only if that is true. depend: @: {- output_off() if $disabled{makedepend}; "" -} - @catdepends=false; \ - if [ Makefile -nt Makefile ] 2>/dev/null || [ $$? = 1 ]; then \ - for d in $(DEPS); do \ - if [ $$d -nt Makefile ]; then \ - catdepends=true; \ - break; \ - fi; \ - done; \ - else \ - catdepends=true; \ - fi; \ - if [ $$catdepends = true ]; then \ + @if [ -z "`find $(DEPS) -newer Makefile`" ]; then \ ( sed -e '/^# DO NOT DELETE THIS LINE.*/,$$d' < Makefile; \ echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \ echo; \ - for d in $(DEPS); do \ - if [ -f $$d ]; then cat $$d; fi; \ + for f in $(DEPS); do \ + if [ -f $$f ]; then cat $$f; fi; \ done ) > Makefile.new; \ - if ! cmp Makefile.new Makefile >/dev/null 2>&1; then \ - mv -f Makefile.new Makefile; \ - else \ + if cmp Makefile.new Makefile >/dev/null 2>&1; then \ rm -f Makefile.new; \ + else \ + mv -f Makefile.new Makefile; \ fi; \ fi @: {- output_on() if $disabled{makedepend}; "" -} @@ -630,7 +617,7 @@ generate: generate_apps generate_crypto_bn generate_crypto_objects lint: lint -DLINT $(INCLUDES) $(SRCS) -generate_apps: $(SRCDIR)/apps/openssl-vms.cnf $(SRCDIR)/apps/progs.h +generate_apps: $(SRCDIR)/apps/openssl-vms.cnf generate_crypto_bn: $(SRCDIR)/crypto/bn/bn_prime.h @@ -708,17 +695,6 @@ $(SRCDIR)/apps/openssl-vms.cnf: $(SRCDIR)/apps/openssl.cnf $(PERL) $(SRCDIR)/VMS/VMSify-conf.pl \ < $(SRCDIR)/apps/openssl.cnf > $(SRCDIR)/apps/openssl-vms.cnf -{- # because the program apps/openssl has object files as sources, and - # they then have the corresponding C files as source, we need to chain - # the lookups in %unified_info - my $apps_openssl = catfile("apps","openssl"); - our @openssl_source = map { @{$unified_info{sources}->{$_}} } - @{$unified_info{sources}->{$apps_openssl}}; - ""; -} -$(SRCDIR)/apps/progs.h: - $(RM) $@ - $(PERL) $(SRCDIR)/apps/progs.pl {- join(" ", @openssl_source) -} > $@ - $(SRCDIR)/crypto/bn/bn_prime.h: $(SRCDIR)/crypto/bn/bn_prime.pl $(PERL) $(SRCDIR)/crypto/bn/bn_prime.pl > $(SRCDIR)/crypto/bn/bn_prime.h @@ -794,7 +770,7 @@ openssl.pc: # 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: {- $config{build_file_template} -} $(SRCDIR)/Configurations/common.tmpl $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_infos}}) -} +configdata.pm: $(SRCDIR)/Configurations/unix-Makefile.tmpl $(SRCDIR)/Configurations/common.tmpl $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_infos}}) -} @echo "Detected changed: $?" @echo "Reconfiguring..." $(SRCDIR)/Configure reconf @@ -850,9 +826,9 @@ EOF (my $target = $args{src}) =~ s|\.S$|.s|; return <<"EOF"; $target: $args{generator}->[0] - ( trap "rm -f \$@.S" INT; \\ + ( trap "rm -f \$@.*" INT 0; \\ $generator \$@.S; \\ - \$(CC) \$(CFLAGS) $incs -E -P \$@.S > \$@ && rm -f \$@.S ) + \$(CC) \$(CFLAGS) $incs -E -P \$@.S > \$@.i && mv -f \$@.i \$@ ) EOF } # Otherwise.... @@ -868,6 +844,9 @@ EOF } } + # Should one wonder about the end of the Perl snippet, it's because this + # second regexp eats up line endings as well, if the removed path is the + # last in the line. We may therefore need to put back a line ending. sub src2obj { my %args = @_; my $obj = $args{obj}; @@ -875,7 +854,7 @@ EOF my $srcs = join(" ", @srcs); my $deps = join(" ", @srcs, @{$args{deps}}); my $incs = join("", map { " -I".$_ } @{$args{incs}}); - my $ecflags = { lib => '$(SHARED_CFLAGS)', + my $ecflags = { lib => '$(LIB_CFLAGS)', dso => '$(DSO_CFLAGS)', bin => '$(BIN_CFLAGS)' } -> {$args{intent}}; my $makedepprog = $config{makedepprog}; @@ -886,11 +865,11 @@ $obj$depext: $deps rm -f \$\@.tmp; touch \$\@.tmp -\$(MAKEDEPEND) -f\$\@.tmp -o"|$obj$objext" -- \$(CFLAGS) $ecflags$incs -- $srcs \\ 2>/dev/null - sed -i -e 's/^.*|//' -e 's/ \\/\\(\\\\.\\|[^ ]\\)*//g' -e '/: *\$\$/d' -e '/^\\(#.*\\| *\\)\$\$/d' \$\@.tmp - \@if ! cmp \$\@.tmp \$\@ > /dev/null 2> /dev/null; then \\ - mv \$\@.tmp \$\@; \\ - else \\ + -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' \$\@.tmp + \@if cmp \$\@.tmp \$\@ > /dev/null 2> /dev/null; then \\ rm -f \$\@.tmp; \\ + else \\ + mv \$\@.tmp \$\@; \\ fi EOF $deps = $obj.$depext; @@ -906,10 +885,10 @@ EOF $obj$objext: $deps \$(CC) \$(CFLAGS) $ecflags$incs -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 \\ - mv $obj$depext.tmp $obj$depext; \\ - else \\ + \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\ rm -f $obj$depext.tmp; \\ + else \\ + mv $obj$depext.tmp $obj$depext; \\ fi EOF } @@ -944,15 +923,15 @@ EOF $target: $lib$libext $deps $ordinalsfile \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ PLATFORM=\$(PLATFORM) \\ - PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\ - INSTALLTOP="\$(INSTALLTOP)" LIBDIR="\$(LIBDIR)" \\ - LIBDEPS="\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)" \\ + 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)" LDFLAGS="\$(LDFLAGS)" \\ - CROSS_COMPILE="\$(CROSS_COMPILE)" \\ - SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" SHLIB_EXT=$shlibext \\ - SHARED_RCFLAGS="\$(SHARED_RCFLAGS)" \\ + LIBCOMPATVERSIONS=';\$(SHLIB_VERSION_HISTORY)' \\ + CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\ + CROSS_COMPILE='\$(CROSS_COMPILE)' LDFLAGS='\$(LDFLAGS)' \\ + SHARED_LDFLAGS='\$(LIB_LDFLAGS)' SHLIB_EXT=$shlibext \\ + SHARED_RCFLAGS='\$(RCFLAGS)' \\ link_shlib.$shlib_target EOF . (windowsdll() ? <<"EOF" : ""); @@ -980,11 +959,11 @@ EOF $target: $objs $deps \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ PLATFORM=\$(PLATFORM) \\ - PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\ - LIBDEPS="\$(PLIB_LDFLAGS) $shlibdeps \$(EX_LIBS)" \\ - LIBNAME=$libname LDFLAGS="\$(LDFLAGS)" \\ - CC="\$(CC)" CFLAGS="\$(CFLAGS)" \\ - SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" \\ + PERL=\$(PERL) SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\ + LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\ + LIBNAME=$libname LDFLAGS='\$(LDFLAGS)' \\ + CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\ + SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\ SHLIB_EXT=$dsoext \\ LIBEXTRAS="$objs" \\ link_dso.$shlib_target @@ -1019,9 +998,9 @@ $bin$exeext: $objs $deps \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ PERL=\$(PERL) SRCDIR=\$(SRCDIR) \\ APPNAME=$bin$exeext OBJECTS="$objs" \\ - LIBDEPS="\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)" \\ - CC="\$(CC)" CFLAGS="\$(CFLAGS)" LDFLAGS="\$(LDFLAGS)" \\ - LIBRPATH="\$(INSTALLTOP)/\$(LIBDIR)" \\ + LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\ + CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\ + LDFLAGS='\$(LDFLAGS)' LIBRPATH='\$(INSTALLTOP)/\$(LIBDIR)' \\ link_app.$shlib_target EOF }