CLEANUP: makefile: make the output of the "opts" target more readable

"make opts" is nice because it shows all options being used, but it
does so in a copy-pastable way that aggregates everything on a single
line, rendering very poorly and making it hard to spot the relevant
variables.

Let's break lines and append a trailing backslash to them instead. This
gives something much more readable which remains copy-pastable. Options
can be inspected and more easily replicated. It was also verified that
copy-pasting the whole block after "make" does continue to work like
before and produces the same output.
This commit is contained in:
Willy Tarreau 2024-04-11 17:20:42 +02:00
parent ac73a23454
commit 8e0263323c
1 changed files with 18 additions and 19 deletions

View File

@ -1168,31 +1168,30 @@ update-version:
# settings are also listed if they're explicitly set on the command line, or if # settings are also listed if they're explicitly set on the command line, or if
# they are not empty. Implicit "USE_*" are not listed. # they are not empty. Implicit "USE_*" are not listed.
opts: opts:
@echo -n 'Using: ' @echo 'Using the following variables (copy-pastable as make arguments):'
@echo -n 'TARGET="$(strip $(TARGET))" ' @echo ' TARGET="$(strip $(TARGET))" '\\
@echo -n 'ARCH="$(strip $(ARCH))" ' @echo ' ARCH="$(strip $(ARCH))" '\\
@echo -n 'CC="$(strip $(CC))" ' @echo ' CC="$(strip $(CC))" '\\
@echo -n 'OPT_CFLAGS="$(strip $(OPT_CFLAGS))" ' @echo ' OPT_CFLAGS="$(strip $(OPT_CFLAGS))" '\\
@echo -n 'ARCH_FLAGS="$(strip $(ARCH_FLAGS))" ' @echo ' ARCH_FLAGS="$(strip $(ARCH_FLAGS))" '\\
@echo -n 'CPU_CFLAGS="$(strip $(CPU_CFLAGS))" ' @echo ' CPU_CFLAGS="$(strip $(CPU_CFLAGS))" '\\
@echo -n 'STD_CFLAGS="$(strip $(STD_CFLAGS))" ' @echo ' STD_CFLAGS="$(strip $(STD_CFLAGS))" '\\
@echo -n 'WARN_CFLAGS="$(strip $(WARN_CFLAGS))" ' @echo ' WARN_CFLAGS="$(strip $(WARN_CFLAGS))" '\\
@echo -n 'NOWARN_CFLAGS="$(strip $(NOWARN_CFLAGS))" ' @echo ' NOWARN_CFLAGS="$(strip $(NOWARN_CFLAGS))" '\\
@echo -n 'ERROR_CFLAGS="$(strip $(ERROR_CFLAGS))" ' @echo ' ERROR_CFLAGS="$(strip $(ERROR_CFLAGS))" '\\
@echo -n 'CFLAGS="$(strip $(CFLAGS))" ' @echo ' CFLAGS="$(strip $(CFLAGS))" '\\
@#echo "$(strip $(BUILD_OPTIONS))"
@$(foreach opt,$(enabled_opts),\ @$(foreach opt,$(enabled_opts),\
$(if $(subst command line,,$(origin USE_$(opt))),,\ $(if $(subst command line,,$(origin USE_$(opt))),,\
echo -n 'USE_$(opt)=$(USE_$(opt:0=)) ';) \ echo ' USE_$(opt)=$(USE_$(opt:0=)) '\\;) \
$(if $(subst command line,,$(origin $(opt)_CFLAGS)),\ $(if $(subst command line,,$(origin $(opt)_CFLAGS)),\
$(if $($(opt)_CFLAGS),echo -n '$(opt)_CFLAGS="$($(opt)_CFLAGS)" ';),\ $(if $($(opt)_CFLAGS),echo ' $(opt)_CFLAGS="$($(opt)_CFLAGS)" '\\;),\
echo -n '$(opt)_CFLAGS="$($(opt)_CFLAGS)" ';) \ echo ' $(opt)_CFLAGS="$($(opt)_CFLAGS)" '\\;) \
$(if $(subst command line,,$(origin $(opt)_LDFLAGS)),\ $(if $(subst command line,,$(origin $(opt)_LDFLAGS)),\
$(if $($(opt)_LDFLAGS),echo -n '$(opt)_LDFLAGS="$($(opt)_LDFLAGS)" ';),\ $(if $($(opt)_LDFLAGS),echo ' $(opt)_LDFLAGS="$($(opt)_LDFLAGS)" '\\;),\
echo -n '$(opt)_LDFLAGS="$($(opt)_LDFLAGS)" ';)) echo ' $(opt)_LDFLAGS="$($(opt)_LDFLAGS)" '\\;))
@echo ' LDFLAGS="$(strip $(LDFLAGS))"'
@echo @echo
@echo 'COPTS="$(strip $(COPTS))"' @echo 'COPTS="$(strip $(COPTS))"'
@echo 'LDFLAGS="$(strip $(LDFLAGS))"'
@echo 'LDOPTS="$(strip $(LDOPTS))"' @echo 'LDOPTS="$(strip $(LDOPTS))"'
@echo 'OPTIONS_OBJS="$(strip $(OPTIONS_OBJS))"' @echo 'OPTIONS_OBJS="$(strip $(OPTIONS_OBJS))"'
@echo 'OBJS="$(strip $(OBJS))"' @echo 'OBJS="$(strip $(OBJS))"'