Skip to contentSkip to conversation

optionroms: Silence intermediate file removal

PATCH Superseded Jan Kiszka 4 participants 7 messages Jan 23, 2012 – Feb 1, 2012

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 optionroms: Silence intermediate file removal

The build process of optionroms spits out an "rm ..." line. Moreover, it removes all .o files that can be handy for debugging purposes.

Disable automatic intermediate removal and only clean up the unneeded and large .img and .raw files.

---
 pc-bios/optionrom/Makefile |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
pc-bios/optionrom/Makefile +4 -2
index 51da288..3edde85 100644
@@ -16,14 +16,16 @@ QEMU_CFLAGS = $(CFLAGS)
 
 build-all: multiboot.bin linuxboot.bin
 
+.SECONDARY:
+
 %.img: %.o
 	$(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<,"  Building $(TARGET_DIR)$@")
 
 %.raw: %.img
-	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"  Building $(TARGET_DIR)$@")
+	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@; rm -f $<,"  Building $(TARGET_DIR)$@")
 
 %.bin: %.raw
-	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/signrom.sh $< $@,"  Signing $(TARGET_DIR)$@")
+	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/signrom.sh $< $@; rm -f $<,"  Signing $(TARGET_DIR)$@")
 
 clean:
 	rm -f *.o *.d *.raw *.img *.bin *~
Signature · 1 line
1.7.3.4
#1 lore raw
Quoted 16 lines · Jan Kiszka

The build process of optionroms spits out an "rm ..." line. Moreover, it removes all .o files that can be handy for debugging purposes.

Disable automatic intermediate removal and only clean up the unneeded and large .img and .raw files.

---
 pc-bios/optionrom/Makefile |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
pc-bios/optionrom/Makefile +0 -0
index 51da288..3edde85 100644

pc-bios/optionrom/Makefile QEMU_CFLAGS = $(CFLAGS) · line 19

Quoted 4 lines
pc-bios/optionrom/Makefile +1 -0
@@ -16,14 +16,16 @@ QEMU_CFLAGS = $(CFLAGS)
 
 build-all: multiboot.bin linuxboot.bin
 
+.SECONDARY:

I suggest a comment explaining what this built-in target name does. Otherwise someone might delete it because it is empty.

#2 lore raw
In reply to Jan Kiszka

Am 23.01.2012 19:34, schrieb Jan Kiszka:

Quoted 24 lines

The build process of optionroms spits out an "rm ..." line. Moreover, it removes all .o files that can be handy for debugging purposes.

Disable automatic intermediate removal and only clean up the unneeded and large .img and .raw files.

---
 pc-bios/optionrom/Makefile |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
pc-bios/optionrom/Makefile +2 -0
index 51da288..3edde85 100644
@@ -16,14 +16,16 @@ QEMU_CFLAGS = $(CFLAGS)
 
 build-all: multiboot.bin linuxboot.bin
 
+.SECONDARY:
+
 %.img: %.o
 	$(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<,"  Building $(TARGET_DIR)$@")
 

pc-bios/optionrom/Makefile QEMU_CFLAGS = $(CFLAGS) · line 31

Quoted 10 lines
pc-bios/optionrom/Makefile +2 -2
 %.raw: %.img
-	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"  Building $(TARGET_DIR)$@")
+	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@; rm -f $<,"  Building $(TARGET_DIR)$@")
 
 %.bin: %.raw
-	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/signrom.sh $< $@,"  Signing $(TARGET_DIR)$@")
+	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/signrom.sh $< $@; rm -f $<,"  Signing $(TARGET_DIR)$@")
 
 clean:
 	rm -f *.o *.d *.raw *.img *.bin *~

It's possible that objcopy or a shell script fails. In that case, && rm -f $<
or a second output-suppressed Makefile line might be a better than ; rm -f $<

Stefan's comment on .SECONDARY seconded. :)

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
author
#3 lore raw

PATCH v2 1/1 optionroms: Silence intermediate file removal

In reply to Jan Kiszka

The build process of optionroms spits out an "rm ..." line. Moreover, it removes all .o files that can be handy for debugging purposes.

Disable automatic intermediate removal and only clean up the unneeded and large .img and .raw files.

---

Changes in v2:
- comment on .SECONDARY purpose
- make rm -rf dependent on success of build command

 pc-bios/optionrom/Makefile |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
pc-bios/optionrom/Makefile +5 -2
index 51da288..4e7275b 100644
@@ -16,14 +16,17 @@ QEMU_CFLAGS = $(CFLAGS)
 
 build-all: multiboot.bin linuxboot.bin
 
+# suppress auto-removal of intermediate files
+.SECONDARY:
+
 %.img: %.o
 	$(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<,"  Building $(TARGET_DIR)$@")
 
 %.raw: %.img
-	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"  Building $(TARGET_DIR)$@")
+	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@ && rm -f $<,"  Building $(TARGET_DIR)$@")
 
 %.bin: %.raw
-	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/signrom.sh $< $@,"  Signing $(TARGET_DIR)$@")
+	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/signrom.sh $< $@ && rm -f $<,"  Signing $(TARGET_DIR)$@")
 
 clean:
 	rm -f *.o *.d *.raw *.img *.bin *~
Signature · 1 line
1.7.3.4
Reviewed-by on v2 1/1
#4 lore raw

Am 27.01.2012 13:26, schrieb Jan Kiszka:

Quoted 7 lines

The build process of optionroms spits out an "rm ..." line. Moreover, it removes all .o files that can be handy for debugging purposes.

Disable automatic intermediate removal and only clean up the unneeded and large .img and .raw files.

Thanks,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
author
#5 lore raw

PATCH v3 1/1 optionroms: Silence intermediate file removal

In reply to Jan Kiszka

The build process of optionroms spits out an "rm ..." line. Moreover, it removes all .o files that can be handy for debugging purposes. So disable automatic intermediate removal.

---

Changes in v3:
- do not remove intermediate file manually, it breaks parallel build

 pc-bios/optionrom/Makefile |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
pc-bios/optionrom/Makefile +3 -0
index 51da288..2caf7e6 100644
@@ -16,6 +16,9 @@ QEMU_CFLAGS = $(CFLAGS)
 
 build-all: multiboot.bin linuxboot.bin
 
+# suppress auto-removal of intermediate files
+.SECONDARY:
+
 %.img: %.o
 	$(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<,"  Building $(TARGET_DIR)$@")
 
Signature · 1 line
1.7.3.4
#6 lore raw
Quoted 5 lines · Jan Kiszka

The build process of optionroms spits out an "rm ..." line. Moreover, it removes all .o files that can be handy for debugging purposes. So disable automatic intermediate removal.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 22 lines

---

Changes in v3:
- do not remove intermediate file manually, it breaks parallel build

  pc-bios/optionrom/Makefile |    3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)
pc-bios/optionrom/Makefile +3 -0
index 51da288..2caf7e6 100644
@@ -16,6 +16,9 @@ QEMU_CFLAGS = $(CFLAGS)
 
  build-all: multiboot.bin linuxboot.bin
 
+# suppress auto-removal of intermediate files
+.SECONDARY:
+
  %.img: %.o
  	$(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<,"  Building $(TARGET_DIR)$@")