X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=Configurations%2Funix-Makefile.tmpl;h=1c85637f49db10d1669ee9571ddac94090b2f873;hp=608c20417f3a4ead966d9ec927e9ef2a053cf324;hb=e3fb4d3d52e188b83ccb8506aa2f16cb686f4d6c;hpb=715d69b0d5fb5b873a923fc3f5c7b441ad73003c diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index 608c20417f..1c85637f49 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -153,6 +153,10 @@ LIBDIR={- # ENGINESDIR={- use File::Spec::Functions; catdir($prefix,$libdir,"engines-$sover") -} +# Convenience variable for those who want to set the rpath in shared +# libraries and applications +LIBRPATH=$(INSTALLTOP)/$(LIBDIR) + MANDIR=$(INSTALLTOP)/share/man DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME) HTMLDIR=$(DOCDIR)/html @@ -169,27 +173,19 @@ CROSS_COMPILE= {- $config{cross_compile_prefix} -} CC= $(CROSS_COMPILE){- $target{cc} -} CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -} CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -} +CXX= $(CROSS_COMPILE){- $target{cxx} -} +CXXFLAGS={- our $cxxflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cxxflags} -} {- $config{cxxflags} -} -std=c++11 LDFLAGS= {- $target{lflags} -} PLIB_LDFLAGS= {- $target{plib_lflags} -} EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -} 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)" : "") -} +LIB_CXXFLAGS={- $target{shared_cxxflag} || "" -} +LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} -} DSO_CFLAGS={- $target{shared_cflag} || "" -} +DSO_CXXFLAGS={- $target{shared_cxxflag} || "" -} DSO_LDFLAGS=$(LIB_LDFLAGS) BIN_CFLAGS={- $target{bin_cflags} -} +BIN_CXXFLAGS={- $target{bin_cxxflag} || "" -} PERL={- $config{perl} -} @@ -255,6 +251,7 @@ test: tests PERL="$(PERL)" \ EXE_EXT={- $exeext -} \ OPENSSL_ENGINES=../$(BLDDIR)/engines \ + OPENSSL_DEBUG_MEMORY=on \ $(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" @@ -301,14 +298,12 @@ distclean: clean $(RM) configdata.pm $(RM) Makefile -# 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. depend: @: {- output_off() if $disabled{makedepend}; "" -} - @if [ -n "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then \ - ( sed -e '/^# DO NOT DELETE THIS LINE.*/,$$d' < Makefile; \ + @if egrep "^# DO NOT DELETE THIS LINE" Makefile >/dev/null && [ -z "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then :; else \ + ( $(PERL) -pe 'exit 0 if /^# DO NOT DELETE THIS LINE.*/' < Makefile; \ echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \ echo; \ for f in $(DEPS); do \ @@ -350,11 +345,20 @@ install_ssldirs: @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.dist - @if ! [ -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \ + @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \ echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ fi + @echo "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" + @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new + @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new + @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist + @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \ + echo "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ + cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \ + chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \ + fi install_dev: @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) @@ -570,12 +574,9 @@ PROCESS_PODS=\ set -e; \ here=`cd $(SRCDIR); pwd`; \ point=$$here/util/point.sh; \ - for ds in apps:1 crypto:3 ssl:3; do \ - defdir=`echo $$ds | cut -f1 -d:`; \ - defsec=`echo $$ds | cut -f2 -d:`; \ - for p in $(SRCDIR)/doc/$$defdir/*.pod; do \ - SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \ - [ -z "$$SEC" ] && SEC=$$defsec; \ + for ds in man1 man3 man5 man7 ; do \ + SEC=`echo $$ds | sed -e s/man//`; \ + for p in $(SRCDIR)/doc/$$ds/*.pod; do \ fn=`basename $$p .pod`; \ Name=$$fn; \ NAME=`echo $$fn | tr '[a-z]' '[A-Z]'`; \ @@ -605,12 +606,9 @@ PROCESS_PODS=\ UNINSTALL_DOCS=\ set -e; \ here=`cd $(SRCDIR); pwd`; \ - for ds in apps:1 crypto:3 ssl:3; do \ - defdir=`echo $$ds | cut -f1 -d:`; \ - defsec=`echo $$ds | cut -f2 -d:`; \ - for p in $(SRCDIR)/doc/$$defdir/*.pod; do \ - SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \ - [ -z "$$SEC" ] && SEC=$$defsec; \ + for ds in man1 man3 man5 man7 ; do \ + SEC=`echo $$ds | sed -e s/man//`; \ + for p in $(SRCDIR)/doc/$$ds/*.pod; do \ fn=`basename $$p .pod`; \ suf=`eval "echo $$OUTSUFFIX"`; \ top=`eval "echo $$OUTTOP"`; \ @@ -771,22 +769,18 @@ tar: cd $(SRCDIR); ls -l $(TARFILE).gz dist: - @$(MAKE) PREPARE_CMD='./Configure dist' tar + @$(MAKE) PREPARE_CMD='$(PERL) ./Configure dist' tar # Helper targets ##################################################### -link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/shlib_wrap.sh +link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/opensslwrap.sh: configdata.pm @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ mkdir -p "$(BLDDIR)/util"; \ ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \ fi -$(BLDDIR)/util/shlib_wrap.sh: configdata.pm - @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ - mkdir -p "$(BLDDIR)/util"; \ - ln -sf "../$(SRCDIR)/util/shlib_wrap.sh" "$(BLDDIR)/util"; \ - fi + FORCE: # Building targets ################################################### @@ -797,6 +791,7 @@ libcrypto.pc: echo 'exec_prefix=$${prefix}'; \ echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ echo 'includedir=$${prefix}/include'; \ + echo 'enginesdir=$${libdir}/engines-{- $sover -}'; \ echo ''; \ echo 'Name: OpenSSL-libcrypto'; \ echo 'Description: OpenSSL cryptography library'; \ @@ -830,10 +825,10 @@ openssl.pc: echo 'Version: '$(VERSION); \ echo 'Requires: libssl libcrypto' ) > openssl.pc -configdata.pm: {- $config{build_file_template} -} $(SRCDIR)/Configurations/common.tmpl $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_infos}}) -} +configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -} @echo "Detected changed: $?" @echo "Reconfiguring..." - $(SRCDIR)/Configure reconf + $(PERL) $(SRCDIR)/Configure reconf @echo "**************************************************" @echo "*** ***" @echo "*** Please run the same make command again ***" @@ -940,42 +935,49 @@ EOF $incs .= " -I".$withargs{zlib_include}; } } - my $ecflags = { lib => '$(LIB_CFLAGS)', - dso => '$(DSO_CFLAGS)', - bin => '$(BIN_CFLAGS)' } -> {$args{intent}}; + my $cc = '$(CC)'; + my $cflags = '$(CFLAGS)'; + if (grep /\.(cc|cpp)$/, @srcs) { + $cc = '$(CXX)'; + $cflags = '$(CXXFLAGS)'; + $cflags .= ' ' . { lib => '$(LIB_CXXFLAGS)', + dso => '$(DSO_CXXFLAGS)', + bin => '$(BIN_CXXFLAGS)' } -> {$args{intent}}; + } else { + $cflags .= ' ' . { lib => '$(LIB_CFLAGS)', + dso => '$(DSO_CFLAGS)', + bin => '$(BIN_CFLAGS)' } -> {$args{intent}}; + } my $makedepprog = $config{makedepprog}; - my $recipe = ""; - if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) { + my $recipe = <<"EOF"; +$obj$objext: $deps +EOF + if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) { $recipe .= <<"EOF"; -$obj$depext: $deps - -\$(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 \\ - rm -f \$\@.tmp; \\ + $cc $incs $cflags -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; \\ else \\ - mv \$\@.tmp \$\@; \\ + mv $obj$depext.tmp $obj$depext; \\ fi EOF - $deps = $obj.$depext; - } - if ($disabled{makedepend} || $makedepprog =~ /\/makedepend/) { + } else { $recipe .= <<"EOF"; -$obj$objext: $deps - \$(CC) $incs \$(CFLAGS) $ecflags -c -o \$\@ $srcs + $cc $incs $cflags -c -o \$\@ $srcs EOF - } - if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) { - $recipe .= <<"EOF"; -$obj$objext: $deps - \$(CC) $incs \$(CFLAGS) $ecflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs - \@touch $obj$depext.tmp + if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) { + $recipe .= <<"EOF"; + -\$(MAKEDEPEND) -f- -o"|\$\@" -- $incs $cflags -- $srcs \\ + >$obj$depext.tmp 2>/dev/null + -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' $obj$depext.tmp \@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 + } } return $recipe; } @@ -1077,6 +1079,12 @@ EOF (my $l = $f) =~ s/^lib//; " -L$d -l$l" } @{$args{deps}}); my $shlib_target = $disabled{shared} ? "" : $target{shared_target}; + my $cc = '$(CC)'; + my $cflags = '$(CFLAGS) $(BIN_CFLAGS)'; + if (grep /_cc$/, @{$args{objs}}) { + $cc = '$(CXX)'; + $cflags = '$(CXXFLAGS) $(BIN_CXXFLAGS)'; + } return <<"EOF"; $bin$exeext: $objs $deps \$(RM) $bin$exeext @@ -1084,8 +1092,8 @@ $bin$exeext: $objs $deps PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\ APPNAME=$bin$exeext OBJECTS="$objs" \\ LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\ - CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\ - LDFLAGS='\$(LDFLAGS)' LIBRPATH='\$(INSTALLTOP)/\$(LIBDIR)' \\ + CC='$cc' CFLAGS='$cflags' \\ + LDFLAGS='\$(LDFLAGS)' \\ link_app.$shlib_target EOF }