1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/nacl/GNUmakefile.in
yugui 69ac654c90 Merges a patch form naclports.
* configure.in (RUBY_NACL and others): Supports PNaCl.
* dln.c: replace the old hacky dynamic loading over HTTP with nacl_io.
* file.c: tenatively use access(2) instead of eaccess.
  (rb_file_load_ok): weaken with attribute but not by postprocess.
* io.c (socket.h): now NaCl has socket.h
  (flock): disable here instead of nacl/ioctl.h
* nacl/GNUmakefile.in (CC, LD, NM, AR, AS, RANLIB, OBJDUMP, OBJCOPY):
  respect path to them if they are absolute.
  This helps naclports to build ruby in their source tree.
  (PROGRAM_NMF, .SUFFIXES): support .pnexe for PNaCl.
  (ruby.o, file.o): move the hack to attributes in ruby.c and file.c
* nacl/ioctl.h: removed. move the hack to io.c.
* nacl/nacl-config.rb: support arm, pnacl and others.
* nacl/pepper_main.c: support build in a naclports tree.
* ruby.c (rb_load_file): weaken with attribute but not by postprocess.

The patch is by sbc@google.com and the Native Client Authors.
It is available at:
* 873ca4910a/ports/ruby/nacl.patch

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-11 02:11:53 +00:00

96 lines
3 KiB
Text

# Copyright 2012 Google Inc. All Rights Reserved.
# Author: yugui@google.com (Yugui Sonoda)
include Makefile
-include uncommon.mk
NACL_SDK_ROOT=@NACL_SDK_ROOT@
NACL_TOOLCHAIN=@NACL_TOOLCHAIN@
NACL_TOOLCHAIN_DIR=$(NACL_SDK_ROOT)/toolchain/$(NACL_TOOLCHAIN)
# Don't override CC/LD/etc if they are already set to absolute
# paths (this is the case when building in the naclports tree).
ifeq ($(dir $(CC)),./)
CC:=$(NACL_TOOLCHAIN_DIR)/bin/$(CC)
endif
ifeq ($(dir $(LD)),./)
LD:=$(NACL_TOOLCHAIN_DIR)/bin/$(LD)
endif
ifeq ($(dir $(NM)),./)
NM:=$(NACL_TOOLCHAIN_DIR)/bin/$(NM)
endif
ifeq ($(dir $(AR)),./)
AR:=$(NACL_TOOLCHAIN_DIR)/bin/$(AR)
endif
ifeq ($(dir $(AS)),./)
AS:=$(NACL_TOOLCHAIN_DIR)/bin/$(AS)
endif
ifeq ($(dir $(RANLIB)),./)
RANLIB:=$(NACL_TOOLCHAIN_DIR)/bin/$(RANLIB)
endif
ifeq ($(dir $(OBJDUMP)),./)
OBJDUMP:=$(NACL_TOOLCHAIN_DIR)/bin/$(OBJDUMP)
endif
ifeq ($(dir $(OBJCOPY)),./)
OBJCOPY:=$(NACL_TOOLCHAIN_DIR)/bin/$(OBJCOPY)
endif
PYTHON=@PYTHON@
PPROGRAM=pepper-$(PROGRAM)
PEPPER_LIBS=-lppapi
PROGRAM_NMF=$(PROGRAM:$(EXEEXT)=.nmf)
PPROGRAM_NMF=$(PPROGRAM:$(EXEEXT)=.nmf)
GNUmakefile: $(srcdir)/nacl/GNUmakefile.in
$(PPROGRAM): $(PROGRAM) pepper_main.$(OBJEXT)
$(Q)$(MAKE) $(MFLAGS) PROGRAM=$(PPROGRAM) MAINOBJ="pepper_main.$(OBJEXT)" LIBS="$(LIBS) $(PEPPER_LIBS)" program
$(PROGRAM_NMF) $(PPROGRAM_NMF): $(@:.nmf=$(EXEEXT)) nacl/create_nmf.rb
.PHONY: pprogram package show_naclflags
.SUFFIXES: $(EXEEXT) .nmf
$(EXEEXT).nmf:
$(ECHO) generating manifest $@
$(Q)$(MINIRUBY) $(srcdir)/nacl/create_nmf.rb --verbose=$(V) $(@:.nmf=$(EXEEXT)) $@
pepper_main.$(OBJEXT): $(srcdir)/nacl/pepper_main.c
@$(ECHO) compiling nacl/pepper_main.c
$(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c $(srcdir)/nacl/pepper_main.c
.rbconfig.time:
@$(MAKE) .rbconfig.raw.time RBCONFIG=.rbconfig.raw.time
@sed \
-e 's!CONFIG\["CC"\] = .*!CONFIG\["CC"\] = "$(CC)"!' \
-e 's!CONFIG\["LD"\] = .*!CONFIG\["LD"\] = "$(LD)"!' \
-e 's!CONFIG\["NM"\] = .*!CONFIG\["NM"\] = "$(NM)"!' \
-e 's!CONFIG\["AR"\] = .*!CONFIG\["AR"\] = "$(AR)"!' \
-e 's!CONFIG\["AS"\] = .*!CONFIG\["AS"\] = "$(AS)"!' \
-e 's!CONFIG\["RANLIB"\] = .*!CONFIG\["RANLIB"\] = "$(RANLIB)"!' \
-e 's!CONFIG\["OBJDUMP"\] = .*!CONFIG\["OBJDUMP"\] = "$(OBJDUMP)"!' \
-e 's!CONFIG\["OBJCOPY"\] = .*!CONFIG\["OBJCOPY"\] = "$(OBJCOPY)"!' \
-i.bak rbconfig.rb
@touch .rbconfig.time
all: pprogram
main: $(PROGRAM_NMF)
pprogram: showflags $(PPROGRAM) $(PPROGRAM_NMF)
program: $(PROGRAM_NMF)
prog: pprogram
package: pprogram install-lib install-ext-comm install-ext-arch
$(INSTALL_DATA) $(srcdir)/nacl/example.html $(prefix)
$(ECHO) generating manifest $@
$(Q)$(MINIRUBY) $(srcdir)/nacl/package.rb $(prefix)
showflags: show_naclflags
show_naclflags:
@echo " NACL_SDK_ROOT = $(NACL_SDK_ROOT)"
@echo " NM = $(NM)"
@echo " AR = $(AR)"
@echo " AS = $(AS)"
@echo " RANLIB = $(RANLIB)"
@echo " OBJDUMP = $(OBJDUMP)"
@echo " OBJCOPY = $(OBJCOPY)"
clean-local::
-$(RM) $(PPROGRAM) pepper_main.$(OBJEXT) $(PROGRAM_NMF) $(PPRGORAM_NMF)