Skip to contentSkip to conversation

arm/powerpc: Makefile cleanup

PATCH Applied Andrew Jones 3 participants 10 messages May 10, 2016 – May 19, 2016 KVM

lore
Share & tools
lore
#0 lore raw

v2 cover arm/powerpc: Makefile cleanup

Cleanup makefiles like 'x86: Makefile refine' does.

v2:
- no need for %.elf on powerpc patch
- commit message points out why .PRECIOUS is used

Andrew Jones (2):
arm/arm64: Makefile cleanup
powerpc/ppc64: Makefile cleanup

 arm/Makefile.common     |  8 ++++----
 powerpc/Makefile.common | 13 ++++---------
 2 files changed, 8 insertions(+), 13 deletions(-)
Signature · 1 line
2.4.11
#1 lore raw

PATCH v2 1/2 arm/arm64: Makefile cleanup

This does the same cleanup as 'x86: Makefile refine'. .PRECIOUS is used (as opposed to .SECONDARY), because .SECONDARY doesn't accept target patterns.

---
 arm/Makefile.common | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arm/Makefile.common +4 -4
index 9a2d61fc88a27..a786fcf94154f 100644
@@ -24,6 +24,9 @@ CFLAGS += -Wextra
 CFLAGS += -O2
 CFLAGS += -I lib -I lib/libfdt
 
+# We want to keep intermediate files
+.PRECIOUS: %.elf %.o
+
 asm-offsets = lib/$(ARCH)/asm-offsets.h
 include scripts/asm-offsets.mak
 
@@ -48,7 +51,7 @@ start_addr := $(shell printf "%x\n" $$(( $(phys_base) + $(kernel_offset) )))
 
 FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi)
 %.elf: LDFLAGS = $(CFLAGS) -nostdlib
-%.elf: %.o $(FLATLIBS) arm/flat.lds
+%.elf: %.o $(FLATLIBS) arm/flat.lds $(cstart.o)
 	$(CC) $(LDFLAGS) -o $@ \
 		-Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \
 		$(filter %.o, $^) $(FLATLIBS)
@@ -69,7 +72,4 @@ generated_files = $(asm-offsets)
 
 test_cases: $(generated_files) $(tests-common) $(tests)
 
-$(TEST_DIR)/selftest.elf: $(cstart.o) $(TEST_DIR)/selftest.o
-$(TEST_DIR)/spinlock-test.elf: $(cstart.o) $(TEST_DIR)/spinlock-test.o
-
 $(TEST_DIR)/selftest.o $(cstart.o): $(asm-offsets)
Signature · 1 line
2.4.11
#7 lore raw

PATCH v2 2/2 powerpc/ppc64: Makefile cleanup

In reply to Andrew Jones

This does the same cleanup as 'x86: Makefile refine'. .PRECIOUS is used (as opposed to .SECONDARY), because .SECONDARY doesn't accept target patterns.

---
 powerpc/Makefile.common | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
powerpc/Makefile.common +4 -9
index 4449aec616853..4ff1dc8f48d32 100644
@@ -22,6 +22,9 @@ CFLAGS += -I lib -I lib/libfdt
 CFLAGS += -Wa,-mregnames
 CFLAGS += -fpie
 
+# We want to keep intermediate files
+.PRECIOUS: %.o
+
 asm-offsets = lib/$(ARCH)/asm-offsets.h
 include scripts/asm-offsets.mak
 
@@ -37,7 +40,7 @@ cflatobjs += lib/powerpc/processor.o
 FLATLIBS = $(libcflat) $(LIBFDT_archive)
 %.elf: CFLAGS += $(arch_CFLAGS)
 %.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie
-%.elf: %.o $(FLATLIBS) powerpc/flat.lds
+%.elf: %.o $(FLATLIBS) powerpc/flat.lds $(cstart.o) $(reloc.o)
 	$(LD) $(LDFLAGS) -o $@ \
 	      -T powerpc/flat.lds --build-id=none \
 		$(filter %.o, $^) $(FLATLIBS)
@@ -69,11 +72,3 @@ generated_files = $(asm-offsets)
 test_cases: $(generated_files) $(tests-common) $(tests)
 
 $(cstart.o): $(asm-offsets)
-
-$(TEST_DIR)/selftest.elf: $(cstart.o) $(reloc.o) $(TEST_DIR)/selftest.o
-
-$(TEST_DIR)/spapr_hcall.elf: $(cstart.o) $(reloc.o) $(TEST_DIR)/spapr_hcall.o
-
-$(TEST_DIR)/rtas.elf: $(cstart.o) $(reloc.o) $(TEST_DIR)/rtas.o
-
-$(TEST_DIR)/emulator.elf: $(cstart.o) $(reloc.o) $(TEST_DIR)/emulator.o
Signature · 1 line
2.4.11
maintainer
#2 lore raw

Re: [kvm-unit-tests PATCH v2 1/2] arm/arm64: Makefile cleanup

In reply to Andrew Jones
Quoted 3 lines · Andrew Jones

This does the same cleanup as 'x86: Makefile refine'. .PRECIOUS is used (as opposed to .SECONDARY), because .SECONDARY doesn't accept target patterns.

Actually it should and, worst case, we could use .SECONDARY without prerequisites. I'll change this to "doesn't seem to work reliably".

Paolo

Quoted 37 lines
---
 arm/Makefile.common | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arm/Makefile.common +4 -4
index 9a2d61fc88a27..a786fcf94154f 100644
@@ -24,6 +24,9 @@ CFLAGS += -Wextra
 CFLAGS += -O2
 CFLAGS += -I lib -I lib/libfdt
 
+# We want to keep intermediate files
+.PRECIOUS: %.elf %.o
+
 asm-offsets = lib/$(ARCH)/asm-offsets.h
 include scripts/asm-offsets.mak
 
@@ -48,7 +51,7 @@ start_addr := $(shell printf "%x\n" $$(( $(phys_base) + $(kernel_offset) )))
 
 FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi)
 %.elf: LDFLAGS = $(CFLAGS) -nostdlib
-%.elf: %.o $(FLATLIBS) arm/flat.lds
+%.elf: %.o $(FLATLIBS) arm/flat.lds $(cstart.o)
 	$(CC) $(LDFLAGS) -o $@ \
 		-Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \
 		$(filter %.o, $^) $(FLATLIBS)
@@ -69,7 +72,4 @@ generated_files = $(asm-offsets)
 
 test_cases: $(generated_files) $(tests-common) $(tests)
 
-$(TEST_DIR)/selftest.elf: $(cstart.o) $(TEST_DIR)/selftest.o
-$(TEST_DIR)/spinlock-test.elf: $(cstart.o) $(TEST_DIR)/spinlock-test.o
-
 $(TEST_DIR)/selftest.o $(cstart.o): $(asm-offsets)
maintainer Applied
#9 lore raw
In reply to Andrew Jones
Quoted 6 lines · Andrew Jones

Cleanup makefiles like 'x86: Makefile refine' does.

v2:
- no need for %.elf on powerpc patch
- commit message points out why .PRECIOUS is used

Quoted 8 lines

Andrew Jones (2):
arm/arm64: Makefile cleanup
powerpc/ppc64: Makefile cleanup

 arm/Makefile.common     |  8 ++++----
 powerpc/Makefile.common | 13 ++++---------
 2 files changed, 8 insertions(+), 13 deletions(-)

Applied, thanks.

Paolo

Reviewed-by on v2 1/2
#3 lore raw

Re: [kvm-unit-tests PATCH v2 1/2] arm/arm64: Makefile cleanup

In reply to Andrew Jones
Quoted 5 lines · Andrew Jones

This does the same cleanup as 'x86: Makefile refine'. .PRECIOUS is used (as opposed to .SECONDARY), because .SECONDARY doesn't accept target patterns.

Is it possible to add

Now?

Quoted 37 lines

---
arm/Makefile.common | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)
arm/Makefile.common +0 -0
index 9a2d61fc88a27..a786fcf94154f 100644
@@ -24,6 +24,9 @@ CFLAGS += -Wextra

CFLAGS += -O2
CFLAGS += -I lib -I lib/libfdt

arm/Makefile.common +3 -0
+# We want to keep intermediate files
+.PRECIOUS: %.elf %.o
+

asm-offsets = lib/$(ARCH)/asm-offsets.h
include scripts/asm-offsets.mak

arm/Makefile.common +0 -0
@@ -48,7 +51,7 @@ start_addr := $(shell printf "%x\n" $$(( $(phys_base) + $(kernel_offset) )))
 
 FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi)

%.elf: LDFLAGS = $(CFLAGS) -nostdlib
-%.elf: %.o $(FLATLIBS) arm/flat.lds
+%.elf: %.o $(FLATLIBS) arm/flat.lds $(cstart.o)

	$(CC) $(LDFLAGS) -o $@ \
		-Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \
		$(filter %.o, $^) $(FLATLIBS)
arm/Makefile.common +0 -3
@@ -69,7 +72,4 @@ generated_files = $(asm-offsets)
 
 test_cases: $(generated_files) $(tests-common) $(tests)
 
-$(TEST_DIR)/selftest.elf: $(cstart.o) $(TEST_DIR)/selftest.o
-$(TEST_DIR)/spinlock-test.elf: $(cstart.o) $(TEST_DIR)/spinlock-test.o
-
 $(TEST_DIR)/selftest.o $(cstart.o): $(asm-offsets)
Signature · 1 line
2.4.11
Signature · 2 lines
Wei Yang
Help you, Help me
Reviewed-by on v2 2/2
#8 lore raw

Re: [kvm-unit-tests PATCH v2 2/2] powerpc/ppc64: Makefile cleanup

In reply to Andrew Jones
Quoted 5 lines · Andrew Jones

This does the same cleanup as 'x86: Makefile refine'. .PRECIOUS is used (as opposed to .SECONDARY), because .SECONDARY doesn't accept target patterns.

Same as above.

Quoted 41 lines

---
powerpc/Makefile.common | 13 ++++---------

1 file changed, 4 insertions(+), 9 deletions(-)
powerpc/Makefile.common +0 -0
index 4449aec616853..4ff1dc8f48d32 100644
@@ -22,6 +22,9 @@ CFLAGS += -I lib -I lib/libfdt

CFLAGS += -Wa,-mregnames
CFLAGS += -fpie

powerpc/Makefile.common +3 -0
+# We want to keep intermediate files
+.PRECIOUS: %.o
+

asm-offsets = lib/$(ARCH)/asm-offsets.h
include scripts/asm-offsets.mak

powerpc/Makefile.common +0 -0
@@ -37,7 +40,7 @@ cflatobjs += lib/powerpc/processor.o
 FLATLIBS = $(libcflat) $(LIBFDT_archive)
 %.elf: CFLAGS += $(arch_CFLAGS)

%.elf: LDFLAGS = $(arch_LDFLAGS) -nostdlib -pie -%.elf: %.o $(FLATLIBS) powerpc/flat.lds
+%.elf: %.o $(FLATLIBS) powerpc/flat.lds $(cstart.o) $(reloc.o)

	$(LD) $(LDFLAGS) -o $@ \
	      -T powerpc/flat.lds --build-id=none \
		$(filter %.o, $^) $(FLATLIBS)
powerpc/Makefile.common +0 -8
@@ -69,11 +72,3 @@ generated_files = $(asm-offsets)
 test_cases: $(generated_files) $(tests-common) $(tests)
 
 $(cstart.o): $(asm-offsets)
-
-$(TEST_DIR)/selftest.elf: $(cstart.o) $(reloc.o) $(TEST_DIR)/selftest.o
-
-$(TEST_DIR)/spapr_hcall.elf: $(cstart.o) $(reloc.o) $(TEST_DIR)/spapr_hcall.o
-
-$(TEST_DIR)/rtas.elf: $(cstart.o) $(reloc.o) $(TEST_DIR)/rtas.o
-
-$(TEST_DIR)/emulator.elf: $(cstart.o) $(reloc.o) $(TEST_DIR)/emulator.o
Signature · 1 line
2.4.11
Signature · 2 lines
Wei Yang
Help you, Help me
maintainer
#4 lore raw

Re: [kvm-unit-tests PATCH v2 1/2] arm/arm64: Makefile cleanup

In reply to Wei Yang
Quoted 10 lines · Wei Yang
Quoted 5 lines · Andrew Jones

This does the same cleanup as 'x86: Makefile refine'. .PRECIOUS is used (as opposed to .SECONDARY), because .SECONDARY doesn't accept target patterns.

Is it possible to add

Too late, sorry; the commit has been pushed already.

Paolo

Quoted 40 lines

Now?

Quoted 37 lines

---
arm/Makefile.common | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)
arm/Makefile.common +0 -0
index 9a2d61fc88a27..a786fcf94154f 100644
@@ -24,6 +24,9 @@ CFLAGS += -Wextra

CFLAGS += -O2
CFLAGS += -I lib -I lib/libfdt

arm/Makefile.common +3 -0
+# We want to keep intermediate files
+.PRECIOUS: %.elf %.o
+

asm-offsets = lib/$(ARCH)/asm-offsets.h
include scripts/asm-offsets.mak

arm/Makefile.common +0 -0
@@ -48,7 +51,7 @@ start_addr := $(shell printf "%x\n" $$(( $(phys_base) + $(kernel_offset) )))
 
 FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi)

%.elf: LDFLAGS = $(CFLAGS) -nostdlib
-%.elf: %.o $(FLATLIBS) arm/flat.lds
+%.elf: %.o $(FLATLIBS) arm/flat.lds $(cstart.o)

	$(CC) $(LDFLAGS) -o $@ \
		-Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \
		$(filter %.o, $^) $(FLATLIBS)
arm/Makefile.common +0 -3
@@ -69,7 +72,4 @@ generated_files = $(asm-offsets)
 
 test_cases: $(generated_files) $(tests-common) $(tests)
 
-$(TEST_DIR)/selftest.elf: $(cstart.o) $(TEST_DIR)/selftest.o
-$(TEST_DIR)/spinlock-test.elf: $(cstart.o) $(TEST_DIR)/spinlock-test.o
-
 $(TEST_DIR)/selftest.o $(cstart.o): $(asm-offsets)
Signature · 1 line
2.4.11
#5 lore raw

Re: [kvm-unit-tests PATCH v2 1/2] arm/arm64: Makefile cleanup

Quoted 8 lines · Paolo Bonzini
Quoted 5 lines · Wei Yang
Quoted 4 lines · Andrew Jones

This does the same cleanup as 'x86: Makefile refine'. .PRECIOUS is used (as opposed to .SECONDARY), because .SECONDARY doesn't accept target patterns.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Is it possible to add

Too late, sorry; the commit has been pushed already.

OK, that's fine.

BTW, do I need to reply with Reviewed-by in each patch version? I thought just reply to one of it and the following versions would contain it. Or I missed the rule?

Quoted 42 lines

Paolo

Quoted 40 lines

Now?

Quoted 37 lines

---
arm/Makefile.common | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)
arm/Makefile.common +0 -0
index 9a2d61fc88a27..a786fcf94154f 100644
@@ -24,6 +24,9 @@ CFLAGS += -Wextra

CFLAGS += -O2
CFLAGS += -I lib -I lib/libfdt

arm/Makefile.common +3 -0
+# We want to keep intermediate files
+.PRECIOUS: %.elf %.o
+

asm-offsets = lib/$(ARCH)/asm-offsets.h
include scripts/asm-offsets.mak

arm/Makefile.common +0 -0
@@ -48,7 +51,7 @@ start_addr := $(shell printf "%x\n" $$(( $(phys_base) + $(kernel_offset) )))
 
 FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi)

%.elf: LDFLAGS = $(CFLAGS) -nostdlib
-%.elf: %.o $(FLATLIBS) arm/flat.lds
+%.elf: %.o $(FLATLIBS) arm/flat.lds $(cstart.o)

	$(CC) $(LDFLAGS) -o $@ \
		-Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \
		$(filter %.o, $^) $(FLATLIBS)
arm/Makefile.common +0 -3
@@ -69,7 +72,4 @@ generated_files = $(asm-offsets)
 
 test_cases: $(generated_files) $(tests-common) $(tests)
 
-$(TEST_DIR)/selftest.elf: $(cstart.o) $(TEST_DIR)/selftest.o
-$(TEST_DIR)/spinlock-test.elf: $(cstart.o) $(TEST_DIR)/spinlock-test.o
-
 $(TEST_DIR)/selftest.o $(cstart.o): $(asm-offsets)
Signature · 1 line
2.4.11
Signature · 2 lines
Wei Yang
Help you, Help me
maintainer
#6 lore raw

Re: [kvm-unit-tests PATCH v2 1/2] arm/arm64: Makefile cleanup

Quoted 15 lines · Wei Yang
Quoted 14 lines · Paolo Bonzini
Quoted 10 lines · Wei Yang
Quoted 5 lines · Andrew Jones

This does the same cleanup as 'x86: Makefile refine'. .PRECIOUS is used (as opposed to .SECONDARY), because .SECONDARY doesn't accept target patterns.

Is it possible to add

Quoted 8 lines
Quoted 2 lines

Too late, sorry; the commit has been pushed already.

OK, that's fine.

BTW, do I need to reply with Reviewed-by in each patch version? I thought just reply to one of it and the following versions would contain it. Or I missed the rule?

Usually it's enough to reply once. However, the submitter may drop Reviewed-by tags if he/she believes that there were large changes compared to the reviewed version; or they might just forget to add it.

Paolo