[v2,09/49] binman: Adjust pylibfdt for incremental build

Message ID 20200614025728.41065-4-sjg@chromium.org
State Accepted
Commit 8beed3d7ac5a3253a850bdadcb2dbc1fec6aff6c
Headers show
Series
  • rockchip: x86: Support building ROM files automatically with binman
Related show

Commit Message

Simon Glass June 14, 2020, 2:56 a.m.
If the pylibfdt shared-object file is detected, then Python assumes that
the libfdt.py file exists also.

Sometimes when an incremental build aborts, the shared-object file is
built but the libfdt.py is not. The only way out at this point is to use
'make mkproper', or similar.

Fix this by removing the .so file before it is built. This seems to make
Python rebuild everything.

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

(no changes since v1)

 scripts/dtc/pylibfdt/Makefile | 3 +++
 1 file changed, 3 insertions(+)

Comments

Bin Meng June 29, 2020, 6:21 a.m. | #1
On Sun, Jun 14, 2020 at 10:57 AM Simon Glass <sjg at chromium.org> wrote:
>
> If the pylibfdt shared-object file is detected, then Python assumes that
> the libfdt.py file exists also.
>
> Sometimes when an incremental build aborts, the shared-object file is
> built but the libfdt.py is not. The only way out at this point is to use
> 'make mkproper', or similar.
>
> Fix this by removing the .so file before it is built. This seems to make
> Python rebuild everything.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> (no changes since v1)
>
>  scripts/dtc/pylibfdt/Makefile | 3 +++
>  1 file changed, 3 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>

Patch

diff --git a/scripts/dtc/pylibfdt/Makefile b/scripts/dtc/pylibfdt/Makefile
index 42342c75bb..80b6ad2ae7 100644
--- a/scripts/dtc/pylibfdt/Makefile
+++ b/scripts/dtc/pylibfdt/Makefile
@@ -24,6 +24,9 @@  quiet_cmd_pymod = PYMOD   $@
 		$(PYTHON3) $< --quiet build_ext --inplace
 
 $(obj)/_libfdt.so: $(src)/setup.py $(PYLIBFDT_srcs) FORCE
+	@# Remove the library since otherwise Python doesn't seem to regenerate
+	@# the libfdt.py file if it is missing.
+	rm -f $(obj)/_libfdt*.so
 	$(call if_changed,pymod)
 
 always += _libfdt.so