All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] libfdt: Introduce libfdt shared library
@ 2009-01-02 13:20 Josh Boyer
       [not found] ` <20090102132034.GB8954-jnIq6iUNB1CO8iYQgJmm/0EOCMrvLtNR@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Josh Boyer @ 2009-01-02 13:20 UTC (permalink / raw)
  To: devicetree-discuss-mnsaURCQ41sdnm+yROfE0A

Build a libfdt shared library in addition to the existing .a that is
created.  Symbol versioning is used from the libfdt/version.lds script.

Signed-off-by: Josh Boyer <jwboyer-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
---
 Makefile               |   15 ++++++++++++---
 libfdt/Makefile.libfdt |    1 +
 tests/Makefile.tests   |    4 ++--
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index b3b85a5..8d5b929 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@ LOCAL_VERSION =
 CONFIG_LOCALVERSION =
 
 CPPFLAGS = -I libfdt
-CFLAGS = -Wall -g -Os -Wpointer-arith -Wcast-qual
+CFLAGS = -Wall -g -Os -fPIC -Wpointer-arith -Wcast-qual
 
 BISON = bison
 LEX = flex
@@ -115,19 +115,23 @@ endif
 #
 LIBFDT_objdir = libfdt
 LIBFDT_srcdir = libfdt
-LIBFDT_lib = $(LIBFDT_objdir)/libfdt.a
+LIBFDT_archive = $(LIBFDT_objdir)/libfdt.a
+LIBFDT_lib = $(LIBFDT_objdir)/libfdt.so
 LIBFDT_include = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_INCLUDES))
+LIBFDT_version = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_VERSION))
 
 include $(LIBFDT_srcdir)/Makefile.libfdt
 
 .PHONY: libfdt
-libfdt: $(LIBFDT_lib)
+libfdt: $(LIBFDT_archive) $(LIBFDT_lib)
 
+$(LIBFDT_archive): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS))
 $(LIBFDT_lib): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS))
 
 libfdt_clean:
 	@$(VECHO) CLEAN "(libfdt)"
 	rm -f $(addprefix $(LIBFDT_objdir)/,$(STD_CLEANFILES))
+	rm -f $(LIBFDT_objdir)/*.so
 
 ifneq ($(DEPTARGETS),)
 -include $(LIBFDT_OBJS:%.o=$(LIBFDT_objdir)/%.d)
@@ -215,6 +219,11 @@ clean: libfdt_clean tests_clean
 	@$(VECHO) AR $@
 	$(AR) $(ARFLAGS) $@ $^
 
+$(LIBFDT_lib):
+	@$(VECHO) LD $@
+	$(CC) $(LDFLAGS) -fPIC -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,$(notdir $@) -shared -o $(LIBFDT_objdir)/libfdt-$(DTC_VERSION).so $^
+	ln -s libfdt-$(DTC_VERSION).so $(LIBFDT_objdir)/libfdt.so
+
 %.lex.c: %.l
 	@$(VECHO) LEX $@
 	$(LEX) -o$@ $<
diff --git a/libfdt/Makefile.libfdt b/libfdt/Makefile.libfdt
index 6c42acf..341c803 100644
--- a/libfdt/Makefile.libfdt
+++ b/libfdt/Makefile.libfdt
@@ -4,5 +4,6 @@
 # be easily embeddable into other systems of Makefiles.
 #
 LIBFDT_INCLUDES = fdt.h libfdt.h
+LIBFDT_VERSION = version.lds
 LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
 LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o)
diff --git a/tests/Makefile.tests b/tests/Makefile.tests
index 21a311e..3a041ff 100644
--- a/tests/Makefile.tests
+++ b/tests/Makefile.tests
@@ -35,9 +35,9 @@ TESTS_CLEANFILES = $(TESTS) $(TESTS_CLEANFILES_L:%=$(TESTS_PREFIX)%)
 .PHONY: tests
 tests:	$(TESTS) $(TESTS_TREES)
 
-$(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o $(LIBFDT_lib)
+$(LIB_TESTS): %: $(TESTS_PREFIX)testutils.o $(LIBFDT_archive)
 
-$(LIBTREE_TESTS): %: $(TESTS_PREFIX)testutils.o $(TESTS_PREFIX)trees.o $(LIBFDT_lib)
+$(LIBTREE_TESTS): %: $(TESTS_PREFIX)testutils.o $(TESTS_PREFIX)trees.o $(LIBFDT_archive)
 
 $(TESTS_PREFIX)dumptrees: $(TESTS_PREFIX)trees.o
 
-- 
1.6.0.6

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

end of thread, other threads:[~2009-01-02 15:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-02 13:20 [PATCH v2] libfdt: Introduce libfdt shared library Josh Boyer
     [not found] ` <20090102132034.GB8954-jnIq6iUNB1CO8iYQgJmm/0EOCMrvLtNR@public.gmane.org>
2009-01-02 15:38   ` Jon Loeliger

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.