PageRenderTime 38ms CodeModel.GetById 16ms app.highlight 15ms RepoModel.GetById 2ms app.codeStats 0ms

/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
 39DEPTH		= ../../..
 40topsrcdir	= @top_srcdir@
 41srcdir		= @srcdir@
 42VPATH		= @srcdir@
 43
 44include $(DEPTH)/config/autoconf.mk
 45
 46INTERNAL_TOOLS = 1
 47
 48HOST_PROGRAM = elfhack
 49NO_DIST_INSTALL = 1
 50NO_PROFILE_GUIDED_OPTIMIZE = 1
 51
 52VPATH += $(topsrcdir)/build
 53
 54HOST_CPPSRCS = \
 55  elf.cpp \
 56  elfhack.cpp \
 57  $(STDCXX_COMPAT) \
 58  $(NULL)
 59
 60OS_CXXFLAGS := $(filter-out -fno-exceptions,$(OS_CXXFLAGS)) -fexceptions
 61
 62ifneq (,$(filter %86,$(TARGET_CPU)))
 63CPU := x86
 64else
 65ifneq (,$(filter arm%,$(TARGET_CPU)))
 66CPU := arm
 67else
 68CPU := $(TARGET_CPU)
 69endif
 70endif
 71
 72CSRCS := \
 73  inject/$(CPU).c \
 74  inject/$(CPU)-noinit.c \
 75  test.c \
 76  $(NULL)
 77
 78ifndef CROSS_COMPILE
 79CSRCS += dummy.c
 80endif
 81
 82WRAP_LDFLAGS=
 83
 84# need this to suppress errors due to /usr/include/linux/byteorder/swab.h
 85# on mozilla buildbots
 86OS_CXXFLAGS := $(filter-out -pedantic,$(OS_CXXFLAGS))
 87
 88include $(topsrcdir)/config/rules.mk
 89
 90test$(DLL_SUFFIX): test.$(OBJ_SUFFIX) elfhack $(CSRCS:.c=.$(OBJ_SUFFIX))
 91	$(MKSHLIB) $(LDFLAGS) $<
 92	@echo ===
 93	@echo === If you get failures below, please file a bug describing the error
 94	@echo === and your environment \(compiler and linker versions\), and use
 95	@echo === --disable-elf-hack until this is fixed.
 96	@echo ===
 97	@rm -f $@.bak
 98	$(CURDIR)/elfhack -b $@
 99	# Fail if the backup file doesn't exist
100	[ -f "$@.bak" ]
101	# Fail if the new library doesn't contain less relocations
102	[ $$(objdump -R $@.bak | wc -l) -gt $$(objdump -R $@ | wc -l) ]
103
104.PRECIOUS: test$(DLL_SUFFIX)
105
106GARBAGE += test$(DLL_SUFFIX) test$(DLL_SUFFIX).bak
107
108libs:: test$(DLL_SUFFIX)
109
110ifndef CROSS_COMPILE
111dummy: dummy.$(OBJ_SUFFIX) test$(DLL_SUFFIX)
112	$(CC) -o $@ $^ $(LDFLAGS)
113
114libs:: dummy
115	# Will either crash or return exit code 1 if elfhack is broken
116	LD_LIBRARY_PATH=$(CURDIR) $(CURDIR)/dummy
117
118GARBAGE += dummy
119endif
120
121inject:
122	$(NSINSTALL) -D $@
123
124inject/%.c: inject.c | inject
125	cp $< $@
126
127GARBAGE_DIRS += inject
128
129inject/%.$(OBJ_SUFFIX): DEFINES += -DBITS=$(if $(HAVE_64BIT_OS),64,32)
130inject/%.$(OBJ_SUFFIX): CFLAGS := -O2 -fno-stack-protector $(filter -m% -I%,$(CFLAGS))
131inject/$(CPU)-noinit.$(OBJ_SUFFIX): DEFINES += -DNOINIT
132test.$(OBJ_SUFFIX): CFLAGS := -O0
133host_elf.$(OBJ_SUFFIX) host_elfhack.$(OBJ_SUFFIX): elfxx.h