pnacl: make conditionnal file creation a "one liner" to fix indentation
[nit.git] / src / pnacl_platform.nit
index d6291da..e05c5c6 100644 (file)
@@ -51,10 +51,7 @@ class PnaclToolchain
                var app_name = compiler.mainmodule.name
 
                # create compile_dir
-               var dir = pnacl_project_root
-               if not dir.file_exists then dir.mkdir
-
-               dir = compile_dir
+               var dir = compile_dir
                if not dir.file_exists then dir.mkdir
 
                # compile normal C files
@@ -93,7 +90,6 @@ CXXFLAGS := -pthread -std=gnu++98 $(WARNINGS)
 GETOS := python $(NACL_SDK_ROOT)/tools/getos.py
 OSHELPERS = python $(NACL_SDK_ROOT)/tools/oshelpers.py
 OSNAME := $(shell $(GETOS))
-RM := $(OSHELPERS) rm
 
 PNACL_TC_PATH := $(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_pnacl)
 PNACL_CXX := $(PNACL_TC_PATH)/bin/pnacl-clang
@@ -107,35 +103,22 @@ LDFLAGS := -L$(NACL_SDK_ROOT)/lib/pnacl/Release -lppapi_cpp -lppapi
 CYGWIN ?= nodosfilewarning
 export CYGWIN
 
-
 # Declare the ALL target first, to make the 'all' target the default build
 all: ../../{{{outname}}}/{{{app_name}}}.pexe
 
-clean:
-       $(RM) {{{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
        $(PNACL_FINALIZE) -o $@ $<
-
-#
-# Makefile target to run the SDK's simple HTTP server and serve this example.
-#
-HTTPD_PY := python $(NACL_SDK_ROOT)/tools/httpd.py
-
-.PHONY: serve
-serve: all
-       $(HTTPD_PY) -C $(CURDIR)
                """.write_to_file(file)
 
                ### generate the minimal index.html
                if not outname.file_exists then outname.mkdir
                file = "{outname}/index.html"
-               if not file.file_exists then
-               """
+
+               if not file.file_exists then """
 <!DOCTYPE html>
 <html>
   <!--
@@ -178,14 +161,12 @@ serve: all
 </body>
 </html>
                """.write_to_file(file)
-               end
 
                ### generate pnacl_js.js in a folder named 'js'
                dir = "{outname}/js/"
                if not dir.file_exists then dir.mkdir
                file = "{dir}/pnacl_js.js"
-               if not file.file_exists then
-               """
+               if not file.file_exists then """
 // This file was generated by Nit, any modification will be lost.
 
 {{{app_name}}}Module = null;  // Global application object.
@@ -236,7 +217,6 @@ function updateStatus(opt_message) {
        }
 }
                """.write_to_file(file)
-               end
 
                ### generate the manifest file : app_name.nmf
                # used to point the HTML to the Native Client module