summaryrefslogtreecommitdiffstats
path: root/libelf/Makefile.am
diff options
context:
space:
mode:
Diffstat (limited to 'libelf/Makefile.am')
-rw-r--r--libelf/Makefile.am67
1 files changed, 48 insertions, 19 deletions
diff --git a/libelf/Makefile.am b/libelf/Makefile.am
index 167a8322..1a2b85a9 100644
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
@@ -29,14 +29,13 @@
##
include $(top_srcdir)/config/eu.am
if BUILD_STATIC
-AM_CFLAGS += -fPIC
+AM_CFLAGS += $(fpic_CFLAGS)
endif
GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
-VERSION = 1
lib_LIBRARIES = libelf.a
noinst_LIBRARIES = libelf_pic.a
-noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so)
+noinst_DATA = $(libelf_BARE)
include_HEADERS = libelf.h gelf.h nlist.h
pkginclude_HEADERS = elf-knowledge.h
@@ -95,33 +94,63 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \
libelf_pic_a_SOURCES =
am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
-libelf_so_LDLIBS = -lz
+libelf_so_LDLIBS = -lz $(intl_LDADD)
if USE_LOCKS
libelf_so_LDLIBS += -lpthread
endif
+if USE_GNULIB
+libelf_so_LDLIBS += ../libgnu/libgnu.a
+endif
+if NATIVE_PE
+GEN_DEF = -Wl,--output-def=$(libelf_BARE:.dll=.def)
+CLEANFILES += $(libelf_BARE:.dll=.def)
+else
+GEN_DEF =
+endif
-libelf_so_SOURCES =
-libelf.so$(EXEEXT): libelf_pic.a libelf.map
- $(AM_V_CCLD)$(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
+$(libelf_BARE): libelf_pic.a libelf.map
+ $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
- -Wl,--soname,$@.$(VERSION),-z,defs,-z,relro $(libelf_so_LDLIBS)
+ -Wl,--soname,$(libelf_SONAME) $(GEN_DEF) $(libelf_so_LDLIBS)
@$(textrel_check)
- $(AM_V_at)ln -fs $@ $@.$(VERSION)
+ $(AM_V_at)ln -fs $@ $(libelf_SONAME)
-install: install-am libelf.so
+if NATIVE_PE
+install-lib: $(libelf_BARE:.dll=.lib)
$(mkinstalldirs) $(DESTDIR)$(libdir)
- $(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
- ln -fs libelf-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
- ln -fs libelf.so.$(VERSION) $(DESTDIR)$(libdir)/libelf.so
+ $(INSTALL_PROGRAM) $< $(DESTDIR)$(libdir)/$(libelf_VERSIONED:.dll=.lib)
+ ln -fs $(libelf_VERSIONED:.dll=.lib) $(DESTDIR)$(libdir)/$(libelf_SONAME:.dll=.lib)
+ ln -fs $(libelf_SONAME:.dll=.lib) $(DESTDIR)$(libdir)/$(libelf_BARE:.dll=.lib)
+uninstall-lib:
+ rm -f $(DESTDIR)$(libdir)/$(libelf_VERSIONED:.dll=.lib)
+ rm -f $(DESTDIR)$(libdir)/$(libelf_SONAME:.dll=.lib)
+ rm -f $(DESTDIR)$(libdir)/$(libelf_BARE:.dll=.lib)
+CLEANFILES += $(libelf_BARE:.dll=.lib) $(libelf_BARE:.dll=.exp)
+else
+install-lib:
+uninstall-lib:
+endif
+
+install: install-am install-lib $(libelf_BARE)
+ $(INSTALL_PROGRAM) $(libelf_BARE) $(DESTDIR)$(libdir)/$(libelf_VERSIONED)
+ ln -fs $(libelf_VERSIONED) $(DESTDIR)$(libdir)/$(libelf_SONAME)
+ ln -fs $(libelf_SONAME) $(DESTDIR)$(libdir)/$(libelf_BARE)
-uninstall: uninstall-am
- rm -f $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
- rm -f $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
- rm -f $(DESTDIR)$(libdir)/libelf.so
+uninstall: uninstall-am uninstall-lib
+ rm -f $(DESTDIR)$(libdir)/$(libelf_VERSIONED)
+ rm -f $(DESTDIR)$(libdir)/$(libelf_SONAME)
+ rm -f $(DESTDIR)$(libdir)/$(libelf_BARE)
-noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
+noinst_HEADERS = abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h \
chdr_xlate.h
+
+if SELFCONTAINED
+include_HEADERS += elf.h
+else
+noinst_HEADERS += elf.h
+endif
+
EXTRA_DIST = libelf.map
-CLEANFILES += $(am_libelf_pic_a_OBJECTS) libelf.so.$(VERSION)
+CLEANFILES += $(am_libelf_pic_a_OBJECTS) $(libelf_SONAME) $(libelf_BARE)