Skip to contentSkip to conversation

PING: [PATCH] make build tool dependencies portable

DISCUSSION Pavel Fedin 2 participants 5 messages Sep 4, 2015 – Sep 9, 2015 Kbuild

lore
Share & tools
lore
#0 lore raw

Ping

Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia

Quoted 60 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Pavel Fedin
Sent: Thursday, August 27, 2015 12:08 PM
To: [email protected]
Cc: Michal Marek
Subject: [PATCH] make build tool dependencies portable

Autogenerated .c files depend on their generator tool, and an implicit rule is used to build the tool itself. However, an explicit rule is required on platforms where the .exe suffix is used for hostprogs.

This fixes the following errors when building on Cygwin:

make[3]: *** No rule to make target 'drivers/video/logo/logo_linux_clut224.c', needed by 'drivers/video/logo/logo_linux_clut224.o'. Stop. scripts/Makefile.build:403: recipe for target 'drivers/video/logo' failed

make[2]: *** No rule to make target 'crypto/asymmetric_keys/x509-asn1.c', needed by 'crypto/asymmetric_keys/x509-asn1.o'. Stop. scripts/Makefile.build:403: recipe for target 'crypto/asymmetric_keys' failed

---
 drivers/video/logo/Makefile | 1 +
 scripts/Makefile.build      | 2 ++
 2 files changed, 3 insertions(+)
drivers/video/logo/Makefile +1 -0
index 3b43781..cc636f1 100644
@@ -38,6 +38,7 @@ extra-y += $(call logo-cfiles,_clut224,ppm)
 extra-y += $(call logo-cfiles,_gray256,pgm)
 
 pnmtologo := scripts/pnmtologo
+$(pnmtologo): $(objtree)/scripts/pnmtologo.c
 
 # Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..."
 quiet_cmd_logo = LOGO    $@
scripts/Makefile.build +2 -1
index 01df30a..c9ce3b0 100644
@@ -316,6 +316,8 @@ quiet_cmd_asn1_compiler = ASN.1   $@
 $(obj)/%-asn1.c $(obj)/%-asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler
 	$(call cmd,asn1_compiler)
 
+$(objtree)/scripts/asn1_compiler: $(objtree)/scripts/asn1_compiler.c
+
 # Build the compiled-in targets
 # ---------------------------------------------------------------------------
 
--

2.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw

2015-09-04 22:32 GMT+09:00 Pavel Fedin <[email protected]>:

Quoted 43 lines

Ping

Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia

Quoted 35 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Pavel Fedin
Sent: Thursday, August 27, 2015 12:08 PM
To: [email protected]
Cc: Michal Marek
Subject: [PATCH] make build tool dependencies portable

Autogenerated .c files depend on their generator tool, and an implicit rule is used to build the tool itself. However, an explicit rule is required on platforms where the .exe suffix is used for hostprogs.

This fixes the following errors when building on Cygwin:

make[3]: *** No rule to make target 'drivers/video/logo/logo_linux_clut224.c', needed by 'drivers/video/logo/logo_linux_clut224.o'. Stop. scripts/Makefile.build:403: recipe for target 'drivers/video/logo' failed

make[2]: *** No rule to make target 'crypto/asymmetric_keys/x509-asn1.c', needed by 'crypto/asymmetric_keys/x509-asn1.o'. Stop. scripts/Makefile.build:403: recipe for target 'crypto/asymmetric_keys' failed

---
 drivers/video/logo/Makefile | 1 +
 scripts/Makefile.build      | 2 ++
 2 files changed, 3 insertions(+)
drivers/video/logo/Makefile +0 -0
index 3b43781..cc636f1 100644
@@ -38,6 +38,7 @@ extra-y += $(call logo-cfiles,_clut224,ppm)
 extra-y += $(call logo-cfiles,_gray256,pgm)
 
Quoted 2 lines

drivers/video/logo/Makefile extra-y += $(call logo-cfiles,_clut224,ppm) · line 41

Quoted 2 lines
drivers/video/logo/Makefile +1 -0
 pnmtologo := scripts/pnmtologo
+$(pnmtologo): $(objtree)/scripts/pnmtologo.c

scripts/Makefile has the following:

hostprogs-$(CONFIG_LOGO) += pnmtologo

This should work if you enable CONFIG_LOGO in Kconfig.

Quoted 10 lines
Quoted 10 lines
drivers/video/logo/Makefile +0 -0
 # Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..."
 quiet_cmd_logo = LOGO    $@
scripts/Makefile.build +0 -0
index 01df30a..c9ce3b0 100644
@@ -316,6 +316,8 @@ quiet_cmd_asn1_compiler = ASN.1   $@
 $(obj)/%-asn1.c $(obj)/%-asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler
      $(call cmd,asn1_compiler)
 
Quoted 5 lines

scripts/Makefile.build quiet_cmd_asn1_compiler = ASN.1 $@ · line 323

Quoted 5 lines
scripts/Makefile.build +2 -0
+$(objtree)/scripts/asn1_compiler: $(objtree)/scripts/asn1_compiler.c
+
 # Build the compiled-in targets
 # ---------------------------------------------------------------------------
 

Likewise, scripts/Makefile has the following file:

hostprogs-$(CONFIG_ASN1) += asn1_compiler

Please do not screw up Kbuild for Cygwin.

See the answer from Michal (and you agreed)
https://patchwork.kernel.org/patch/7014361/

Signature · 2 lines
Best Regards
Masahiro Yamada
#2 lore raw

Hello!

Quoted 6 lines

scripts/Makefile has the following:

hostprogs-$(CONFIG_LOGO) += pnmtologo

This should work if you enable CONFIG_LOGO in Kconfig.

Yes, i know this. But, pnmlogo, in its turn, depends on pnmlogo.c. This is currently implicit (i don't see explicit lines anywhere), and this appears not to work correctly everywhere.

Quoted 4 lines

Please do not screw up Kbuild for Cygwin.

See the answer from Michal (and you agreed)
https://patchwork.kernel.org/patch/7014361/

Yes, i remember. And my fix doesn't contain any it's etc, it's simple and actually it's generic. Ok, how can improve it further? What about adding explicit dependencies to scripts/Makefile then? These explicit dependencies not only fix Cygwin-related problem, but also make the Makefile more readable, don't they?

Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia

#3 lore raw

2015-09-07 15:56 GMT+09:00 Pavel Fedin <[email protected]>:

Quoted 9 lines

Hello!

Quoted 6 lines

scripts/Makefile has the following:

hostprogs-$(CONFIG_LOGO) += pnmtologo

This should work if you enable CONFIG_LOGO in Kconfig.

Quoted 8 lines

Yes, i know this. But, pnmlogo, in its turn, depends on pnmlogo.c. This is currently implicit (i don't see explicit lines anywhere), and this appears not to work correctly everywhere.

Quoted 4 lines

Please do not screw up Kbuild for Cygwin.

See the answer from Michal (and you agreed)
https://patchwork.kernel.org/patch/7014361/

Yes, i remember. And my fix doesn't contain any it's etc, it's simple and actually it's generic.

Generic?
Your patch is a really ad-hoc fix.

Quoted 17 lines
drivers/video/logo/Makefile +1 -0
index 3b43781..cc636f1 100644
@@ -38,6 +38,7 @@ extra-y += $(call logo-cfiles,_clut224,ppm)
 extra-y += $(call logo-cfiles,_gray256,pgm)
 
 pnmtologo := scripts/pnmtologo
+$(pnmtologo): $(objtree)/scripts/pnmtologo.c
 
 # Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..."
 quiet_cmd_logo = LOGO    $@
scripts/Makefile.build +0 -0
index 01df30a..c9ce3b0 100644

scripts/Makefile.build quiet_cmd_asn1_compiler = ASN.1 $@ · line 320

Quoted 5 lines
scripts/Makefile.build +2 -0
@@ -316,6 +316,8 @@ quiet_cmd_asn1_compiler = ASN.1   $@
 $(obj)/%-asn1.c $(obj)/%-asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler
      $(call cmd,asn1_compiler)
 
+$(objtree)/scripts/asn1_compiler: $(objtree)/scripts/asn1_compiler.c
+

You are adding the dependency of pnmtolog and asn1_compiler.

We have more host tools. See scripts/Makefile

hostprogs-$(CONFIG_KALLSYMS)     += kallsyms
hostprogs-$(CONFIG_LOGO)         += pnmtologo
hostprogs-$(CONFIG_VT)           += conmakehash

hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount hostprogs-$(CONFIG_BUILDTIME_EXTABLE_SORT) += sortextable
hostprogs-$(CONFIG_ASN1) += asn1_compiler

Fixing only two of those host-tools is not generic at all.

Moreover, scripts/Makefile.build is not the place where we put a rule of a particular host tool.

In the first place, if you had a problem with those two host tools, what about scripts/basic/fixdep ?

scripts/basic/Makefile:

hostprogs-y := fixdep

The situation is the same as pnmtologo and asn1_compiler. The dependency is what you call implicit.

Quoted 1 line

Ok, how can improve it further? What about adding explicit dependencies to scripts/Makefile then?

scripts/Makefile.host is the correct place where we fix host-tools problems in a generic way.
But I doubt if we need to fix this.

Quoted 1 line

These explicit dependencies not only fix Cygwin-related problem, but also make the Makefile more readable, don't they?

No.
Kbuild already made Makefiles readable. You are just messing up Makefiles.

Signature · 2 lines
Best Regards
Masahiro Yamada
#4 lore raw

Hello!

Quoted 4 lines

You are adding the dependency of pnmtolog and asn1_compiler.

We have more host tools. See scripts/Makefile

Looks like the problem only happens when we have an explicit dependency of something on this binary. This appears to be the case only for these two tools. Ok, i see your point and i agree that this might be an ad-hoc fix. We can consider it to be GNU make's bug. Let's try that side then. :)

Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia