* [PATCH v2] Allow static building with make
@ 2022-06-29 16:35 Tero Tervala
[not found] ` <20220629163531.932281-1-tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Tero Tervala @ 2022-06-29 16:35 UTC (permalink / raw)
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA; +Cc: Tero Tervala
Set STATIC_BUILD=1 environment variable to enable static building
when using makefiles.
Signed-off-by: Tero Tervala <tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org>
---
Makefile | 13 ++++++++++---
tests/Makefile.tests | 12 +++++++-----
tests/run_tests.sh | 10 +++++++---
3 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/Makefile b/Makefile
index ee77115..9f1223f 100644
--- a/Makefile
+++ b/Makefile
@@ -198,6 +198,13 @@ LIBFDT_lib = $(LIBFDT_dir)/$(LIBFDT_LIB)
LIBFDT_include = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_INCLUDES))
LIBFDT_version = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_VERSION))
+ifeq ($(STATIC_BUILD),1)
+ CFLAGS += -static
+ LIBFDT_dep = $(LIBFDT_archive)
+else
+ LIBFDT_dep = $(LIBFDT_lib)
+endif
+
include $(LIBFDT_dir)/Makefile.libfdt
.PHONY: libfdt
@@ -261,11 +268,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..2d36c5d 100644
--- a/tests/Makefile.tests
+++ b/tests/Makefile.tests
@@ -37,8 +37,10 @@ LIBTREE_TESTS_L = truncated_property truncated_string truncated_memrsv \
LIBTREE_TESTS = $(LIBTREE_TESTS_L:%=$(TESTS_PREFIX)%)
-DL_LIB_TESTS_L = asm_tree_dump value-labels
-DL_LIB_TESTS = $(DL_LIB_TESTS_L:%=$(TESTS_PREFIX)%)
+ifneq ($(STATIC_BUILD),1)
+ DL_LIB_TESTS_L = asm_tree_dump value-labels
+ DL_LIB_TESTS = $(DL_LIB_TESTS_L:%=$(TESTS_PREFIX)%)
+endif
TESTS = $(LIB_TESTS) $(LIBTREE_TESTS) $(DL_LIB_TESTS)
@@ -60,17 +62,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
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 1b16eb8..0cabd13 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -607,11 +607,15 @@ dtc_tests () {
run_dtc_test -I dts -O asm -o oasm_$tree.test.s "$SRCDIR/$tree"
asm_to_so_test oasm_$tree
run_dtc_test -I dts -O dtb -o $tree.test.dtb "$SRCDIR/$tree"
- run_test asm_tree_dump ./oasm_$tree.test.so oasm_$tree.test.dtb
- run_wrap_test cmp oasm_$tree.test.dtb $tree.test.dtb
+ if [ -x ./asm_tree_dump ]; then
+ run_test asm_tree_dump ./oasm_$tree.test.so oasm_$tree.test.dtb
+ run_wrap_test cmp oasm_$tree.test.dtb $tree.test.dtb
+ fi
done
- run_test value-labels ./oasm_value-labels.dts.test.so
+ if [ -x ./value-labels ]; then
+ run_test value-labels ./oasm_value-labels.dts.test.so
+ fi
# Check -Odts mode preserve all dtb information
for tree in test_tree1.dtb dtc_tree1.test.dtb dtc_escapes.test.dtb \
--
2.33.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] Allow static building with make
[not found] ` <20220629163531.932281-1-tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org>
@ 2022-07-27 6:48 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2022-07-27 6:48 UTC (permalink / raw)
To: Tero Tervala; +Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 4080 bytes --]
On Wed, Jun 29, 2022 at 07:35:31PM +0300, Tero Tervala wrote:
> Set STATIC_BUILD=1 environment variable to enable static building
> when using makefiles.
>
> Signed-off-by: Tero Tervala <tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org>
Applied, thanks.
> ---
> Makefile | 13 ++++++++++---
> tests/Makefile.tests | 12 +++++++-----
> tests/run_tests.sh | 10 +++++++---
> 3 files changed, 24 insertions(+), 11 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index ee77115..9f1223f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -198,6 +198,13 @@ LIBFDT_lib = $(LIBFDT_dir)/$(LIBFDT_LIB)
> LIBFDT_include = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_INCLUDES))
> LIBFDT_version = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_VERSION))
>
> +ifeq ($(STATIC_BUILD),1)
> + CFLAGS += -static
> + LIBFDT_dep = $(LIBFDT_archive)
> +else
> + LIBFDT_dep = $(LIBFDT_lib)
> +endif
> +
> include $(LIBFDT_dir)/Makefile.libfdt
>
> .PHONY: libfdt
> @@ -261,11 +268,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..2d36c5d 100644
> --- a/tests/Makefile.tests
> +++ b/tests/Makefile.tests
> @@ -37,8 +37,10 @@ LIBTREE_TESTS_L = truncated_property truncated_string truncated_memrsv \
>
> LIBTREE_TESTS = $(LIBTREE_TESTS_L:%=$(TESTS_PREFIX)%)
>
> -DL_LIB_TESTS_L = asm_tree_dump value-labels
> -DL_LIB_TESTS = $(DL_LIB_TESTS_L:%=$(TESTS_PREFIX)%)
> +ifneq ($(STATIC_BUILD),1)
> + DL_LIB_TESTS_L = asm_tree_dump value-labels
> + DL_LIB_TESTS = $(DL_LIB_TESTS_L:%=$(TESTS_PREFIX)%)
> +endif
>
> TESTS = $(LIB_TESTS) $(LIBTREE_TESTS) $(DL_LIB_TESTS)
>
> @@ -60,17 +62,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
>
> diff --git a/tests/run_tests.sh b/tests/run_tests.sh
> index 1b16eb8..0cabd13 100755
> --- a/tests/run_tests.sh
> +++ b/tests/run_tests.sh
> @@ -607,11 +607,15 @@ dtc_tests () {
> run_dtc_test -I dts -O asm -o oasm_$tree.test.s "$SRCDIR/$tree"
> asm_to_so_test oasm_$tree
> run_dtc_test -I dts -O dtb -o $tree.test.dtb "$SRCDIR/$tree"
> - run_test asm_tree_dump ./oasm_$tree.test.so oasm_$tree.test.dtb
> - run_wrap_test cmp oasm_$tree.test.dtb $tree.test.dtb
> + if [ -x ./asm_tree_dump ]; then
> + run_test asm_tree_dump ./oasm_$tree.test.so oasm_$tree.test.dtb
> + run_wrap_test cmp oasm_$tree.test.dtb $tree.test.dtb
> + fi
> done
>
> - run_test value-labels ./oasm_value-labels.dts.test.so
> + if [ -x ./value-labels ]; then
> + run_test value-labels ./oasm_value-labels.dts.test.so
> + fi
>
> # Check -Odts mode preserve all dtb information
> for tree in test_tree1.dtb dtc_tree1.test.dtb dtc_escapes.test.dtb \
--
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-07-27 6:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 16:35 [PATCH v2] Allow static building with make Tero Tervala
[not found] ` <20220629163531.932281-1-tero.tervala-ddXEi6N5mqbQT0dZR+AlfA@public.gmane.org>
2022-07-27 6:48 ` David Gibson
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.