[PATCH 2/2] libfdt: Introduce libfdt shared library
Josh Boyer
jwboyer at linux.vnet.ibm.com
Wed Nov 26 01:23:23 EST 2008
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 at linux.vnet.ibm.com>
---
Makefile | 12 ++++++++++--
libfdt/Makefile.libfdt | 1 +
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index b3b85a5..bc6058e 100644
--- a/Makefile
+++ b/Makefile
@@ -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,10 @@ clean: libfdt_clean tests_clean
@$(VECHO) AR $@
$(AR) $(ARFLAGS) $@ $^
+$(LIBFDT_lib):
+ @$(VECHO) LD $@
+ $(CC) $(LDFLAGS) -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,$(notdir $@) -shared -o $(LIBFDT_objdir)/libfdt-$(DTC_VERSION).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)
--
1.5.6.5
More information about the devicetree-discuss
mailing list