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 pnacl |
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 |
| 24 CFLAGS+=-D___NOT_USE_LABEL_VALUES |
23 else | 25 else |
24 EXEEXT=.nexe | 26 EXEEXT=.nexe |
25 endif | 27 endif |
26 | 28 |
27 ifneq ($(TOOLCHAIN),pnacl) | 29 ifneq ($(TOOLCHAIN),pnacl) |
28 # We want the nmf to contain all the .nexe we have previously | 30 # 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 | 31 # built as well as the one currently being built, so we modify |
30 # the list of executables that we pass to create_nmf. | 32 # the list of executables that we pass to create_nmf. |
31 EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_x86_64$(EXEEXT)) | 33 EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_x86_64$(EXEEXT)) |
32 EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_x86_32$(EXEEXT)) | 34 EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_x86_32$(EXEEXT)) |
33 EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_arm$(EXEEXT)) | 35 EXECUTABLES += $(wildcard $(OUTDIR)/$(TARGET)_arm$(EXEEXT)) |
34 endif | 36 endif |
35 | 37 |
36 # Build rules generated by macros from common.mk: | 38 # Build rules generated by macros from common.mk: |
37 | 39 |
38 $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS)))) | 40 $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS)))) |
39 | 41 |
40 ifeq ($(CONFIG),Release) | 42 ifeq ($(CONFIG),Release) |
41 $(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS))) | 43 $(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS))) |
42 $(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped)) | 44 $(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped)) |
43 else | 45 else |
44 $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) | 46 $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) |
45 endif | 47 endif |
46 | 48 |
47 $(eval $(call NMF_RULE,$(TARGET),)) | 49 $(eval $(call NMF_RULE,$(TARGET),)) |
48 | 50 |
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 | 51 CHROMEAPPS = $(NACL_SRC)/third_party/hterm/src |
54 LIB_DOT = $(CHROMEAPPS)/libdot | 52 LIB_DOT = $(CHROMEAPPS)/libdot |
55 NASSH = $(CHROMEAPPS)/nassh | 53 NASSH = $(CHROMEAPPS)/nassh |
56 | 54 |
57 install: | 55 install: |
58 mkdir -p $(INSTALL_DIR) | 56 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 | 57 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) | 58 » cp $(OUTDIR)/gambc*$(EXEEXT) $(INSTALL_DIR) |
62 rm -f $(INSTALL_DIR)/*_unstripped_*$(EXEEXT) | 59 rm -f $(INSTALL_DIR)/*_unstripped_*$(EXEEXT) |
63 » cp $(OUTDIR)/python.nmf $(INSTALL_DIR) | 60 » cp $(OUTDIR)/gambc.nmf $(INSTALL_DIR) |
64 cp index.html $(INSTALL_DIR) | 61 cp index.html $(INSTALL_DIR) |
65 » cp python.js $(INSTALL_DIR) | 62 » cp gambc.js $(INSTALL_DIR) |
66 cp ../../build_tools/naclterm.js $(INSTALL_DIR) | 63 cp ../../build_tools/naclterm.js $(INSTALL_DIR) |
67 cp manifest.json ${INSTALL_DIR} | 64 cp manifest.json ${INSTALL_DIR} |
68 cp background.js ${INSTALL_DIR} | 65 cp background.js ${INSTALL_DIR} |
69 cp icon_16.png ${INSTALL_DIR} | 66 cp icon_16.png ${INSTALL_DIR} |
70 cp icon_48.png ${INSTALL_DIR} | 67 cp icon_48.png ${INSTALL_DIR} |
71 cp icon_128.png ${INSTALL_DIR} | 68 cp icon_128.png ${INSTALL_DIR} |
| 69 cp -r scm ${INSTALL_DIR} |
72 ifeq ($(TOOLCHAIN),pnacl) | 70 ifeq ($(TOOLCHAIN),pnacl) |
73 sed -i 's/x-nacl/x-pnacl/g' $(INSTALL_DIR)/naclterm.js | 71 sed -i 's/x-nacl/x-pnacl/g' $(INSTALL_DIR)/naclterm.js |
74 endif | 72 endif |
75 ifeq ($(TOOLCHAIN),glibc) | 73 ifeq ($(TOOLCHAIN),glibc) |
76 cp -r $(OUTDIR)/lib* $(INSTALL_DIR) | 74 cp -r $(OUTDIR)/lib* $(INSTALL_DIR) |
77 endif | 75 endif |
78 » cd $(INSTALL_DIR) && rm -f python.zip && zip -r python.zip . | 76 » cd $(INSTALL_DIR) && rm -f gambc.zip && zip -r gambc.zip . |
OLD | NEW |