1# 2# This is a Makefile stub which handles the creation of Linux ELF shared 3# libraries. 4# 5# In order to use this stub, the following makefile variables must be defined. 6# 7# ELF_VERSION = 1.0 8# ELF_SO_VERSION = 1 9# ELF_IMAGE = libce 10# ELF_MYDIR = et 11# ELF_INSTALL_DIR = $(SHLIBDIR) 12# ELF_OTHER_LIBS = -lc 13 14all:: image 15 16real-subdirs:: Makefile 17 @echo " MKDIR elfshared" 18 @mkdir -p elfshared 19 20ELF_LIB = $(ELF_IMAGE).so.$(ELF_VERSION) 21ELF_SONAME = $(ELF_IMAGE).so.$(ELF_SO_VERSION) 22 23image: $(ELF_LIB) 24 25$(ELF_LIB): $(OBJS) 26 @echo " GEN_ELF_SOLIB $(ELF_LIB)" 27 @(cd elfshared; $(CC) --shared -o $(ELF_LIB) $(LDFLAGS) \ 28 -Wl,-soname,$(ELF_SONAME) $(OBJS) $(ELF_OTHER_LIBS)) 29 @$(MV) elfshared/$(ELF_LIB) . 30 @$(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).so ../$(ELF_SONAME) 31 @$(LN) $(ELF_LIB) ../$(ELF_LIB) 32 @$(LN) ../$(ELF_LIB) ../$(ELF_IMAGE).so 33 @$(LN) ../$(ELF_LIB) ../$(ELF_SONAME) 34 35installdirs-elf-lib:: 36 @echo " MKINSTALLDIRS $(ELF_INSTALL_DIR) $(libdir)" 37 @$(MKINSTALLDIRS) $(DESTDIR)$(ELF_INSTALL_DIR) \ 38 $(DESTDIR)$(libdir) 39 40installdirs:: installdirs-elf-lib 41 42install-shlibs install:: $(ELF_LIB) installdirs-elf-lib 43 @echo " INSTALL-ELF-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)" 44 @$(INSTALL_PROGRAM) $(ELF_LIB) $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB) 45 @echo " SYMLINK $(ELF_INSTALL_DIR)/$(ELF_SONAME)" 46 @$(LN_S) -f $(ELF_LIB) $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_SONAME) 47 @echo " SYMLINK $(libdir)/$(ELF_IMAGE).so" 48 @$(LN_S) -f $(ELF_INSTALL_DIR)/$(ELF_SONAME) \ 49 $(DESTDIR)$(libdir)/$(ELF_IMAGE).so 50 @echo " LDCONFIG" 51 @-$(LDCONFIG) 52 53install-strip: install 54 @echo " STRIP-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)" 55 @$(STRIP) --strip-unneeded --remove-section=.comment \ 56 --remove-section=.note $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB) 57 58install-shlibs-strip: install-shlibs 59 @echo " STRIP-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)" 60 @$(STRIP) --strip-unneeded --remove-section=.comment \ 61 --remove-section=.note $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB) 62 63uninstall-shlibs uninstall:: 64 $(RM) -f $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB) \ 65 $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_SONAME) \ 66 $(DESTDIR)$(libdir)/$(ELF_IMAGE).so 67 -$(LDCONFIG) 68 69clean:: 70 $(RM) -rf elfshared 71 $(RM) -f $(ELF_LIB) 72 $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).so ../$(ELF_SONAME) 73