Makefile.in 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. # lib/Makefile for libelf.
  2. # Copyright (C) 1995 - 2009 Michael Riepe
  3. #
  4. # This library is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU Library General Public
  6. # License as published by the Free Software Foundation; either
  7. # version 2 of the License, or (at your option) any later version.
  8. #
  9. # This library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. # Library General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Library General Public
  15. # License along with this library; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  17. # @(#) $Id: Makefile.in,v 1.40 2009/11/01 13:04:19 michael Exp $
  18. instroot =
  19. prefix = @prefix@
  20. exec_prefix = @exec_prefix@
  21. libdir = @libdir@
  22. includedir = @includedir@
  23. installdirs = $(libdir) $(includedir) $(includedir)/libelf
  24. CC = @CC@
  25. LD = @LD@
  26. AR = ar
  27. MV = mv -f
  28. RM = rm -f
  29. LN_S = @LN_S@
  30. RANLIB = @RANLIB@
  31. INSTALL = @INSTALL@
  32. INSTALL_DATA = @INSTALL_DATA@
  33. INSTALL_PROGRAM = @INSTALL_PROGRAM@
  34. CFLAGS = @CFLAGS@
  35. CPPFLAGS = @CPPFLAGS@
  36. DEFS = -DHAVE_CONFIG_H
  37. LDFLAGS = @LDFLAGS@
  38. LIBS = @LIBS@
  39. DEPSHLIBS = @DEPSHLIBS@
  40. DO_SHLIB = @DO_SHLIB@
  41. PICFLAGS = @PICFLAGS@
  42. SHLIB_SFX = @SHLIB_SFX@
  43. SHLINK_SFX = @SHLINK_SFX@
  44. SONAME_SFX = @SONAME_SFX@
  45. LINK_SHLIB = @LINK_SHLIB@
  46. INSTALL_SHLIB = @INSTALL_SHLIB@
  47. SHLIB = libelf$(SHLIB_SFX)
  48. SHLINK = libelf$(SHLINK_SFX)
  49. SONAME = libelf$(SONAME_SFX)
  50. # install includes in includedir?
  51. DO_COMPAT = @DO_COMPAT@
  52. COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
  53. # no user serviceable parts below
  54. PACKAGE = @PACKAGE@
  55. VERSION = @VERSION@
  56. MAJOR = @MAJOR@
  57. SHELL = /bin/sh
  58. @SET_MAKE@
  59. srcdir = @srcdir@
  60. top_srcdir = @top_srcdir@
  61. VPATH = @srcdir@
  62. topdir = ..
  63. subdir = lib
  64. .SUFFIXES:
  65. .SUFFIXES: .c .o
  66. .c.o:
  67. @$(RM) $@ $(@:.o=.os)
  68. if test -n "$(PICFLAGS)"; then \
  69. $(COMPILE) $(PICFLAGS) $< && $(MV) $@ $(@:.o=.os); \
  70. else true; fi
  71. $(COMPILE) $<
  72. INCLUDES = -I$(topdir) -I. -I$(srcdir)
  73. # generic sources
  74. SRCS1 = begin.c cntl.c end.c errmsg.c errno.c fill.c flag.c getarhdr.c \
  75. getarsym.c getbase.c getdata.c getident.c getscn.c hash.c kind.c \
  76. ndxscn.c newdata.c newscn.c next.c nextscn.c rand.c rawdata.c \
  77. rawfile.c strptr.c update.c version.c checksum.c getaroff.c
  78. OBJS1 = begin.o cntl.o end.o errmsg.o errno.o fill.o flag.o getarhdr.o \
  79. getarsym.o getbase.o getdata.o getident.o getscn.o hash.o kind.o \
  80. ndxscn.o newdata.o newscn.o next.o nextscn.o rand.o rawdata.o \
  81. rawfile.o strptr.o update.o version.o checksum.o getaroff.o
  82. # 32-bit sources
  83. SRCS2 = 32.fsize.c 32.getehdr.c 32.getphdr.c 32.getshdr.c 32.newehdr.c \
  84. 32.newphdr.c 32.xlatetof.c
  85. OBJS2 = 32.fsize.o 32.getehdr.o 32.getphdr.o 32.getshdr.o 32.newehdr.o \
  86. 32.newphdr.o 32.xlatetof.o
  87. # support
  88. SRCS3 = cook.c data.c input.c assert.c
  89. OBJS3 = cook.o data.o input.o assert.o
  90. # nlist
  91. SRCS4 = nlist.c
  92. OBJS4 = nlist.o
  93. # opt
  94. SRCS5 = opt.delscn.c x.remscn.c x.movscn.c x.elfext.c
  95. OBJS5 = opt.delscn.o x.remscn.o x.movscn.o x.elfext.o
  96. # 64-bit sources
  97. SRCS64 = 64.xlatetof.c gelfehdr.c gelfphdr.c gelfshdr.c gelftrans.c swap64.c
  98. OBJS64 = 64.xlatetof.o gelfehdr.o gelfphdr.o gelfshdr.o gelftrans.o swap64.o
  99. # Versioning sources
  100. SRCS_V = verdef_32_tof.c verdef_32_tom.c verdef_64_tof.c verdef_64_tom.c
  101. OBJS_V = verdef_32_tof.o verdef_32_tom.o verdef_64_tof.o verdef_64_tom.o
  102. HDRS_V = verdef.h verneed.h
  103. SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) $(SRCS64) $(SRCS_V)
  104. OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS64) $(OBJS_V)
  105. # missing functions
  106. LIBSRCS = memset.c
  107. LIBOBJS = @LIBOBJS@
  108. # public header files
  109. HDRS = libelf.h nlist.h gelf.h
  110. # public header files (created by configure)
  111. AUXHDRS = sys_elf.h
  112. # private header files
  113. PRIVHDRS = byteswap.h errors.h ext_types.h private.h elf_repl.h \
  114. $(HDRS_V)
  115. DISTFILES = $(SRCS) $(LIBSRCS) $(HDRS) $(PRIVHDRS) Makefile.in sys_elf.h.in \
  116. Makefile.w32 build.bat config.h.w32 libelf.def sys_elf.h.w32
  117. all: libelf.a shared-$(DO_SHLIB)
  118. check:
  119. shared-yes: $(SHLIB)
  120. shared-no:
  121. libelf.a: $(OBJS) $(LIBOBJS)
  122. @$(RM) $@
  123. $(AR) rcv $@ $(OBJS) $(LIBOBJS)
  124. $(RANLIB) $@
  125. $(SHLIB): libelf.a
  126. @$(RM) $(SHLIB)
  127. $(LINK_SHLIB) -o $(SHLIB) $(OBJS:.o=.os) $(LIBOBJS:.o=.os) $(DEPSHLIBS)
  128. if test "$(SONAME)" = "$(SHLIB)"; then true; else \
  129. $(RM) $(SONAME) && $(LN_S) $(SHLIB) $(SONAME); \
  130. fi
  131. if test "$(SHLINK)" = "$(SHLIB)"; then true; else \
  132. $(RM) $(SHLINK) && $(LN_S) $(SHLIB) $(SHLINK); \
  133. fi
  134. install: install-data \
  135. install-shared-$(DO_SHLIB) install-compat-$(DO_COMPAT)
  136. installdirs: $(top_srcdir)/mkinstalldirs
  137. dirs="$(installdirs)"; for dir in $$dirs; do \
  138. $(SHELL) $(top_srcdir)/mkinstalldirs $(instroot)$$dir; \
  139. done
  140. install-data: all installdirs
  141. $(INSTALL_DATA) libelf.a $(instroot)$(libdir)
  142. -cd $(instroot)$(libdir) && $(RANLIB) libelf.a
  143. files="$(HDRS) $(AUXHDRS) elf_repl.h"; for file in $$files; do \
  144. if test -r $$file; then \
  145. $(INSTALL_DATA) $$file $(instroot)$(includedir)/libelf; \
  146. else \
  147. $(INSTALL_DATA) $(srcdir)/$$file $(instroot)$(includedir)/libelf; \
  148. fi; \
  149. done
  150. uninstall: uninstall-data \
  151. uninstall-shared-$(DO_SHLIB) uninstall-compat-$(DO_COMPAT)
  152. uninstall-data:
  153. $(RM) $(instroot)$(libdir)/libelf.a
  154. $(RM) -r $(instroot)$(includedir)/libelf
  155. install-shared-yes: install-shared
  156. install-shared-no:
  157. install-shared: installdirs $(SHLIB)
  158. $(INSTALL_SHLIB) $(SHLIB) $(instroot)$(libdir)
  159. if test "$(SONAME)" = "$(SHLIB)"; then true; else \
  160. cd $(instroot)$(libdir) && $(RM) $(SONAME) && $(LN_S) $(SHLIB) $(SONAME); \
  161. fi
  162. if test "$(SHLINK)" = "$(SHLIB)"; then true; else \
  163. cd $(instroot)$(libdir) && $(RM) $(SHLINK) && $(LN_S) $(SHLIB) $(SHLINK); \
  164. fi
  165. uninstall-shared-yes: uninstall-shared
  166. uninstall-shared-no:
  167. uninstall-shared:
  168. cd $(instroot)$(libdir) && $(RM) $(SHLIB) $(SONAME) $(SHLINK)
  169. install-compat-yes: install-compat
  170. install-compat-no:
  171. install-compat: installdirs
  172. files="$(HDRS)"; for file in $$files; do \
  173. if test -f $(instroot)$(includedir)/$$file; then true; else \
  174. echo "#include <libelf/$$file>" > $(instroot)$(includedir)/$$file; \
  175. fi; \
  176. done
  177. uninstall-compat-yes: uninstall-compat
  178. uninstall-compat-no:
  179. uninstall-compat:
  180. files="$(HDRS)"; for file in $$files; do \
  181. if grep "^#include <libelf/$$file>\$$" $(instroot)$(includedir)/$$file >/dev/null 2>&1; then \
  182. $(RM) $(instroot)$(includedir)/$$file; \
  183. else true; fi; \
  184. done
  185. mostlyclean:
  186. $(RM) *.o *.a *.os $(SHLIB) $(SONAME) $(SHLINK)
  187. $(RM) *~ core a.out errlist
  188. clean: mostlyclean
  189. distclean: clean
  190. $(RM) stamp-h $(AUXHDRS)
  191. $(RM) Makefile
  192. maintainer-clean: distclean
  193. # maintainer only
  194. MAINT = @MAINT@
  195. distdir = $(PACKAGE)-$(VERSION)
  196. distsubdir = $(topdir)/$(distdir)/$(subdir)
  197. $(MAINT)dist: $(DISTFILES)
  198. if test -d $(distsubdir); then true; else mkdir $(distsubdir); fi
  199. files="$(DISTFILES)"; for file in $$files; do \
  200. ln $(srcdir)/$$file $(distsubdir) || \
  201. cp -p $(srcdir)/$$file $(distsubdir) || exit 1; \
  202. done
  203. # For the justification of the following Makefile rules, see node
  204. # `Automatic Remaking' in GNU Autoconf documentation.
  205. $(MAINT)Makefile: Makefile.in $(topdir)/config.status
  206. cd $(topdir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
  207. $(MAINT)sys_elf.h: stamp-h
  208. $(MAINT)stamp-h: sys_elf.h.in $(topdir)/config.status
  209. cd $(topdir) && CONFIG_FILES= CONFIG_HEADERS=$(subdir)/sys_elf.h ./config.status
  210. $(RM) stamp-h && echo timestamp > stamp-h
  211. # Tell versions [3.59,3.63) of GNU make not to export all variables.
  212. # Otherwise a system limit (for SysV at least) may be exceeded.
  213. .NOEXPORT:
  214. # dependencies
  215. $(OBJS): private.h $(topdir)/config.h libelf.h gelf.h errors.h $(AUXHDRS)
  216. 32.fsize.o: ext_types.h
  217. 32.xlatetof.o: byteswap.h ext_types.h
  218. 64.xlatetof.o: byteswap.h ext_types.h
  219. getarsym.o: byteswap.h
  220. memset.o: $(topdir)/config.h
  221. nlist.o: nlist.h
  222. swap64.o: byteswap.h
  223. $(OBJS_V): byteswap.h ext_types.h $(HDRS_V)