* [PATCH] Depend on .a instead of .so when building static
@ 2022-06-23 12:44 Tero Tervala
[not found] ` <20220623124444.445049-1-tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Tero Tervala @ 2022-06-23 12:44 UTC (permalink / raw)
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA; +Cc: Tero Tervala
Static build needs to be indicated with an environment variable:
STATIC_BUILD=1
Checks are skipped on static builds as they contain dynamic
library tests.
Signed-off-by: Tero Tervala <tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org>
---
Makefile | 12 +++++++++---
tests/Makefile.tests | 11 ++++++++---
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index ee77115..9f550b4 100644
--- a/Makefile
+++ b/Makefile
@@ -198,6 +198,12 @@ LIBFDT_lib = $(LIBFDT_dir)/$(LIBFDT_LIB)
LIBFDT_include = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_INCLUDES))
LIBFDT_version = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_VERSION))
+ifeq ($(STATIC_BUILD),1)
+ LIBFDT_dep = $(LIBFDT_archive)
+else
+ LIBFDT_dep = $(LIBFDT_lib)
+endif
+
include $(LIBFDT_dir)/Makefile.libfdt
.PHONY: libfdt
@@ -261,11 +267,11 @@ convert-dtsv0: $(CONVERT_OBJS)
fdtdump: $(FDTDUMP_OBJS)
-fdtget: $(FDTGET_OBJS) $(LIBFDT_lib)
+fdtget: $(FDTGET_OBJS) $(LIBFDT_dep)
-fdtput: $(FDTPUT_OBJS) $(LIBFDT_lib)
+fdtput: $(FDTPUT_OBJS) $(LIBFDT_dep)
-fdtoverlay: $(FDTOVERLAY_OBJS) $(LIBFDT_lib)
+fdtoverlay: $(FDTOVERLAY_OBJS) $(LIBFDT_dep)
dist:
git archive --format=tar --prefix=dtc-$(dtc_version)/ HEAD \
diff --git a/tests/Makefile.tests b/tests/Makefile.tests
index 2f78952..f13b16d 100644
--- a/tests/Makefile.tests
+++ b/tests/Makefile.tests
@@ -60,17 +60,17 @@ TESTS_CLEANDIRS = $(TESTS_CLEANDIRS_L:%=$(TESTS_PREFIX)%)
.PHONY: tests
tests: $(TESTS) $(TESTS_TREES)
-$(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_lib)
+$(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_dep)
# Not necessary on all platforms; allow -ldl to be excluded instead of forcing
# other platforms to patch it out.
LIBDL = -ldl
-$(DL_LIB_TESTS): %: %.o $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_lib)
+$(DL_LIB_TESTS): %: %.o $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_dep)
@$(VECHO) LD [libdl] $@
$(LINK.c) -o $@ $^ $(LIBDL)
$(LIBTREE_TESTS): %: $(TESTS_PREFIX)testutils.o $(TESTS_PREFIX)trees.o \
- util.o $(LIBFDT_lib)
+ util.o $(LIBFDT_dep)
$(TESTS_PREFIX)dumptrees: $(TESTS_PREFIX)trees.o
@@ -83,8 +83,13 @@ tests_clean:
rm -f $(TESTS_CLEANFILES)
rm -rf $(TESTS_CLEANDIRS)
+ifeq ($(STATIC_BUILD),1)
+check:
+ @echo Skipping checks for static build
+else
check: tests ${TESTS_BIN} $(TESTS_PYLIBFDT)
cd $(TESTS_PREFIX); ./run_tests.sh
+endif
ifeq ($(NO_VALGRIND),1)
checkm:
--
2.33.3
^ permalink raw reply related [flat|nested] 2+ messages in thread[parent not found: <20220623124444.445049-1-tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] Depend on .a instead of .so when building static [not found] ` <20220623124444.445049-1-tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org> @ 2022-06-24 2:24 ` David Gibson 0 siblings, 0 replies; 2+ messages in thread From: David Gibson @ 2022-06-24 2:24 UTC (permalink / raw) To: Tero Tervala; +Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 3550 bytes --] The short description buries the lede a bit - this is adding Makefile support for a static build, rather than just correcting something that's already there. Given that we're uncomfortably mid-transition between makefiles and a meson build, I don't love adding support for this to the makefiles but not the meson configuration. On Thu, Jun 23, 2022 at 03:44:44PM +0300, Tero Tervala wrote: > Static build needs to be indicated with an environment variable: > STATIC_BUILD=1 > > Checks are skipped on static builds as they contain dynamic > library tests. I don't like dropping all the tests for a static build. I'd much prefer just to see any specific tests which require dynamic linking to be skipped. I can't quickly see any tests which inherently need the dynamic library apart, possibly, from the pylibfdt tests. > > Signed-off-by: Tero Tervala <tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org> > --- > Makefile | 12 +++++++++--- > tests/Makefile.tests | 11 ++++++++--- > 2 files changed, 17 insertions(+), 6 deletions(-) > > diff --git a/Makefile b/Makefile > index ee77115..9f550b4 100644 > --- a/Makefile > +++ b/Makefile > @@ -198,6 +198,12 @@ LIBFDT_lib = $(LIBFDT_dir)/$(LIBFDT_LIB) > LIBFDT_include = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_INCLUDES)) > LIBFDT_version = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_VERSION)) > > +ifeq ($(STATIC_BUILD),1) > + LIBFDT_dep = $(LIBFDT_archive) > +else > + LIBFDT_dep = $(LIBFDT_lib) > +endif > + > include $(LIBFDT_dir)/Makefile.libfdt > > .PHONY: libfdt > @@ -261,11 +267,11 @@ convert-dtsv0: $(CONVERT_OBJS) > > fdtdump: $(FDTDUMP_OBJS) > > -fdtget: $(FDTGET_OBJS) $(LIBFDT_lib) > +fdtget: $(FDTGET_OBJS) $(LIBFDT_dep) > > -fdtput: $(FDTPUT_OBJS) $(LIBFDT_lib) > +fdtput: $(FDTPUT_OBJS) $(LIBFDT_dep) > > -fdtoverlay: $(FDTOVERLAY_OBJS) $(LIBFDT_lib) > +fdtoverlay: $(FDTOVERLAY_OBJS) $(LIBFDT_dep) > > dist: > git archive --format=tar --prefix=dtc-$(dtc_version)/ HEAD \ > diff --git a/tests/Makefile.tests b/tests/Makefile.tests > index 2f78952..f13b16d 100644 > --- a/tests/Makefile.tests > +++ b/tests/Makefile.tests > @@ -60,17 +60,17 @@ TESTS_CLEANDIRS = $(TESTS_CLEANDIRS_L:%=$(TESTS_PREFIX)%) > .PHONY: tests > tests: $(TESTS) $(TESTS_TREES) > > -$(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_lib) > +$(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_dep) > > # Not necessary on all platforms; allow -ldl to be excluded instead of forcing > # other platforms to patch it out. > LIBDL = -ldl > -$(DL_LIB_TESTS): %: %.o $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_lib) > +$(DL_LIB_TESTS): %: %.o $(TESTS_PREFIX)testutils.o util.o $(LIBFDT_dep) > @$(VECHO) LD [libdl] $@ > $(LINK.c) -o $@ $^ $(LIBDL) > > $(LIBTREE_TESTS): %: $(TESTS_PREFIX)testutils.o $(TESTS_PREFIX)trees.o \ > - util.o $(LIBFDT_lib) > + util.o $(LIBFDT_dep) > > $(TESTS_PREFIX)dumptrees: $(TESTS_PREFIX)trees.o > > @@ -83,8 +83,13 @@ tests_clean: > rm -f $(TESTS_CLEANFILES) > rm -rf $(TESTS_CLEANDIRS) > > +ifeq ($(STATIC_BUILD),1) > +check: > + @echo Skipping checks for static build > +else > check: tests ${TESTS_BIN} $(TESTS_PYLIBFDT) > cd $(TESTS_PREFIX); ./run_tests.sh > +endif > > ifeq ($(NO_VALGRIND),1) > checkm: -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-24 2:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-23 12:44 [PATCH] Depend on .a instead of .so when building static Tero Tervala
[not found] ` <20220623124444.445049-1-tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org>
2022-06-24 2:24 ` David Gibson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).