Skip to contentSkip to conversation

build: shorten macro references

PATCH Superseded Jan Beulich 3 participants 4 messages May 4, 2023 – May 5, 2023 RISC-V

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: shorten macro references

Presumably by copy-and-paste we've accumulated a number of instances of $(@D)/$(@F), which really is nothing else than $@. The split form only needs using when we want to e.g. insert a leading . at the beginning of the file name portion of the full name.

xen/arch/arm/Makefile +2 -2
@@ -104,9 +104,9 @@ $(TARGET)-syms: $(objtree)/prelink.o $(o
 	$(MAKE) $(build)=$(@D) $(@D)/.$(@F).1.o
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
 	    $(@D)/.$(@F).1.o -o $@
-	$(NM) -pa --format=sysv $(@D)/$(@F) \
+	$(NM) -pa --format=sysv $@ \
 		| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
-		>$(@D)/$(@F).map
+		>[email protected]
 	rm -f $(@D)/.$(@F).[0-9]*
 
 .PHONY: include
xen/arch/riscv/Makefile +2 -2
@@ -10,9 +10,9 @@ $(TARGET): $(TARGET)-syms
 
 $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) -o $@
-	$(NM) -pa --format=sysv $(@D)/$(@F) \
+	$(NM) -pa --format=sysv $@ \
 		| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
-		>$(@D)/$(@F).map
+		>[email protected]
 
 $(obj)/xen.lds: $(src)/xen.lds.S FORCE
 	$(call if_changed_dep,cpp_lds_S)
xen/arch/x86/Makefile +5 -4
@@ -150,9 +150,9 @@ $(TARGET)-syms: $(objtree)/prelink.o $(o
 	$(MAKE) $(build)=$(@D) $(@D)/.$(@F).1.o
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
 	    $(orphan-handling-y) $(@D)/.$(@F).1.o -o $@
-	$(NM) -pa --format=sysv $(@D)/$(@F) \
+	$(NM) -pa --format=sysv $@ \
 		| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
-		>$(@D)/$(@F).map
+		>[email protected]
 	rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]*
 ifeq ($(CONFIG_XEN_IBT),y)
 	$(SHELL) $(srctree)/tools/check-endbr.sh $@
@@ -224,8 +224,9 @@ endif
 	$(MAKE) $(build)=$(@D) .$(@F).1r.o .$(@F).1s.o
 	$(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T $(obj)/efi.lds -N $< \
 	      $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o $(orphan-handling-y) $(note_file_option) -o $@
-	$(NM) -pa --format=sysv $(@D)/$(@F) \
-		| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort >$(@D)/$(@F).map
+	$(NM) -pa --format=sysv $@ \
+		| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
+		>[email protected]
 ifeq ($(CONFIG_DEBUG_INFO),y)
 	$(if $(filter --strip-debug,$(EFI_LDFLAGS)),:$(space))$(OBJCOPY) -O elf64-x86-64 $@ [email protected]
 endif
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Jan Beulich

Presumably by copy-and-paste we've accumulated a number of instances of $(@D)/$(@F), which really is nothing else than $@. The split form only needs using when we want to e.g. insert a leading . at the beginning of the file name portion of the full name.

From the Kbuild work, we have $(dot-target) now which is marginally more legible than $(@D)/.$(@F), and we ought to use it consistently.

Quoted 1 line

xen/arch/arm/Makefile $(TARGET)-syms: $(objtree)/prelink.o $(o · line 109

Quoted 12 lines
xen/arch/arm/Makefile +2 -2
@@ -104,9 +104,9 @@ $(TARGET)-syms: $(objtree)/prelink.o $(o
 	$(MAKE) $(build)=$(@D) $(@D)/.$(@F).1.o
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
 	    $(@D)/.$(@F).1.o -o $@
-	$(NM) -pa --format=sysv $(@D)/$(@F) \
+	$(NM) -pa --format=sysv $@ \
 		| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
-		>$(@D)/$(@F).map
+		>[email protected]

... any chance we can get a space between > and $ like we do almost everywhere else?

~Andrew

#2 lore raw
Quoted 8 lines · Andrew Cooper
Quoted 4 lines · Jan Beulich

Presumably by copy-and-paste we've accumulated a number of instances of $(@D)/$(@F), which really is nothing else than $@. The split form only needs using when we want to e.g. insert a leading . at the beginning of the file name portion of the full name.

From the Kbuild work, we have $(dot-target) now which is marginally more legible than $(@D)/.$(@F), and we ought to use it consistently.

Oh, right - let me make yet another patch on top.

Quoted 3 lines
Quoted 1 line

Thanks.

Quoted 6 lines
Quoted 6 lines
xen/arch/arm/Makefile +0 -0
@@ -104,9 +104,9 @@ $(TARGET)-syms: $(objtree)/prelink.o $(o
 	$(MAKE) $(build)=$(@D) $(@D)/.$(@F).1.o
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
 	    $(@D)/.$(@F).1.o -o $@
Quoted 8 lines

xen/arch/arm/Makefile $(TARGET)-syms: $(objtree)/prelink.o $(o · line 109

Quoted 5 lines
xen/arch/arm/Makefile +2 -2
-	$(NM) -pa --format=sysv $(@D)/$(@F) \
+	$(NM) -pa --format=sysv $@ \
 		| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
-		>$(@D)/$(@F).map
+		>[email protected]

... any chance we can get a space between > and $ like we do almost everywhere else?

Since "almost everywhere else" wasn't quite right for xen/arch/*/Makefile I was first inclined to say no, but I can easily insert blanks when doing the $(dot-target) conversion as well, and then it looks like it'll end up fully consistent (in this one regard).

Jan

Reviewed-by on v1 1/1
#3 lore raw
In reply to Jan Beulich

Hi Jan,

Quoted 8 lines · Jan Beulich

Presumably by copy-and-paste we've accumulated a number of instances of $(@D)/$(@F), which really is nothing else than $@. The split form only needs using when we want to e.g. insert a leading . at the beginning of the file name portion of the full name.

Cheers
Bertrand

Quoted 55 lines
xen/arch/arm/Makefile +0 -0
@@ -104,9 +104,9 @@ $(TARGET)-syms: $(objtree)/prelink.o $(o

$(MAKE) $(build)=$(@D) $(@D)/.$(@F).1.o

$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
   $(@D)/.$(@F).1.o -o $@

- $(NM) -pa --format=sysv $(@D)/$(@F) \
+ $(NM) -pa --format=sysv $@ \
| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
- >$(@D)/$(@F).map
+ >[email protected]
rm -f $(@D)/.$(@F).[0-9]*

.PHONY: include

xen/arch/riscv/Makefile +0 -0
@@ -10,9 +10,9 @@ $(TARGET): $(TARGET)-syms
 

$(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) -o $@
- $(NM) -pa --format=sysv $(@D)/$(@F) \
+ $(NM) -pa --format=sysv $@ \
| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
- >$(@D)/$(@F).map
+ >[email protected]

$(obj)/xen.lds: $(src)/xen.lds.S FORCE
$(call if_changed_dep,cpp_lds_S)

xen/arch/x86/Makefile +0 -0
@@ -150,9 +150,9 @@ $(TARGET)-syms: $(objtree)/prelink.o $(o

$(MAKE) $(build)=$(@D) $(@D)/.$(@F).1.o

$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
   $(orphan-handling-y) $(@D)/.$(@F).1.o -o $@

- $(NM) -pa --format=sysv $(@D)/$(@F) \
+ $(NM) -pa --format=sysv $@ \
| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
- >$(@D)/$(@F).map
+ >[email protected]
rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]*
ifeq ($(CONFIG_XEN_IBT),y)
$(SHELL) $(srctree)/tools/check-endbr.sh $@

xen/arch/x86/Makefile +0 -0
@@ -224,8 +224,9 @@ endif

$(MAKE) $(build)=$(@D) .$(@F).1r.o .$(@F).1s.o

$(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T $(obj)/efi.lds -N $< \
     $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o $(orphan-handling-y) $(note_file_option) -o $@

- $(NM) -pa --format=sysv $(@D)/$(@F) \
- | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort >$(@D)/$(@F).map
+ $(NM) -pa --format=sysv $@ \
+ | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
+ >[email protected]
ifeq ($(CONFIG_DEBUG_INFO),y)
$(if $(filter --strip-debug,$(EFI_LDFLAGS)),:$(space))$(OBJCOPY) -O elf64-x86-64 $@ [email protected] endif