| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 VALID_TOOLCHAINS := glibc newlib pnacl | 5 VALID_TOOLCHAINS := glibc newlib |
| 6 NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../..) | 6 NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../..) |
| 7 include $(NACL_SDK_ROOT)/tools/common.mk | 7 include $(NACL_SDK_ROOT)/tools/common.mk |
| 8 | 8 |
| 9 TARGET = python | 9 TARGET = gambc |
| 10 LIBS = python2.7 readline ncurses ppapi_simple tar nacl_io ppapi_cpp ppapi | 10 LIBS = gambc ppapi_simple nacl_io ppapi_cpp ppapi |
| 11 ifeq ($(TOOLCHAIN),glibc) | 11 ifeq ($(TOOLCHAIN),glibc) |
| 12 LIBS += util dl | 12 LIBS += util dl |
| 13 NACL_LDFLAGS += -Wl,-export-dynamic | 13 NACL_LDFLAGS += -Wl,-export-dynamic |
| 14 else | 14 else |
| 15 LIBS += glibc-compat | 15 LIBS += glibc-compat |
| 16 endif | 16 endif |
| 17 SOURCES = python.c | 17 CFLAGS+=-D___LIBRARY |
| 18 INC_PATHS = $(NACLPORTS_INCLUDE)/python2.7 | 18 |
| 19 INSTALL_DIR = $(NACL_PACKAGES_PUBLISH)/python/$(TOOLCHAIN) | 19 SOURCES = main.c repl.c repl_.c gambc.c |
| 20 INSTALL_DIR = $(NACL_PACKAGES_PUBLISH)/gambc/$(TOOLCHAIN) |
| 20 | 21 |
| 21 ifeq ($(TOOLCHAIN),pnacl) | 22 ifeq ($(TOOLCHAIN),pnacl) |
| 22 EXEEXT=.pexe | 23 EXEEXT=.pexe |
| 23 else | 24 else |
| 24 EXEEXT=.nexe | 25 EXEEXT=.nexe |
| 25 endif | 26 endif |
| 26 | 27 |
| 27 ifneq ($(TOOLCHAIN),pnacl) | 28 ifneq ($(TOOLCHAIN),pnacl) |
| 28 # We want the nmf to contain all the .nexe we have previously | 29 # We want the nmf to contain all the .nexe we have previously |
| 29 # built as well as the one currently being built, so we modify | 30 # built as well as the one currently being built, so we modify |
| 30 # the list of executables that we pass to create_nmf. | 31 # the list of executables that we pass to create_nmf. |
| 31 EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_x86_64$(EXEEXT)) | 32 EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_x86_64$(EXEEXT)) |
| 32 EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_x86_32$(EXEEXT)) | 33 EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_x86_32$(EXEEXT)) |
| 33 EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_arm$(EXEEXT)) | 34 EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_arm$(EXEEXT)) |
| 34 endif | 35 endif |
| 35 | 36 |
| 36 # Build rules generated by macros from common.mk: | 37 # Build rules generated by macros from common.mk: |
| 37 | 38 |
| 38 $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS)))) | 39 $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS)))) |
| 39 | 40 |
| 40 ifeq ($(CONFIG),Release) | 41 ifeq ($(CONFIG),Release) |
| 41 $(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS))) | 42 $(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS))) |
| 42 $(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped)) | 43 $(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped)) |
| 43 else | 44 else |
| 44 $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) | 45 $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) |
| 45 endif | 46 endif |
| 46 | 47 |
| 47 $(eval $(call NMF_RULE,$(TARGET),)) | 48 $(eval $(call NMF_RULE,$(TARGET),)) |
| 48 | 49 |
| 49 ifeq ($(TOOLCHAIN),glibc) | |
| 50 EXTRA_ASSETS = lib/libz.so.1 lib/libreadline.so lib/libncurses.so.5 | |
| 51 endif | |
| 52 | |
| 53 CHROMEAPPS = $(NACL_SRC)/third_party/hterm/src | 50 CHROMEAPPS = $(NACL_SRC)/third_party/hterm/src |
| 54 LIB_DOT = $(CHROMEAPPS)/libdot | 51 LIB_DOT = $(CHROMEAPPS)/libdot |
| 55 NASSH = $(CHROMEAPPS)/nassh | 52 NASSH = $(CHROMEAPPS)/nassh |
| 56 | 53 |
| 57 install: | 54 install: |
| 58 mkdir -p $(INSTALL_DIR) | 55 mkdir -p $(INSTALL_DIR) |
| 59 tar -h -c -C ${NACLPORTS_PREFIX} -f $(INSTALL_DIR)/pydata_$(NACL_ARCH).t
ar lib/python2.7 ${EXTRA_ASSETS} | |
| 60 LIBDOT_SEARCH_PATH=$(CHROMEAPPS) $(LIB_DOT)/bin/concat.sh -i $(NASSH)/co
ncat/nassh_deps.concat -o $(INSTALL_DIR)/hterm.concat.js | 56 LIBDOT_SEARCH_PATH=$(CHROMEAPPS) $(LIB_DOT)/bin/concat.sh -i $(NASSH)/co
ncat/nassh_deps.concat -o $(INSTALL_DIR)/hterm.concat.js |
| 61 » cp $(OUTDIR)/python*$(EXEEXT) $(INSTALL_DIR) | 57 » cp $(OUTDIR)/gambc*$(EXEEXT) $(INSTALL_DIR) |
| 62 rm -f $(INSTALL_DIR)/*_unstripped_*$(EXEEXT) | 58 rm -f $(INSTALL_DIR)/*_unstripped_*$(EXEEXT) |
| 63 » cp $(OUTDIR)/python.nmf $(INSTALL_DIR) | 59 » cp $(OUTDIR)/gambc.nmf $(INSTALL_DIR) |
| 64 cp index.html $(INSTALL_DIR) | 60 cp index.html $(INSTALL_DIR) |
| 65 » cp python.js $(INSTALL_DIR) | 61 » cp gambc.js $(INSTALL_DIR) |
| 66 cp ../../build_tools/naclterm.js $(INSTALL_DIR) | 62 cp ../../build_tools/naclterm.js $(INSTALL_DIR) |
| 67 cp manifest.json ${INSTALL_DIR} | 63 cp manifest.json ${INSTALL_DIR} |
| 68 cp background.js ${INSTALL_DIR} | 64 cp background.js ${INSTALL_DIR} |
| 69 cp icon_16.png ${INSTALL_DIR} | 65 cp icon_16.png ${INSTALL_DIR} |
| 70 cp icon_48.png ${INSTALL_DIR} | 66 cp icon_48.png ${INSTALL_DIR} |
| 71 cp icon_128.png ${INSTALL_DIR} | 67 cp icon_128.png ${INSTALL_DIR} |
| 72 ifeq ($(TOOLCHAIN),pnacl) | 68 ifeq ($(TOOLCHAIN),pnacl) |
| 73 sed -i 's/x-nacl/x-pnacl/g' $(INSTALL_DIR)/naclterm.js | 69 sed -i 's/x-nacl/x-pnacl/g' $(INSTALL_DIR)/naclterm.js |
| 74 endif | 70 endif |
| 75 ifeq ($(TOOLCHAIN),glibc) | 71 ifeq ($(TOOLCHAIN),glibc) |
| 76 cp -r $(OUTDIR)/lib* $(INSTALL_DIR) | 72 cp -r $(OUTDIR)/lib* $(INSTALL_DIR) |
| 77 endif | 73 endif |
| 78 » cd $(INSTALL_DIR) && rm -f python.zip && zip -r python.zip . | 74 » cd $(INSTALL_DIR) && rm -f gambc.zip && zip -r gambc.zip . |
| OLD | NEW |