Don't copy from %target to %config so much, see %config as a complement
[openssl.git] / Configurations / unix-Makefile.tmpl
index b591c4da20529d28c46671b500c7e7eb829c8ef7..8ccadbb2152e66558f2ab85815adaf729d75cfa0 100644 (file)
      # removed.  On some systems, they may therefore return the exact same
      # string.
      sub shlib {
-         return () if $config{no_shared};
+         return () if $disabled{shared};
          my $lib = shift;
          return $unified_info{sharednames}->{$lib} . $shlibext;
      }
      sub shlib_simple {
-         return () if $config{no_shared};
+         return () if $disabled{shared};
 
          my $lib = shift;
          if (windowsdll()) {
@@ -144,13 +144,13 @@ HTMLSUFFIX=html
 
 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
 CC= $(CROSS_COMPILE){- $target{cc} -}
-CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $config{cflags} -}
+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} -}
-LDFLAGS= {- $config{lflags} -}
-PLIB_LDFLAGS= {- $config{plib_lflags} -}
-EX_LIBS= {- $config{ex_libs} -}
+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}
+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.
@@ -211,7 +211,7 @@ build_apps_nodep: $(PROGRAMS) $(SCRIPTS)
 build_tests: configdata.pm build_tests_nodep depend
 build_tests_nodep: $(TESTPROGS)
 
-test tests: build_tests_nodep build_apps_nodep build_engines_nodep depend rehash
+test tests: build_tests_nodep build_apps_nodep build_engines_nodep depend
        ( cd test; \
          SRCTOP=../$(SRCDIR) \
          BLDTOP=../$(BLDDIR) \
@@ -242,7 +242,7 @@ clean: libclean
        rm -f $(PROGRAMS) $(TESTPROGS)
        rm -f `find $(BLDDIR) -name '*{- $depext -}'`
        rm -f `find $(BLDDIR) -name '*{- $objext -}'`
-       rm -f $(BLDDIR)/core $(BLDDIR)/rehash.time
+       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`
@@ -320,7 +320,7 @@ install_dev:
                mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
                      $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
        done
-       @ : {- output_off() if $config{no_shared}; "" -}
+       @ : {- output_off() if $disabled{shared}; "" -}
        @set -e; for s in $(SHLIB_INFO); do \
                s1=`echo "$$s" | cut -f1 -d";"`; \
                s2=`echo "$$s" | cut -f2 -d";"`; \
@@ -344,7 +344,7 @@ install_dev:
                      $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
                : {- output_on() unless windowsdll(); "" -}; \
        done
-       @ : {- output_on() if $config{no_shared}; "" -}
+       @ : {- output_on() if $disabled{shared}; "" -}
        @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
        @echo "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
        @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
@@ -371,7 +371,7 @@ uninstall_dev:
                echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
                $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
        done
-       @ : {- output_off() if $config{no_shared}; "" -}
+       @ : {- output_off() if $disabled{shared}; "" -}
        @set -e; for s in $(SHLIB_INFO); do \
                s1=`echo "$$s" | cut -f1 -d";"`; \
                s2=`echo "$$s" | cut -f2 -d";"`; \
@@ -389,7 +389,7 @@ uninstall_dev:
                $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
                : {- output_on() unless windowsdll(); "" -}; \
        done
-       @ : {- output_on() if $config{no_shared}; "" -}
+       @ : {- output_on() if $disabled{shared}; "" -}
        @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
        @$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
        @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
@@ -650,8 +650,6 @@ errors:
              $(PERL) ../util/mkerr.pl -conf $$e \
                      -nostatic -staticloader -write *.c; \
          done )
-       ( cd $(SRCDIR)/crypto/ct; \
-         $(PERL) ../../util/mkerr.pl -conf ct.ec -hprefix internal/ -write *.c )
 
 ordinals:
        ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
@@ -695,17 +693,6 @@ dist:
 
 # Helper targets #####################################################
 
-rehash: link-utils copy-certs build_apps_nodep
-       @if [ -z "$(CROSS_COMPILE)" ]; then \
-               (OPENSSL="$(BLDDIR)/util/shlib_wrap.sh apps/openssl"; \
-               [ -x "$(BLDDIR)/openssl.exe" ] && OPENSSL="$(BLDDIR)/openssl.exe" || :; \
-               OPENSSL_DEBUG_MEMORY=on; OPENSSL_CONF=/dev/null ; \
-               export OPENSSL OPENSSL_DEBUG_MEMORY OPENSSL_CONF; \
-               $$OPENSSL rehash certs/demo \
-               || $(PERL) tools/c_rehash certs/demo) && \
-               touch rehash.time; \
-       else :; fi
-
 link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/shlib_wrap.sh
 
 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
@@ -719,11 +706,6 @@ $(BLDDIR)/util/shlib_wrap.sh: configdata.pm
            ln -sf "../$(SRCDIR)/util/shlib_wrap.sh" "$(BLDDIR)/util"; \
        fi
 
-copy-certs: FORCE
-       @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
-           cp -R "$(SRCDIR)/certs" "$(BLDDIR)/"; \
-       fi
-
 $(SRCDIR)/apps/openssl-vms.cnf: $(SRCDIR)/apps/openssl.cnf
        $(PERL) $(SRCDIR)/VMS/VMSify-conf.pl \
                 < $(SRCDIR)/apps/openssl.cnf > $(SRCDIR)/apps/openssl-vms.cnf
@@ -814,7 +796,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)/Configure $(SRCDIR)/config
+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
@@ -832,7 +814,7 @@ configdata.pm: {- $config{build_file_template} -} $(SRCDIR)/Configure $(SRCDIR)/
   # Helper function to figure out dependencies on libraries
   # It takes a list of library names and outputs a list of dependencies
   sub compute_lib_depends {
-      if ($config{no_shared}) {
+      if ($disabled{shared}) {
           return map { $_.$libext } @_;
       }
 
@@ -856,7 +838,7 @@ configdata.pm: {- $config{build_file_template} -} $(SRCDIR)/Configure $(SRCDIR)/
           return <<"EOF";
 $obj$depext: $deps
        rm -f \$\@.tmp; touch \$\@.tmp
-       \$(MAKEDEPEND) -f\$\@.tmp -o"|$obj" -- \$(CFLAGS) $ecflags$incs -- $srcs \\
+       -\$(MAKEDEPEND) -f\$\@.tmp -o"|$obj" -- \$(CFLAGS) $ecflags$incs -- $srcs \\
            2>/dev/null
        sed -e 's/^.*|//' -e 's/ \\/\\(\\\\.\\|[^ ]\\)*//g' -e '/: *\$\$/d' -e '/^\\(#.*\\| *\\)\$\$/d' \$\@.tmp > \$\@
        rm \$\@.tmp
@@ -865,11 +847,12 @@ $obj$objext: $obj$depext
 EOF
       }
       return <<"EOF";
-$obj$depext: $deps
-       \$(CC) \$(CFLAGS) $ecflags$incs -MM -MF \$\@ -MQ $obj$objext $srcs
-       touch \$\@
-$obj$objext: $obj$depext
-       \$(CC) \$(CFLAGS) $ecflags$incs -c -o \$\@ $srcs
+$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; \\
+       fi
 EOF
   }
   # On Unix, we build shlibs from static libs, so we're ignoring the
@@ -969,7 +952,7 @@ EOF
                                     $d = "." if $d eq $f;
                                     (my $l = $f) =~ s/^lib//;
                                     " -L$d -l$l" } @{$args{deps}});
-      my $shlib_target = $config{no_shared} ? "" : $target{shared_target};
+      my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
       return <<"EOF";
 $bin$exeext: $objs $deps
        \$(RM) $bin$exeext