nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests: update some tests to pass on Mac
[nit.git]
/
src
/
pnacl_platform.nit
diff --git
a/src/pnacl_platform.nit
b/src/pnacl_platform.nit
index
766988d
..
62c2f60
100644
(file)
--- a/
src/pnacl_platform.nit
+++ b/
src/pnacl_platform.nit
@@
-41,15
+41,6
@@
end
class PnaclToolchain
super MakefileToolchain
class PnaclToolchain
super MakefileToolchain
- var pnacl_project_root: String
-
- redef fun compile_dir
- do
- var normal_compile_dir = super
- pnacl_project_root = "{normal_compile_dir}/pnacl/"
- return "{normal_compile_dir}/pnacl/src/"
- end
-
redef fun write_files(compiler, compile_dir, cfiles)
do
var app_name = compiler.mainmodule.name
redef fun write_files(compiler, compile_dir, cfiles)
do
var app_name = compiler.mainmodule.name
@@
-70,9
+61,10
@@
class PnaclToolchain
var outname = toolcontext.opt_output.value
if outname == null then outname = "{compiler.mainmodule.name}"
var outname = toolcontext.opt_output.value
if outname == null then outname = "{compiler.mainmodule.name}"
+ var ofiles = new Array[String]
+ for cfile in cfiles do ofiles.add(cfile.substring(0, cfile.length-2) + ".o")
+
## Generate makefile
## Generate makefile
- dir = pnacl_project_root
- if not dir.file_exists then dir.mkdir
var file = "{dir}/Makefile"
"""
# This file was generated by Nit, any modification will be lost.
var file = "{dir}/Makefile"
"""
# This file was generated by Nit, any modification will be lost.
@@
-85,9
+77,12
@@
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
NACL_SDK_ROOT ?= $(abspath $(dir $(THIS_MAKEFILE))../../../..)
# Project Build flags
NACL_SDK_ROOT ?= $(abspath $(dir $(THIS_MAKEFILE))../../../..)
# Project Build flags
-WARNINGS := -Wall -pedantic -Werror -Wno-long-long -Wno-unused-value -Wno-unused-label -Wno-duplicate-decl-specifier -Wno-switch -Wno-embedded-directive
+WARNINGS := -Wall -pedantic -Wno-long-long -Wno-unused-value -Wno-unused-label -Wno-duplicate-decl-specifier -Wno-switch -Wno-embedded-directive
CXXFLAGS := -pthread $(WARNINGS)
CXXFLAGS := -pthread $(WARNINGS)
+CXXFLAGS += -g -O0 # Debug
+# CXXFLAGS += -O3 # Release
+
#
# Compute tool paths
#
#
# Compute tool paths
#
@@
-98,8
+93,8
@@
OSNAME := $(shell $(GETOS))
PNACL_TC_PATH := $(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_pnacl)
PNACL_CXX := $(PNACL_TC_PATH)/bin/pnacl-clang
PNACL_FINALIZE := $(PNACL_TC_PATH)/bin/pnacl-finalize
PNACL_TC_PATH := $(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_pnacl)
PNACL_CXX := $(PNACL_TC_PATH)/bin/pnacl-clang
PNACL_FINALIZE := $(PNACL_TC_PATH)/bin/pnacl-finalize
-CXXFLAGS += -I$(NACL_SDK_ROOT)/include
-LDFLAGS := -L$(NACL_SDK_ROOT)/lib/pnacl/Release -lppapi_cpp -lppapi
+CXXFLAGS += -I$(NACL_SDK_ROOT)/include -I$(NACL_SDK_ROOT)/include/pnacl
+LDFLAGS := -L$(NACL_SDK_ROOT)/lib/pnacl/Release -lppapi_cpp -lppapi -lm
#
# Disable DOS PATH warning when using Cygwin based tools Windows
#
# Disable DOS PATH warning when using Cygwin based tools Windows
@@
-108,13
+103,15
@@
CYGWIN ?= nodosfilewarning
export CYGWIN
# Declare the ALL target first, to make the 'all' target the default build
export CYGWIN
# Declare the ALL target first, to make the 'all' target the default build
-all: ../../{{{outname}}}/{{{app_name}}}.pexe
+all: ../{{{outname}}}/{{{app_name}}}.pexe
+
+.c.o:
+ $(PNACL_CXX) -c $< -g -O0 $(CXXFLAGS)
-{{{app_name}}}.pexe: src/{{{cfiles.join(" src/")}}}
- $(PNACL_CXX) -o $@ $^ -g -O0 $(CXXFLAGS) $(LDFLAGS) # For Debug
- # $(PNACL_CXX) -o $@ $^ -O3 $(CXXFLAGS) $(LDFLAGS) # For Release
+{{{app_name}}}.pexe: {{{ofiles.join(" ")}}}
+ $(PNACL_CXX) -o $@ $^ $(LDFLAGS)
-../../{{{outname}}}/{{{app_name}}}.pexe: {{{app_name}}}.pexe
+../{{{outname}}}/{{{app_name}}}.pexe: {{{app_name}}}.pexe
$(PNACL_FINALIZE) -o $@ $<
""".write_to_file(file)
$(PNACL_FINALIZE) -o $@ $<
""".write_to_file(file)
@@
-247,6
+244,6
@@
function updateStatus(opt_message) {
redef fun compile_c_code(compiler, compile_dir)
do
# Generate the pexe
redef fun compile_c_code(compiler, compile_dir)
do
# Generate the pexe
- toolcontext.exec_and_check(["make", "-C", pnacl_project_root], "PNaCl project error")
+ toolcontext.exec_and_check(["make", "-C", compile_dir, "-j", "4"], "PNaCl project error")
end
end
end
end