Skip to contentSkip to conversation

udev-009: Allow build with empty EXTRAS

PATCH In review Adam Kropelin 2 participants 4 messages Dec 17, 2003 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udev-009: Allow build with empty EXTRAS

Need to let the shell expand $EXTRAS so it can properly detect an empty list. Without this patch, the build fails whenever $EXTRAS is empty.

--Adam

Makefile +4 -4
@@ -145,7 +145,7 @@
 CFLAGS += -I$(PWD)/libsysfs
 
 all: $(ROOT)
-	@for target in $(EXTRAS) ; do \
+	@extras="$(EXTRAS)" ; for target in $$extras ; do \
 		echo $$target ; \
 		$(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \
 			-C $$target $@ ; \
@@ -223,7 +223,7 @@
 	 | xargs rm -f 
 	-rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS)
 	$(MAKE) -C klibc clean
-	@for target in $(EXTRAS) ; do \
+	@extras="$(EXTRAS)" ; for target in $$extras ; do \
 		echo $$target ; \
 		$(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \
 			-C $$target $@ ; \
@@ -286,7 +286,7 @@
 	$(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir)
 	- rm -f $(DESTDIR)$(hotplugdir)/udev.hotplug
 	- ln -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug
-	@for target in $(EXTRAS) ; do \
+	@extras="$(EXTRAS)" ; for target in $$extras ; do \
 		echo $$target ; \
 		$(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \
 			-C $$target $@ ; \
@@ -303,7 +303,7 @@
 	- rmdir $(hotplugdir)
 	- rmdir $(configdir)
 	- rmdir $(udevdir)
-	@for target in $(EXTRAS) ; do \
+	@extras="$(EXTRAS)" ; for target in $$extras ; do \
 		echo $$target ; \
 		$(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \
 			-C $$target $@ ; \
#1 lore raw
Quoted 2 lines · Adam Kropelin

Need to let the shell expand $EXTRAS so it can properly detect an empty list. Without this patch, the build fails whenever $EXTRAS is empty.

$ export EXTRAS=
$ make
$ set | grep EXTRA
EXTRAS=
$ 

I can't duplicate this problem at all. Someone else once reported it on the linux-hotplug-devel list, with much the same fix up patch, but later said they couldn't reproduce it either.

What version of make are you using?

works for me :)

thanks,

greg k-h

#2 lore raw
Quoted 10 lines · Greg KH
Quoted 2 lines · Adam Kropelin

Need to let the shell expand $EXTRAS so it can properly detect an empty list. Without this patch, the build fails whenever $EXTRAS is empty.

$ export EXTRAS=
$ make
$ set | grep EXTRA
EXTRAS=
$ 
Quoted 5 lines

I can't duplicate this problem at all. Someone else once reported it on the linux-hotplug-devel list, with much the same fix up patch, but later said they couldn't reproduce it either.

What version of make are you using?

It's actually the version of bash that's important. Prior to 2.05a, bash was unable to handle for loops with empty words lists. From the bash-2.05a changelog:

p. for' loops now allow empty word lists after in', like the
latest POSIX drafts require.

So bash-2.05 dies on...

for test in ; do echo $test ; done

...while bash-2.05a accepts it just fine.

Both versions can handle this case if the shell itself does the expansion that results in the empty list. So that's where my workaround came from.

--Adam

#3 lore raw
Quoted 26 lines · Adam Kropelin
Quoted 10 lines · Greg KH
Quoted 2 lines · Adam Kropelin

Need to let the shell expand $EXTRAS so it can properly detect an empty list. Without this patch, the build fails whenever $EXTRAS is empty.

$ export EXTRAS=
$ make
$ set | grep EXTRA
EXTRAS=
$ 
Quoted 5 lines

I can't duplicate this problem at all. Someone else once reported it on the linux-hotplug-devel list, with much the same fix up patch, but later said they couldn't reproduce it either.

What version of make are you using?

It's actually the version of bash that's important. Prior to 2.05a, bash was unable to handle for loops with empty words lists. From the bash-2.05a changelog:

p. for' loops now allow empty word lists after in', like the
latest POSIX drafts require.

So bash-2.05 dies on...

Quoted 7 lines

for test in ; do echo $test ; done

...while bash-2.05a accepts it just fine.

Both versions can handle this case if the shell itself does the expansion that results in the empty list. So that's where my workaround came from.

Ah, ok, thanks for the explaination. I've applied this patch.

greg k-h