Skip to content

Commit c4d508c

Browse files
rioderelftenikic
authored andcommitted
Add dependency tracking for header files
This ensures all .c files which include a header file directly or indirectly are rebuilt whenever the header file is changed. Closes GH-6693.
1 parent e727919 commit c4d508c

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
# Standard object files generated during build process
4242
*.o
4343

44+
# Dependency files generated during build process
45+
*.dep
46+
4447
# Cache directories created by Autoconf tools
4548
autom4te.cache/
4649

build/Makefile.global

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ test: all
111111

112112
clean:
113113
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
114-
find . -name \*.lo -o -name \*.o | xargs rm -f
114+
find . -name \*.lo -o -name \*.o -o -name \*.dep | xargs rm -f
115115
find . -name \*.la -o -name \*.a | xargs rm -f
116116
find . -name \*.so | xargs rm -f
117117
find . -name .libs -a -type d|xargs rm -rf
@@ -156,9 +156,5 @@ prof-use:
156156
fi; \
157157
fi;
158158

159-
# As we don't track includes, this is just a heuristic
160-
%.c: %_arginfo.h
161-
@touch $@
162-
163159
.PHONY: all clean install distclean test prof-gen prof-clean prof-use
164160
.NOEXPORT:

build/php.m4

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,12 @@ dnl Choose the right compiler/flags/etc. for the source-file.
257257
*.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" ;;
258258
esac
259259
260+
dnl Generate Makefiles with dependencies
261+
ac_comp="$ac_comp -MMD -MF $ac_bdir$ac_obj.dep -MT $ac_bdir[$]ac_obj.lo"
262+
260263
dnl Create a rule for the object/source combo.
261264
cat >>Makefile.objects<<EOF
265+
-include $ac_bdir[$]ac_obj.dep
262266
$ac_bdir[$]ac_obj.lo: $ac_srcdir[$]ac_src
263267
$ac_comp
264268
EOF

0 commit comments

Comments
 (0)