Skip to content

Commit c6c5694

Browse files
committed
make: remake TG-BUILD-SETTINGS and TG-TEST-SETTINGS on config mods
If config.sh and/or config.mak are changed be sure to rebuild TG-BUILD-SETTINGS and TG-TEST-SETTINGS (of course only changing the mod date on them if anything actually ended up changing). And make `make settings` work at the top-level too. Signed-off-by: Kyle J. McKay <[email protected]>
1 parent 55c198d commit c6c5694

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Anything explicitly listed here will always avoid a bogus "up to date" result
1414
TARGETS = \
1515
all clean tg awk hooks helpers doc html \
16-
precheck TG-BUILD-SETTINGS \
16+
precheck TG-BUILD-SETTINGS settings \
1717
install install-doc install-html \
1818
tg--awksome tg-tg.txt topgit.html \
1919
shell_compatibility_test \

Makefile.mak

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ all: \
1616
tg $(commands_out) $(utils_out) $(awk_out) $(hooks_out) $(helpers_out) \
1717
bin-wrappers/tg bin-wrappers/pre-commit $(help_out) tg-tg.txt
1818

19+
settings: TG-BUILD-SETTINGS FORCE
20+
+$(Q)cd t && $(MAKE) settings
21+
1922
awk: $(awk_out)
2023
hooks: $(hooks_out)
2124
helpers: $(helpers_out)
@@ -185,11 +188,11 @@ bs() { printf "%s\\n" \
185188
# make -f Makefile.mak TG-BUILD-SETTINGS thus avoiding this always
186189
# causing the targets that depend on it to build while still forcing
187190
# a rebuild if any settings actually change.
188-
TG-BUILD-SETTINGS: $(FORCE_SETTINGS_BUILD)
191+
TG-BUILD-SETTINGS: $(CONFIGDEPS) $(FORCE_SETTINGS_BUILD)
189192
$(Q)$(BUILD_SETTINGS);if test x"$$(bs)" != x"`cat \"$@\" 2>/dev/null`"; then \
190193
echo "* new build settings"; \
191194
bs >"$@"; \
192-
fi
195+
elif test z"$(FORCE_SETTINGS_BUILD)" = z; then touch "$@"; fi
193196

194197
test: all FORCE
195198
+$(Q)cd t && $(MAKE) all

gnomake.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,24 @@ set -e
2020
# If MKTOP is set, they are looked for there instead of in
2121
# the current directory.
2222
#
23+
# The CONFIGDEPS variable will be set to the ones that exist
24+
# (for use in dependency lines).
25+
#
2326
# wrap it up for safety
2427
configsh() {
25-
! [ -f "${MKTOP:+$MKTOP/}config.sh" ] ||
26-
. ./"${MKTOP:+$MKTOP/}config.sh"
28+
[ z"$MKTOP" = z"/" ] || MKTOP="${MKTOP%/}"
29+
CONFIGDEPS=
30+
! [ -f "${MKTOP:+$MKTOP/}config.sh" ] || {
31+
. ./"${MKTOP:+$MKTOP/}config.sh"
32+
CONFIGDEPS="${CONFIGDEPS:+$CONFIGDEPS }${MKTOP:+$MKTOP/}config.sh"
33+
}
2734
# now set CONFIGMAK and make it an absolute path
2835
[ -n "$CONFIGMAK" ] || CONFIGMAK="${MKTOP:+$MKTOP/}config.mak"
29-
[ -f "$CONFIGMAK" ] || CONFIGMAK="${MKTOP:+$MKTOP/}Makefile.mt"
36+
if [ -f "$CONFIGMAK" ]; then
37+
CONFIGDEPS="${CONFIGDEPS:+$CONFIGDEPS }$CONFIGMAK"
38+
else
39+
CONFIGMAK="${MKTOP:+$MKTOP/}Makefile.mt"
40+
fi
3041
case "$CONFIGMAK" in */?*);;*) CONFIGMAK="./$CONFIGMAK"; esac
3142
CONFIGMAK="$(cd "${CONFIGMAK%/*}" && pwd)/${CONFIGMAK##*/}"
3243
}

t/Makefile.mak

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ TEST_TARGET = $(TEST_TARGET_$(DEFAULT_TEST_TARGET_))
110110
all: $(TEST_TARGET)
111111

112112
settings: TG-TEST-SETTINGS
113+
-@true # avoids the "Nothing to be done" message
113114

114115
test: pre-clean TG-TEST-SETTINGS $(TEST_LINT) FORCE
115116
$(Q)set -m && $(CACHE_SETUP_TTY) $(MAKE) $${GNO_PD_OPT} -f Makefile.mak aggregate-results-and-cleanup
@@ -197,11 +198,11 @@ ts() { printf "%s\\n" \
197198
': "$${GIT_MINIMUM_VERSION:=$$TG_GIT_MINIMUM_VERSION}"' \
198199
;}
199200

200-
TG-TEST-SETTINGS: $(FORCE_SETTINGS_BUILD)
201+
TG-TEST-SETTINGS: $(CONFIGDEPS) $(FORCE_SETTINGS_BUILD)
201202
$(Q)$(TEST_SETTINGS);if test x"$$(ts)" != x"`cat \"$@\" 2>/dev/null`"; then \
202203
echo "* new test settings"; \
203204
ts >"$@"; \
204-
fi
205+
elif test z"$(FORCE_SETTINGS_BUILD)" = z; then touch "$@"; fi
205206

206207
FORCE: __file_which_should_not_exist
207208

0 commit comments

Comments
 (0)