aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSimon Glass2021-03-25 06:40:48 +1300
committerSimon Glass2021-03-26 17:03:04 +1300
commit91f414b3a82e5e8419a0ad703b7055884c4be254 (patch)
tree358d98b2c6a80eefcb46bdf13f61913d24eeb750 /scripts
parent4c6f65074e75fc9ddf5aa553f2f0738617fd00d5 (diff)
libfdt: Tidy up pylibfdt build rule
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>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/dtc/pylibfdt/Makefile12
1 files 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