Skip to content

Commit 3bfe30a

Browse files
committed
Makefile.include: only keep macros in riotbuild.h
Rely on creating an intermediate riotbuild.h.in file that is updated on CFLAGS changes, but then generate 'riotbuild.h' without the comments. The updated timestamp will still trigger a rebuild but not cause ccache miss due to the content of the CFLAGS that contains absolute path. This removes the caching issue due to the absolute path that was added to `CFLAGS` and so the comment in that file.
1 parent 49aa83e commit 3bfe30a

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

Makefile.include

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -786,9 +786,22 @@ endif
786786
include $(RIOTTOOLS)/desvirt/Makefile.desvirt
787787

788788
# Build a header file with all common macro definitions and undefinitions
789-
# make it depend on FORCE to re-run of the script every time even if the file exists
790-
# The script will only touch the file if anything has changed since last time.
791-
$(RIOTBUILD_CONFIG_HEADER_C): FORCE
789+
# Everytime the header is updated, it will trigger a new compilation.
790+
#
791+
# The file is created first through a `.in` file that will be modified if
792+
# any CFLAGS changed. It depends on FORCE to re-run of the script every time
793+
# even if the file exists but the file will only be updated on modifications.
794+
#
795+
# The header is then created by keeping only the macros. Keeping the
796+
# comments added absolute path in the file that screwed caching.
797+
#
798+
# The rebuild behavior could even only be done with an empty file, but currently
799+
# some macros definitions are passed through this file.
800+
$(RIOTBUILD_CONFIG_HEADER_C): $(RIOTBUILD_CONFIG_HEADER_C).in
801+
$(Q)sed -n -e '1i /* Generated file do not edit */' -e '/^#.*/ p' $< > $@
802+
803+
.SECONDARY: $(RIOTBUILD_CONFIG_HEADER_C).in
804+
$(RIOTBUILD_CONFIG_HEADER_C).in: FORCE | $(CLEAN)
792805
@mkdir -p '$(dir $@)'
793806
$(Q)'$(RIOTTOOLS)/genconfigheader/genconfigheader.sh' $(CFLAGS_WITH_MACROS) \
794807
| '$(LAZYSPONGE)' $(LAZYSPONGE_FLAGS) '$@'

0 commit comments

Comments
 (0)