pnacl: generate all files right in .nit_compile
authorAlexis Laferrière <alexis.laf@xymus.net>
Sat, 3 May 2014 12:02:00 +0000 (08:02 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 20 May 2014 18:16:31 +0000 (14:16 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

src/pnacl_platform.nit

index 766988d..adac73e 100644 (file)
@@ -41,15 +41,6 @@ end
 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
@@ -71,8 +62,6 @@ class PnaclToolchain
                if outname == null then outname = "{compiler.mainmodule.name}"
 
                ## 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.
@@ -108,13 +97,13 @@ CYGWIN ?= nodosfilewarning
 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
 
 {{{app_name}}}.pexe: src/{{{cfiles.join(" src/")}}}
        $(PNACL_CXX) -o $@ $^ -g -O0 $(CXXFLAGS) $(LDFLAGS) # For Debug
        # $(PNACL_CXX) -o $@ $^ -O3 $(CXXFLAGS) $(LDFLAGS) # For Release
 
-../../{{{outname}}}/{{{app_name}}}.pexe: {{{app_name}}}.pexe
+../{{{outname}}}/{{{app_name}}}.pexe: {{{app_name}}}.pexe
        $(PNACL_FINALIZE) -o $@ $<
                """.write_to_file(file)
 
@@ -247,6 +236,6 @@ function updateStatus(opt_message) {
        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], "PNaCl project error")
        end
 end