All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/6] libfdt: Tidy up pylibfdt build rule
@ 2021-03-26  4:02 ` Simon Glass
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2021-03-26  4:02 UTC (permalink / raw)
  To: u-boot

At present the build rule for pylibfdt depends on _libfdt.so but modern
Python versions add a different suffix to the output file, resulting in
something like _libfdt.cpython-38-x86_64-linux-gnu.so

The result is that pylibfdt is rebuilt every time.

Rename the file the standard name so that the rule works correctly. Also
add libfdt.py to the dependencies, so that file is always created if
missing.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v3:
- Make the rm silent
- Use a single build rule to avoid building two pylibfdts in parallel

Changes in v2:
- Adjust tag so this patch doesn't got to dtc list

 scripts/dtc/pylibfdt/Makefile | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/scripts/dtc/pylibfdt/Makefile b/scripts/dtc/pylibfdt/Makefile
index 80b6ad2ae71..4782dd45c6d 100644
--- a/scripts/dtc/pylibfdt/Makefile
+++ b/scripts/dtc/pylibfdt/Makefile
@@ -23,12 +23,18 @@ quiet_cmd_pymod = PYMOD   $@
 		SWIG_OPTS="-I$(LIBFDT_srcdir) -I$(LIBFDT_srcdir)/.." \
 		$(PYTHON3) $< --quiet build_ext --inplace
 
-$(obj)/_libfdt.so: $(src)/setup.py $(PYLIBFDT_srcs) FORCE
+rebuild: $(src)/setup.py $(PYLIBFDT_srcs)
 	@# Remove the library since otherwise Python doesn't seem to regenerate
 	@# the libfdt.py file if it is missing.
-	rm -f $(obj)/_libfdt*.so
+	@rm -f $(obj)/_libfdt*.so
 	$(call if_changed,pymod)
+	@# Rename the file to _libfdt.so so this Makefile doesn't run every time
+	@if [ ! -e $(obj)/_libfdt.so ]; then \
+		mv $(obj)/_libfdt*.so $(obj)/_libfdt.so; \
+	fi
 
-always += _libfdt.so
+$(obj)/_libfdt.so $(obj)/libfdt.py &: rebuild
+
+always += _libfdt.so libfdt.py
 
 clean-files += libfdt.i _libfdt.so libfdt.py libfdt_wrap.c
-- 
2.31.0.291.g576ba9dcdaf-goog

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 1/6] libfdt: Tidy up pylibfdt build rule
@ 2021-03-26  4:02 ` Simon Glass
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2021-03-26  4:02 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Masahiro Yamada, Tom Rini, Simon Glass, Bin Meng, Devicetree Compiler

At present the build rule for pylibfdt depends on _libfdt.so but modern
Python versions add a different suffix to the output file, resulting in
something like _libfdt.cpython-38-x86_64-linux-gnu.so

The result is that pylibfdt is rebuilt every time.

Rename the file the standard name so that the rule works correctly. Also
add libfdt.py to the dependencies, so that file is always created if
missing.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v3:
- Make the rm silent
- Use a single build rule to avoid building two pylibfdts in parallel

Changes in v2:
- Adjust tag so this patch doesn't got to dtc list

 scripts/dtc/pylibfdt/Makefile | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/scripts/dtc/pylibfdt/Makefile b/scripts/dtc/pylibfdt/Makefile
index 80b6ad2ae71..4782dd45c6d 100644
--- a/scripts/dtc/pylibfdt/Makefile
+++ b/scripts/dtc/pylibfdt/Makefile
@@ -23,12 +23,18 @@ quiet_cmd_pymod = PYMOD   $@
 		SWIG_OPTS="-I$(LIBFDT_srcdir) -I$(LIBFDT_srcdir)/.." \
 		$(PYTHON3) $< --quiet build_ext --inplace
 
-$(obj)/_libfdt.so: $(src)/setup.py $(PYLIBFDT_srcs) FORCE
+rebuild: $(src)/setup.py $(PYLIBFDT_srcs)
 	@# Remove the library since otherwise Python doesn't seem to regenerate
 	@# the libfdt.py file if it is missing.
-	rm -f $(obj)/_libfdt*.so
+	@rm -f $(obj)/_libfdt*.so
 	$(call if_changed,pymod)
+	@# Rename the file to _libfdt.so so this Makefile doesn't run every time
+	@if [ ! -e $(obj)/_libfdt.so ]; then \
+		mv $(obj)/_libfdt*.so $(obj)/_libfdt.so; \
+	fi
 
-always += _libfdt.so
+$(obj)/_libfdt.so $(obj)/libfdt.py &: rebuild
+
+always += _libfdt.so libfdt.py
 
 clean-files += libfdt.i _libfdt.so libfdt.py libfdt_wrap.c
-- 
2.31.0.291.g576ba9dcdaf-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 1/6] libfdt: Tidy up pylibfdt build rule
  2021-03-26  4:02 ` Simon Glass
@ 2021-03-26  6:08   ` Simon Glass
  -1 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2021-03-26  6:08 UTC (permalink / raw)
  To: u-boot

On Fri, 26 Mar 2021 at 17:02, Simon Glass <sjg@chromium.org> wrote:
>
> At present the build rule for pylibfdt depends on _libfdt.so but modern
> Python versions add a different suffix to the output file, resulting in
> something like _libfdt.cpython-38-x86_64-linux-gnu.so
>
> The result is that pylibfdt is rebuilt every time.
>
> Rename the file the standard name so that the rule works correctly. Also
> add libfdt.py to the dependencies, so that file is always created if
> missing.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v3:
> - Make the rm silent
> - Use a single build rule to avoid building two pylibfdts in parallel
>
> Changes in v2:
> - Adjust tag so this patch doesn't got to dtc list
>
>  scripts/dtc/pylibfdt/Makefile | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)

Applied to u-boot-dm/next
(replacing v2)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/6] libfdt: Tidy up pylibfdt build rule
@ 2021-03-26  6:08   ` Simon Glass
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2021-03-26  6:08 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Masahiro Yamada, Tom Rini, Bin Meng, Devicetree Compiler

On Fri, 26 Mar 2021 at 17:02, Simon Glass <sjg@chromium.org> wrote:
>
> At present the build rule for pylibfdt depends on _libfdt.so but modern
> Python versions add a different suffix to the output file, resulting in
> something like _libfdt.cpython-38-x86_64-linux-gnu.so
>
> The result is that pylibfdt is rebuilt every time.
>
> Rename the file the standard name so that the rule works correctly. Also
> add libfdt.py to the dependencies, so that file is always created if
> missing.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v3:
> - Make the rm silent
> - Use a single build rule to avoid building two pylibfdts in parallel
>
> Changes in v2:
> - Adjust tag so this patch doesn't got to dtc list
>
>  scripts/dtc/pylibfdt/Makefile | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)

Applied to u-boot-dm/next
(replacing v2)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-26  6:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26  4:02 [PATCH v3 1/6] libfdt: Tidy up pylibfdt build rule Simon Glass
2021-03-26  4:02 ` Simon Glass
2021-03-26  6:08 ` Simon Glass
2021-03-26  6:08   ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.