/build/unix/elfhack/Makefile.in

http://github.com/zpao/v8monkey · Autoconf · 133 lines · 67 code · 24 blank · 42 comment · 0 complexity · e4fd338c3ea001b7daa79bdb1a536834 MD5 · raw file

  1. #
  2. # ***** BEGIN LICENSE BLOCK *****
  3. # Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. #
  5. # The contents of this file are subject to the Mozilla Public License Version
  6. # 1.1 (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. # http://www.mozilla.org/MPL/
  9. #
  10. # Software distributed under the License is distributed on an "AS IS" basis,
  11. # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. # for the specific language governing rights and limitations under the
  13. # License.
  14. #
  15. # The Original Code is elfhack
  16. #
  17. # The Initial Developer of the Original Code is
  18. # Mozilla Foundation
  19. # Portions created by the Initial Developer are Copyright (C) 2010
  20. # the Initial Developer. All Rights Reserved.
  21. #
  22. # Contributor(s):
  23. # Mike Hommey <mh@glandium.org>
  24. #
  25. # Alternatively, the contents of this file may be used under the terms of
  26. # either of the GNU General Public License Version 2 or later (the "GPL"),
  27. # or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28. # in which case the provisions of the GPL or the LGPL are applicable instead
  29. # of those above. If you wish to allow use of your version of this file only
  30. # under the terms of either the GPL or the LGPL, and not to allow others to
  31. # use your version of this file under the terms of the MPL, indicate your
  32. # decision by deleting the provisions above and replace them with the notice
  33. # and other provisions required by the GPL or the LGPL. If you do not delete
  34. # the provisions above, a recipient may use your version of this file under
  35. # the terms of any one of the MPL, the GPL or the LGPL.
  36. #
  37. # ***** END LICENSE BLOCK *****
  38. DEPTH = ../../..
  39. topsrcdir = @top_srcdir@
  40. srcdir = @srcdir@
  41. VPATH = @srcdir@
  42. include $(DEPTH)/config/autoconf.mk
  43. INTERNAL_TOOLS = 1
  44. HOST_PROGRAM = elfhack
  45. NO_DIST_INSTALL = 1
  46. NO_PROFILE_GUIDED_OPTIMIZE = 1
  47. VPATH += $(topsrcdir)/build
  48. HOST_CPPSRCS = \
  49. elf.cpp \
  50. elfhack.cpp \
  51. $(STDCXX_COMPAT) \
  52. $(NULL)
  53. OS_CXXFLAGS := $(filter-out -fno-exceptions,$(OS_CXXFLAGS)) -fexceptions
  54. ifneq (,$(filter %86,$(TARGET_CPU)))
  55. CPU := x86
  56. else
  57. ifneq (,$(filter arm%,$(TARGET_CPU)))
  58. CPU := arm
  59. else
  60. CPU := $(TARGET_CPU)
  61. endif
  62. endif
  63. CSRCS := \
  64. inject/$(CPU).c \
  65. inject/$(CPU)-noinit.c \
  66. test.c \
  67. $(NULL)
  68. ifndef CROSS_COMPILE
  69. CSRCS += dummy.c
  70. endif
  71. WRAP_LDFLAGS=
  72. # need this to suppress errors due to /usr/include/linux/byteorder/swab.h
  73. # on mozilla buildbots
  74. OS_CXXFLAGS := $(filter-out -pedantic,$(OS_CXXFLAGS))
  75. include $(topsrcdir)/config/rules.mk
  76. test$(DLL_SUFFIX): test.$(OBJ_SUFFIX) elfhack $(CSRCS:.c=.$(OBJ_SUFFIX))
  77. $(MKSHLIB) $(LDFLAGS) $<
  78. @echo ===
  79. @echo === If you get failures below, please file a bug describing the error
  80. @echo === and your environment \(compiler and linker versions\), and use
  81. @echo === --disable-elf-hack until this is fixed.
  82. @echo ===
  83. @rm -f $@.bak
  84. $(CURDIR)/elfhack -b $@
  85. # Fail if the backup file doesn't exist
  86. [ -f "$@.bak" ]
  87. # Fail if the new library doesn't contain less relocations
  88. [ $$(objdump -R $@.bak | wc -l) -gt $$(objdump -R $@ | wc -l) ]
  89. .PRECIOUS: test$(DLL_SUFFIX)
  90. GARBAGE += test$(DLL_SUFFIX) test$(DLL_SUFFIX).bak
  91. libs:: test$(DLL_SUFFIX)
  92. ifndef CROSS_COMPILE
  93. dummy: dummy.$(OBJ_SUFFIX) test$(DLL_SUFFIX)
  94. $(CC) -o $@ $^ $(LDFLAGS)
  95. libs:: dummy
  96. # Will either crash or return exit code 1 if elfhack is broken
  97. LD_LIBRARY_PATH=$(CURDIR) $(CURDIR)/dummy
  98. GARBAGE += dummy
  99. endif
  100. inject:
  101. $(NSINSTALL) -D $@
  102. inject/%.c: inject.c | inject
  103. cp $< $@
  104. GARBAGE_DIRS += inject
  105. inject/%.$(OBJ_SUFFIX): DEFINES += -DBITS=$(if $(HAVE_64BIT_OS),64,32)
  106. inject/%.$(OBJ_SUFFIX): CFLAGS := -O2 -fno-stack-protector $(filter -m% -I%,$(CFLAGS))
  107. inject/$(CPU)-noinit.$(OBJ_SUFFIX): DEFINES += -DNOINIT
  108. test.$(OBJ_SUFFIX): CFLAGS := -O0
  109. host_elf.$(OBJ_SUFFIX) host_elfhack.$(OBJ_SUFFIX): elfxx.h