]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: makefile: do not erase build options for some build options
authorWilly Tarreau <w@1wt.eu>
Wed, 24 May 2023 14:18:39 +0000 (16:18 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 24 May 2023 14:23:24 +0000 (16:23 +0200)
One painfully annoying thing with the build options change detection
is that they get rebuild for about everything except when the build
target is exactly "reg-tests". But in practice every time reg tests
are run we end up having to experience a full rebuild because the
reg-tests script runs "make version" which is sufficient to refresh
the file.

There are two issues here. The first one is that we ought to skip all
targets that do not make use of the build options. This includes all
the tools such as "flags" for example, or utility targets like "tags",
"help" or "version". The second issue is that with most of these extra
targets we do not set the TARGET variable, and that one is used when
creating the build_opts file, so let's preserve the file when TARGET
is not set.

Now it's possible to re-run a make after a make reg-tests without having
to rebuild the whole project.

Makefile

index e51a0c3ca7ea579fb9d4705503ab14175726302e..fad48cca67d357ecb7276b44b41425161ca19f97 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -970,13 +970,21 @@ help:
           fi
 
 # Used only to force a rebuild if some build options change, but we don't do
-# it for certain targets which take no build options
-ifneq (reg-tests, $(firstword $(MAKECMDGOALS)))
+# it for certain build targets which take no build options nor when the
+# TARGET variable is not set since we're not building, by definition.
+IGNORE_OPTS=help install install-man install-doc install-bin \
+       uninstall clean tags cscope tar git-tar version update-version \
+       opts reg-tests reg-tests-help admin/halog/halog dev/flags/flags \
+       dev/haring/haring dev/poll/poll dev/tcploop/tcploop
+
+ifneq ($(TARGET),)
+ifeq ($(filter $(firstword $(MAKECMDGOALS)),$(IGNORE_OPTS)),)
 build_opts = $(shell rm -f .build_opts.new; echo \'$(TARGET) $(BUILD_OPTIONS) $(VERBOSE_CFLAGS) $(DEBUG)\' > .build_opts.new; if cmp -s .build_opts .build_opts.new; then rm -f .build_opts.new; else mv -f .build_opts.new .build_opts; fi)
 .build_opts: $(build_opts)
 else
 .build_opts:
-endif # reg-tests
+endif # ignore_opts
+endif # non-empty target
 
 haproxy: $(OPTIONS_OBJS) $(OBJS)
        $(cmd_LD) $(LDFLAGS) -o $@ $^ $(LDOPTS)