]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
src/Makefile: fix number sign handling in macro
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Wed, 1 Mar 2023 08:03:01 +0000 (17:03 +0900)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 2 Mar 2023 06:25:44 +0000 (15:25 +0900)
GNU make version 4.3 introduced a backward-incompatible change. The
number sign '#' now should not have preceding backslash in a macro [1].
To make macros with number signs work regardless of make versions,
assign the number sign to a variable.

[1] https://lwn.net/Articles/810071/

Reported-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
Link: https://lore.kernel.org/linux-block/cfccc895-5a9b-f45b-5851-74c94219d743@linux.alibaba.com/
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
src/Makefile

index 81c654116bcef6246c7e6f384f6346ce85b9e70c..cbb0b258f16a199bf4cbd6ba9cda639ecd8425f4 100644 (file)
@@ -1,8 +1,10 @@
-HAVE_C_HEADER = $(shell if echo "\#include <$(1)>" |           \
+H := \#
+
+HAVE_C_HEADER = $(shell if echo "$(H)include <$(1)>" |         \
                $(CC) -E - > /dev/null 2>&1; then echo "$(2)";  \
                else echo "$(3)"; fi)
 
-HAVE_C_MACRO = $(shell if echo "#include <$(1)>" |     \
+HAVE_C_MACRO = $(shell if echo "$(H)include <$(1)>" |  \
                $(CC) -E - 2>&1 /dev/null | grep $(2) > /dev/null 2>&1; \
                then echo 1;else echo 0; fi)