Remove mandatory generated files too
[openssl.git] / Configurations / unix-Makefile.tmpl
index 46a4866e25f6e720429851ea9eac0898f92a7098..f23dff47e04085de06d5d5c53ff9332fe56db5fc 100644 (file)
@@ -353,6 +353,11 @@ build_apps build_tests: build_programs
 # Convenience target to prebuild all generated files, not just the mandatory
 # ones
 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
+       @ : {- output_off() if $disabled{makedepend}; "" -}
+       @echo "Warning: consider configuring with no-makedepend, because if"
+       @echo "         target system doesn't have $(PERL),"
+       @echo "         then make will fail..."
+       @ : {- output_on() if $disabled{makedepend}; "" -}
 
 test: tests
 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils
@@ -385,9 +390,13 @@ uninstall: uninstall_docs uninstall_sw
 
 libclean:
        @set -e; for s in $(SHLIB_INFO); do \
+               if [ "$$s" = ";" ]; then continue; fi; \
                s1=`echo "$$s" | cut -f1 -d";"`; \
                s2=`echo "$$s" | cut -f2 -d";"`; \
-               $(ECHO) $(RM) $$s1; \
+               $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
+               $(RM) apps/$$s1; \
+               $(RM) test/$$s1; \
+               $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
                $(RM) $$s1; \
                if [ "$$s1" != "$$s2" ]; then \
                        $(ECHO) $(RM) $$s2; \
@@ -399,7 +408,7 @@ libclean:
 
 clean: libclean
        $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
-       $(RM) $(GENERATED)
+       $(RM) $(GENERATED_MANDATORY) $(GENERATED)
        -$(RM) `find . -name '*{- $depext -}' -a \! -path "./.git/*"`
        -$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"`
        $(RM) core
@@ -974,7 +983,6 @@ EOF
           $cmd = '$(RC)';
           $cmdflags = '$(RCFLAGS)';
           $cmdcompile = '';
-          $makedepprog = undef;
       } elsif (grep /\.(cc|cpp)$/, @srcs) {
           $cmd = '$(CXX)';
           $cmdcompile = ' -c';
@@ -1000,20 +1008,17 @@ $obj$objext: $deps
        $cmd $cmdflags -c -o \$\@ $srcs
 EOF
       } elsif (grep /\.S$/, @srcs) {
-          # In case one wonders why not just $(CC) -c file.S. While it
-          # does work with contemporary compilers, there are some legacy
-          # ones that get it wrong. Hence the elaborate scheme... We
-          # don't care to maintain dependecy lists, because dependency
-          # is rather weak, at most one header file that lists constants
-          # which are assigned in ascending order.
+          # Originally there was mutli-step rule with $(CC) -E file.S
+          # followed by $(CC) -c file.s. It compensated for one of
+          # legacy platform compiler's inability to handle .S files.
+          # The platform is long discontinued by vendor so there is
+          # hardly a point to drag it along...
           $recipe .= <<"EOF";
 $obj$objext: $deps
-       ( trap "rm -f \$@.*" INT 0; \\
-         \$(CC) $incs $cmdflags -E $srcs | \\
-         \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.s && \\
-         $cmd $cmdflags -c -o \$\@ \$@.s )
+       $cmd $incs $cmdflags -c -o \$\@ $srcs
 EOF
-      } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/) {
+      } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/
+               && !grep /\.rc$/, @srcs) {
           $recipe .= <<"EOF";
 $obj$objext: $deps
        $cmd $incs $cmdflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs