]> granicus.if.org Git - php/commitdiff
Add dependency tracking for header files
authorFlorian Sowade <f.sowade@suora.com>
Sun, 14 Feb 2021 19:07:54 +0000 (20:07 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 16 Feb 2021 09:50:03 +0000 (10:50 +0100)
This ensures all .c files which include a header file directly or
indirectly are rebuilt whenever the header file is changed.

Closes GH-6693.

.gitignore
build/Makefile.global
build/php.m4

index 1eab1d32ac417568cd985478606127cfadb1480e..78dcc1f7ac2ff65f53df0c03f159c86918e4c86a 100644 (file)
@@ -41,6 +41,9 @@
 # Standard object files generated during build process
 *.o
 
+# Dependency files generated during build process
+*.dep
+
 # Cache directories created by Autoconf tools
 autom4te.cache/
 
index ae797408b5fe919dfdb5dbf367f176a93b133097..c558c107a7a7e86f9845586c71f1e082bd31dd29 100644 (file)
@@ -111,7 +111,7 @@ test: all
 
 clean:
        find . -name \*.gcno -o -name \*.gcda | xargs rm -f
-       find . -name \*.lo -o -name \*.o | xargs rm -f
+       find . -name \*.lo -o -name \*.o -o -name \*.dep | xargs rm -f
        find . -name \*.la -o -name \*.a | xargs rm -f
        find . -name \*.so | xargs rm -f
        find . -name .libs -a -type d|xargs rm -rf
@@ -156,9 +156,5 @@ prof-use:
                fi; \
        fi;
 
-# As we don't track includes, this is just a heuristic
-%.c: %_arginfo.h
-       @touch $@
-
 .PHONY: all clean install distclean test prof-gen prof-clean prof-use
 .NOEXPORT:
index 70abfc864c869957970e3e321655e41be5d43ffa..04651f01e2d2cf50f4746c13ca06d968f709835e 100644 (file)
@@ -257,8 +257,12 @@ dnl Choose the right compiler/flags/etc. for the source-file.
         *.cpp|*.cc|*.cxx[)] ac_comp="$b_cxx_pre $ac_inc $b_cxx_meta $3 -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $b_cxx_post" ;;
       esac
 
+dnl Generate Makefiles with dependencies
+      ac_comp="$ac_comp -MMD -MF $ac_bdir$ac_obj.dep -MT $ac_bdir[$]ac_obj.lo"
+
 dnl Create a rule for the object/source combo.
     cat >>Makefile.objects<<EOF
+-include $ac_bdir[$]ac_obj.dep
 $ac_bdir[$]ac_obj.lo: $ac_srcdir[$]ac_src
        $ac_comp
 EOF