pnacl: disable clang warnings on generated code
[nit.git] / src / pnacl_platform.nit
index ebbf3b6..766988d 100644 (file)
@@ -31,6 +31,10 @@ end
 class PnaclPlatform
        super Platform
 
+       redef fun supports_libunwind do return false
+
+       redef fun no_main do return true
+
        redef fun toolchain(toolcontext) do return new PnaclToolchain(toolcontext)
 end
 
@@ -81,8 +85,8 @@ THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
 NACL_SDK_ROOT ?= $(abspath $(dir $(THIS_MAKEFILE))../../../..)
 
 # Project Build flags
-WARNINGS := -Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
-CXXFLAGS := -pthread -std=gnu++98 $(WARNINGS)
+WARNINGS := -Wall -pedantic -Werror -Wno-long-long -Wno-unused-value -Wno-unused-label -Wno-duplicate-decl-specifier -Wno-switch -Wno-embedded-directive
+CXXFLAGS := -pthread $(WARNINGS)
 
 #
 # Compute tool paths
@@ -90,12 +94,11 @@ 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
 PNACL_FINALIZE := $(PNACL_TC_PATH)/bin/pnacl-finalize
-CXXFLAGS := -I$(NACL_SDK_ROOT)/include
+CXXFLAGS += -I$(NACL_SDK_ROOT)/include
 LDFLAGS := -L$(NACL_SDK_ROOT)/lib/pnacl/Release -lppapi_cpp -lppapi
 
 #
@@ -104,35 +107,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>
   <!--
@@ -175,14 +165,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.
@@ -233,7 +221,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