do not remove links found in .git directory
[openssl.git] / Configurations / unix-Makefile.tmpl
index 9c8a4619c97df4af7496bfb4c09703da8489225d..a31867ed3203947d9ba70cdee5d9eeed88a46a0a 100644 (file)
@@ -86,10 +86,12 @@ DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
 {- output_on() if $disabled{makedepend}; "" -}
 GENERATED={- join(" ", map { (my $x = $_) =~ s|\.S$|\.s|; $x } 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
+{- output_on() if $disabled{apps}; "" -}
 
 SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -}
 
@@ -170,7 +172,7 @@ LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag}
 RCFLAGS={- $target{shared_rcflag} -}
 DSO_CFLAGS={- $target{shared_cflag} || "" -}
 DSO_LDFLAGS=$(LIB_LDFLAGS)
-BIN_CFLAGS={- "" -}
+BIN_CFLAGS={- $target{bin_cflags} -}
 
 PERL={- $config{perl} -}
 
@@ -215,14 +217,19 @@ 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 link-utils
+test: tests
+tests: build_tests_nodep build_apps_nodep build_engines_nodep \
+       depend link-utils
+       @ : {- output_off() if $disabled{tests}; "" -}
        ( cd test; \
          SRCTOP=../$(SRCDIR) \
          BLDTOP=../$(BLDDIR) \
          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
@@ -252,7 +259,7 @@ 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)
 
 # This exists solely for those who still type 'make depend'
@@ -615,7 +622,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 +654,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 )
@@ -711,8 +727,7 @@ dist:
 
 # Helper targets #####################################################
 
-link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/shlib_wrap.sh \
-           $(BLDDIR)/test/generate_ssl_tests.pl
+link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/shlib_wrap.sh
 
 $(BLDDIR)/util/opensslwrap.sh: configdata.pm
        @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
@@ -724,11 +739,6 @@ $(BLDDIR)/util/shlib_wrap.sh: configdata.pm
            mkdir -p "$(BLDDIR)/util"; \
            ln -sf "../$(SRCDIR)/util/shlib_wrap.sh" "$(BLDDIR)/util"; \
        fi
-$(BLDDIR)/test/generate_ssl_tests.pl: configdata.pm
-       @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
-           mkdir -p "$(BLDDIR)/test"; \
-           ln -sf "../$(SRCDIR)/test/generate_ssl_tests.pl" "$(BLDDIR)/test"; \
-       fi
 FORCE:
 
 # Building targets ###################################################
@@ -807,19 +817,20 @@ 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";
 $args{src}: $args{generator}->[0] $deps
-       \$(PERL) $generator > \$@
+       \$(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 {
@@ -835,7 +846,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....
@@ -846,7 +859,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
       }
   }
@@ -866,6 +880,11 @@ EOF
       my $srcs = join(" ",  @srcs);
       my $deps = join(" ", @srcs, @{$args{deps}});
       my $incs = join("", map { " -I".$_ } @{$args{incs}});
+      unless ($disabled{zlib}) {
+          if ($withargs{zlib_include}) {
+              $incs .= " -I".$withargs{zlib_include};
+          }
+      }
       my $ecflags = { lib => '$(LIB_CFLAGS)',
                       dso => '$(DSO_CFLAGS)',
                       bin => '$(BIN_CFLAGS)' } -> {$args{intent}};