[PATCH blktests] src/Makefile: fix number sign handling in macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx>
Link: https://lore.kernel.org/linux-block/cfccc895-5a9b-f45b-5851-74c94219d743@xxxxxxxxxxxxxxxxx/
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@xxxxxxx>
---
This patch can be applied on top of Ming Lei's series for miniublk [2].

[2] https://lore.kernel.org/linux-block/20230224124502.1720278-1-ming.lei@xxxxxxxxxx/

 src/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 81c6541..cbb0b25 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -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)
 
-- 
2.38.1




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux