Skip to contentSkip to conversation

scripts/Makefile.lib: remove overridden target $(obj)/helloworld.so:

PATCH New Heinrich Schuchardt 3 participants 5 messages Sep 3, 2017 – Sep 7, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/Makefile.lib: remove overridden target $(obj)/helloworld.so:

The target
$(obj)/helloworld.so:
exists twice in Makefile.lib.

If you add an echo command to each of the two recipes you get warnings like:

scripts/Makefile.lib:383: warning:
overriding recipe for target 'drivers/power/battery/helloworld.so' scripts/Makefile.lib:379: warning:
ignoring old recipe for target 'drivers/power/battery/helloworld.so'

This patch removes the obsolete target.

---
Hello Alex,

could you, please, review the change as it relates to EFI.

Best regards

Heinrich

---
 scripts/Makefile.lib | 2 --
 1 file changed, 2 deletions(-)
scripts/Makefile.lib +0 -2
index 9ce47b4d22..7f97e8ebf3 100644
@@ -375,8 +375,6 @@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \
 
 EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS)
 
-$(obj)/helloworld.so: $(EFI_LDS_PATH)
-
 $(obj)/helloworld.so: $(obj)/helloworld.o arch/$(ARCH)/lib/$(EFI_CRT0) \
 		arch/$(ARCH)/lib/$(EFI_RELOC)
 	$(call cmd,efi_ld)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 scripts/Makefile.lib: remove overridden target $(obj)/helloworld.so:

Quoted 12 lines · Heinrich Schuchardt

The target
$(obj)/helloworld.so:
exists twice in Makefile.lib.

If you add an echo command to each of the two recipes you get warnings like:

scripts/Makefile.lib:383: warning:
overriding recipe for target 'drivers/power/battery/helloworld.so' scripts/Makefile.lib:379: warning:
ignoring old recipe for target 'drivers/power/battery/helloworld.so'

Quoted 7 lines

This patch removes the obsolete target.

---
Hello Alex,

could you, please, review the change as it relates to EFI.

My Makefile foo isn't quite as good as it should be, but doesn't the existing code simply add another dependency to the required build chain?

Alex

Quoted 22 lines

Best regards

Heinrich

---
  scripts/Makefile.lib | 2 --
  1 file changed, 2 deletions(-)
scripts/Makefile.lib +0 -2
index 9ce47b4d22..7f97e8ebf3 100644
@@ -375,8 +375,6 @@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \
 
  EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS)
 
-$(obj)/helloworld.so: $(EFI_LDS_PATH)
-
  $(obj)/helloworld.so: $(obj)/helloworld.o arch/$(ARCH)/lib/$(EFI_CRT0) \
  		arch/$(ARCH)/lib/$(EFI_RELOC)
  	$(call cmd,efi_ld)
#2 lore raw

PATCH 1/1 scripts/Makefile.lib: remove overridden target $(obj)/helloworld.so:

Quoted 17 lines · Alexander Graf
Quoted 14 lines · Heinrich Schuchardt

The target
$(obj)/helloworld.so:
exists twice in Makefile.lib.

If you add an echo command to each of the two recipes you get warnings like:

scripts/Makefile.lib:383: warning:
overriding recipe for target 'drivers/power/battery/helloworld.so' scripts/Makefile.lib:379: warning:
ignoring old recipe for target 'drivers/power/battery/helloworld.so'

This patch removes the obsolete target.

Quoted 9 lines
Quoted 5 lines

---
Hello Alex,

could you, please, review the change as it relates to EFI.

My Makefile foo isn't quite as good as it should be, but doesn't the existing code simply add another dependency to the required build chain?

The target is overridden so why should the dependency be executed?

https://www.gnu.org/software/make/manual/html_node/Overriding-Makefiles.html
says:
"However, it is invalid for two makefiles to give different recipes for the same target. I guess this will be valid for a single makefile too."

If you think the dependency is necessary, I can add it to the remaining target. Is this what you prefer?

Regards

Heinrich

Quoted 26 lines

Alex

Quoted 22 lines

Best regards

Heinrich

---
  scripts/Makefile.lib | 2 --
  1 file changed, 2 deletions(-)
scripts/Makefile.lib +0 -1
index 9ce47b4d22..7f97e8ebf3 100644
@@ -375,8 +375,6 @@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T
 $(EFI_LDS_PATH) -shared \
    EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS)
  -$(obj)/helloworld.so: $(EFI_LDS_PATH)
-
  $(obj)/helloworld.so: $(obj)/helloworld.o
 arch/$(ARCH)/lib/$(EFI_CRT0) \
          arch/$(ARCH)/lib/$(EFI_RELOC)
      $(call cmd,efi_ld)
#3 lore raw

PATCH 1/1 scripts/Makefile.lib: remove overridden target $(obj)/helloworld.so:

Quoted 27 lines · On Sonntag, 3. September 2017 17:26:43 CEST Heinrich Schuchardt wrote:
Quoted 15 lines · Alexander Graf
Quoted 14 lines · Heinrich Schuchardt

The target
$(obj)/helloworld.so:
exists twice in Makefile.lib.

If you add an echo command to each of the two recipes you get warnings like:

scripts/Makefile.lib:383: warning:
overriding recipe for target 'drivers/power/battery/helloworld.so' scripts/Makefile.lib:379: warning:
ignoring old recipe for target 'drivers/power/battery/helloworld.so'

This patch removes the obsolete target.

Quoted 8 lines
Quoted 5 lines

---
Hello Alex,

could you, please, review the change as it relates to EFI.

My Makefile foo isn't quite as good as it should be, but doesn't the existing code simply add another dependency to the required build chain?

The target is overridden so why should the dependency be executed?

Quoted 7 lines

https://www.gnu.org/software/make/manual/html_node/Overriding-Makefiles.html
says:
"However, it is invalid for two makefiles to give different recipes for the same target. I guess this will be valid for a single makefile too."

If you think the dependency is necessary, I can add it to the remaining target. Is this what you prefer?

Note there is a difference between prerequisite and recipe - specifying a target multiple times without recipe adds the the prerequisite to the existing set, see

https://www.gnu.org/software/make/manual/html_node/Multiple-Targets.html#Multiple-Targets

---
foo: a

foo: b c

a:
@echo "Creating prereq a"

%:

        @echo "Creating $@"

----

This tries to create the default target foo (first specified target), which has three prerequisites (a, b, c), which are run in parallel.

Kind regards,

Stefan

#4 lore raw

PATCH 1/1 scripts/Makefile.lib: remove overridden target $(obj)/helloworld.so:

In reply to Alexander Graf
Quoted 17 lines · Alexander Graf
Quoted 14 lines · Heinrich Schuchardt

The target
$(obj)/helloworld.so:
exists twice in Makefile.lib.

If you add an echo command to each of the two recipes you get warnings like:

scripts/Makefile.lib:383: warning:
overriding recipe for target 'drivers/power/battery/helloworld.so' scripts/Makefile.lib:379: warning:
ignoring old recipe for target 'drivers/power/battery/helloworld.so'

This patch removes the obsolete target.

Quoted 9 lines
Quoted 5 lines

---
Hello Alex,

could you, please, review the change as it relates to EFI.

My Makefile foo isn't quite as good as it should be, but doesn't the existing code simply add another dependency to the required build chain?

But the value given as "dependency" is not a valid target:

$ make arch/x86/lib/elf_ia32_efi.lds
make: Nothing to be done for 'arch/x86/lib/elf_ia32_efi.lds'.

So the line removed by the patch is just bogus.

But as it is overridden it is not executed.

Regards

Heinrich

Quoted 26 lines

Alex

Quoted 22 lines

Best regards

Heinrich

---
  scripts/Makefile.lib | 2 --
  1 file changed, 2 deletions(-)
scripts/Makefile.lib +0 -1
index 9ce47b4d22..7f97e8ebf3 100644
@@ -375,8 +375,6 @@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T
 $(EFI_LDS_PATH) -shared \
    EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS)
  -$(obj)/helloworld.so: $(EFI_LDS_PATH)
-
  $(obj)/helloworld.so: $(obj)/helloworld.o
 arch/$(ARCH)/lib/$(EFI_CRT0) \
          arch/$(ARCH)/lib/$(EFI_RELOC)
      $(call cmd,efi_ld)