]>
Commit | Line | Data |
---|---|---|
50e1e10f TT |
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 | |
74becf3c | 8 | # ELF_SO_VERSION = 1 |
50e1e10f TT |
9 | # ELF_IMAGE = libce |
10 | # ELF_MYDIR = et | |
11 | # ELF_INSTALL_DIR = $(SHLIBDIR) | |
21c84b71 | 12 | # ELF_OTHER_LIBS = -lc |
50e1e10f | 13 | |
02ef1962 | 14 | all:: image |
50e1e10f | 15 | |
3f546fcc | 16 | real-subdirs:: Makefile |
c13351f6 TT |
17 | $(E) " MKDIR elfshared" |
18 | $(Q) mkdir -p elfshared | |
50e1e10f TT |
19 | |
20 | ELF_LIB = $(ELF_IMAGE).so.$(ELF_VERSION) | |
297f47a1 | 21 | ELF_SONAME = $(ELF_IMAGE).so.$(ELF_SO_VERSION) |
50e1e10f TT |
22 | |
23 | image: $(ELF_LIB) | |
24 | ||
25 | $(ELF_LIB): $(OBJS) | |
c13351f6 | 26 | $(E) " GEN_ELF_SOLIB $(ELF_LIB)" |
0eb9fb99 TT |
27 | $(Q) (cd elfshared; $(CC) -o $(ELF_LIB) \ |
28 | -L$(top_builddir)/../lib $(LDFLAGS_SHLIB) -fPIC -shared \ | |
d5aa6a82 | 29 | -Wl,-soname,$(ELF_SONAME) $(OBJS) $(ELF_OTHER_LIBS)) |
c13351f6 TT |
30 | $(Q) $(MV) elfshared/$(ELF_LIB) . |
31 | $(Q) $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).so ../$(ELF_SONAME) | |
5aa6c3f6 TT |
32 | $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) \ |
33 | `echo $(my_dir) | sed -e 's;lib/;;'`/$(ELF_LIB) $(ELF_LIB)) | |
34 | $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) $(ELF_LIB) $(ELF_IMAGE).so) | |
35 | $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) $(ELF_LIB) $(ELF_SONAME)) | |
50e1e10f | 36 | |
1e3472c5 | 37 | installdirs-elf-lib:: |
c13351f6 TT |
38 | $(E) " MKINSTALLDIRS $(ELF_INSTALL_DIR) $(libdir)" |
39 | $(Q) $(MKINSTALLDIRS) $(DESTDIR)$(ELF_INSTALL_DIR) \ | |
39b50349 | 40 | $(DESTDIR)$(libdir) |
50e1e10f | 41 | |
1e3472c5 TT |
42 | installdirs:: installdirs-elf-lib |
43 | ||
183c73b0 | 44 | install-shlibs install:: $(ELF_LIB) installdirs-elf-lib $(DEP_INSTALL_SYMLINK) |
c13351f6 TT |
45 | $(E) " INSTALL-ELF-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)" |
46 | $(Q) $(INSTALL_PROGRAM) $(ELF_LIB) $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB) | |
47 | $(E) " SYMLINK $(ELF_INSTALL_DIR)/$(ELF_SONAME)" | |
183c73b0 TT |
48 | $(Q) $(INSTALL_SYMLINK) $(ELF_INSTALL_DIR)/$(ELF_LIB) \ |
49 | $(ELF_INSTALL_DIR)/$(ELF_SONAME) $(DESTDIR) | |
c13351f6 | 50 | $(E) " SYMLINK $(libdir)/$(ELF_IMAGE).so" |
183c73b0 TT |
51 | $(Q) $(INSTALL_SYMLINK) $(ELF_INSTALL_DIR)/$(ELF_SONAME) \ |
52 | $(libdir)/$(ELF_IMAGE).so $(DESTDIR) | |
c13351f6 TT |
53 | $(E) " LDCONFIG" |
54 | $(Q) -$(LDCONFIG) | |
522798d3 TT |
55 | |
56 | install-strip: install | |
c13351f6 TT |
57 | $(E) " STRIP-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)" |
58 | $(Q) $(STRIP) --strip-unneeded --remove-section=.comment \ | |
522798d3 TT |
59 | --remove-section=.note $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB) |
60 | ||
61 | install-shlibs-strip: install-shlibs | |
c13351f6 TT |
62 | $(E) " STRIP-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)" |
63 | $(Q) $(STRIP) --strip-unneeded --remove-section=.comment \ | |
522798d3 | 64 | --remove-section=.note $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB) |
39b50349 TT |
65 | |
66 | uninstall-shlibs uninstall:: | |
67 | $(RM) -f $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB) \ | |
68 | $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_SONAME) \ | |
69 | $(DESTDIR)$(libdir)/$(ELF_IMAGE).so | |
20562a48 | 70 | -$(LDCONFIG) |
50e1e10f TT |
71 | |
72 | clean:: | |
73 | $(RM) -rf elfshared | |
74 | $(RM) -f $(ELF_LIB) | |
62c06f79 | 75 | $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).so ../$(ELF_SONAME) |