Skip to contentSkip to conversation

linux/linux-ext-fbtft: remove unnecessary ; \

PATCH New David Lechner 2 participants 3 messages Nov 2, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux/linux-ext-fbtft: remove unnecessary ; \

The makefile has some unnecessary instances of ; \ at the end of the lines, so remove them to make code a bit more readable.

---
 linux/linux-ext-fbtft.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
linux/linux-ext-fbtft.mk +4 -4
index 5eb3d94..64e65a1 100644
@@ -13,10 +13,10 @@ define FBTFT_PREPARE_KERNEL
 		dest=drivers/video/fbdev ; \
 	else \
 		dest=drivers/video ; \
-	fi ; \
-	mkdir -p $(LINUX_DIR)/$${dest}/fbtft; \
-	cp -dpfr $(FBTFT_DIR)/* $(LINUX_DIR)/$${dest}/fbtft/ ; \
+	fi
+	mkdir -p $(LINUX_DIR)/$${dest}/fbtft
+	cp -dpfr $(FBTFT_DIR)/* $(LINUX_DIR)/$${dest}/fbtft/
 	echo "source \"$${dest}/fbtft/Kconfig\"" \
-		>> $(LINUX_DIR)/$${dest}/Kconfig ; \
+		>> $(LINUX_DIR)/$${dest}/Kconfig
 	echo 'obj-y += fbtft/' >> $(LINUX_DIR)/$${dest}/Makefile
 endef
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 linux/linux-ext-fbtft: remove unnecessary ; \

Hello,

Quoted 15 lines · David Lechner

The makefile has some unnecessary instances of ; \ at the end of the lines, so remove them to make code a bit more readable.

---
 linux/linux-ext-fbtft.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
linux/linux-ext-fbtft.mk +0 -0
index 5eb3d94..64e65a1 100644
@@ -13,10 +13,10 @@ define FBTFT_PREPARE_KERNEL
 		dest=drivers/video/fbdev ; \
 	else \

linux/linux-ext-fbtft.mk define FBTFT_PREPARE_KERNEL · line 20

Quoted 10 lines
linux/linux-ext-fbtft.mk +4 -4
 		dest=drivers/video ; \
-	fi ; \
-	mkdir -p $(LINUX_DIR)/$${dest}/fbtft; \
-	cp -dpfr $(FBTFT_DIR)/* $(LINUX_DIR)/$${dest}/fbtft/ ; \
+	fi
+	mkdir -p $(LINUX_DIR)/$${dest}/fbtft
+	cp -dpfr $(FBTFT_DIR)/* $(LINUX_DIR)/$${dest}/fbtft/
 	echo "source \"$${dest}/fbtft/Kconfig\"" \
-		>> $(LINUX_DIR)/$${dest}/Kconfig ; \  
+		>> $(LINUX_DIR)/$${dest}/Kconfig

Did you test this? It won't work. Indeed in this case, you are sharing a shell variable between multiple commands, so they must be a single shell command.

It can however probably be rewritten in make like this:

define FBTFT_PREPARE_KERNEL_INNER

	mkdir -p $(LINUX_DIR)/$(1)/fbtft
	cp -dpfr $(FBTFT_DIR)/* $(LINUX_DIR)/$(1)/fbtft/
	echo "source \"$(1)/fbtft/Kconfig\"" \
		>> $(LINUX_DIR)/$(1)/Kconfig
	echo 'obj-y += fbtft/' >> $(LINUX_DIR)/$(1)/Makefile

endef

define FBTFT_PREPARE_KERNEL

	$(if $(wildcard $(LINUX_DIR)/drivers/video/fbdev), \
		$(call FBTFT_PREPARE_KERNEL_INNER,drivers/video/fbdev), \
		$(call FBTFT_PREPARE_KERNEL_INNER,drivers/video/) \
	)

endef

However, I am not sure it is really more readable.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 linux/linux-ext-fbtft: remove unnecessary ; \

Quoted 24 lines · Thomas Petazzoni

Hello,

Quoted 21 lines · David Lechner

The makefile has some unnecessary instances of ; \ at the end of the lines, so remove them to make code a bit more readable.

---
 linux/linux-ext-fbtft.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
linux/linux-ext-fbtft.mk +2 -3
index 5eb3d94..64e65a1 100644
@@ -13,10 +13,10 @@ define FBTFT_PREPARE_KERNEL
 		dest=drivers/video/fbdev ; \
 	else \
 		dest=drivers/video ; \
-	fi ; \
-	mkdir -p $(LINUX_DIR)/$${dest}/fbtft; \
-	cp -dpfr $(FBTFT_DIR)/* $(LINUX_DIR)/$${dest}/fbtft/ ; \
+	fi
+	mkdir -p $(LINUX_DIR)/$${dest}/fbtft
Quoted 8 lines

linux/linux-ext-fbtft.mk define FBTFT_PREPARE_KERNEL · line 20

Quoted 4 lines
linux/linux-ext-fbtft.mk +2 -1
+	cp -dpfr $(FBTFT_DIR)/* $(LINUX_DIR)/$${dest}/fbtft/
 	echo "source \"$${dest}/fbtft/Kconfig\"" \
-		>> $(LINUX_DIR)/$${dest}/Kconfig ; \
+		>> $(LINUX_DIR)/$${dest}/Kconfig

Did you test this? It won't work. Indeed in this case, you are sharing a shell variable between multiple commands, so they must be a single shell command.

No I didn't. You made a similar change to one of my EV3 patches. This is where I copied the code from, so I thought you could get away with the same change here. I missed the bit about the environment variable.

Quoted 11 lines

It can however probably be rewritten in make like this:

define FBTFT_PREPARE_KERNEL_INNER

	mkdir -p $(LINUX_DIR)/$(1)/fbtft
	cp -dpfr $(FBTFT_DIR)/* $(LINUX_DIR)/$(1)/fbtft/
	echo "source \"$(1)/fbtft/Kconfig\"" \
		>> $(LINUX_DIR)/$(1)/Kconfig
	echo 'obj-y += fbtft/' >> $(LINUX_DIR)/$(1)/Makefile

endef

Quoted 9 lines

define FBTFT_PREPARE_KERNEL

	$(if $(wildcard $(LINUX_DIR)/drivers/video/fbdev), \
		$(call FBTFT_PREPARE_KERNEL_INNER,drivers/video/fbdev), \
		$(call FBTFT_PREPARE_KERNEL_INNER,drivers/video/) \
	)

endef

However, I am not sure it is really more readable.

Yes, we can drop this patch. I just wanted to prevent a future copy-paste problem like I had, but I guess I will just have to learn more about Makefiles instead. ;-)