- add sources.
[platform/framework/web/crosswalk.git] / src / native_client_sdk / src / getting_started / part1 / Makefile
1 # Copyright (c) 2013 The Native Client Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 #
6 # GNU Make based build file.  For details on GNU Make see:
7 # http://www.gnu.org/software/make/manual/make.html
8 #
9
10 #
11 # Get pepper directory for toolchain and includes.
12 #
13 # If NACL_SDK_ROOT is not set, then assume it can be found three directories up.
14 #
15 THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
16 NACL_SDK_ROOT ?= $(abspath $(dir $(THIS_MAKEFILE))../..)
17
18 # Project Build flags
19 WARNINGS := -Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
20 CXXFLAGS := -pthread -std=gnu++98 $(WARNINGS)
21
22 #
23 # Compute tool paths
24 #
25 GETOS := python $(NACL_SDK_ROOT)/tools/getos.py
26 OSHELPERS = python $(NACL_SDK_ROOT)/tools/oshelpers.py
27 OSNAME := $(shell $(GETOS))
28 RM := $(OSHELPERS) rm
29
30 PNACL_TC_PATH := $(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_pnacl)
31 PNACL_CXX := $(PNACL_TC_PATH)/bin/pnacl-clang++
32 PNACL_FINALIZE := $(PNACL_TC_PATH)/bin/pnacl-finalize
33 CXXFLAGS := -I$(NACL_SDK_ROOT)/include
34 LDFLAGS := -L$(NACL_SDK_ROOT)/lib/pnacl/Release -lppapi_cpp -lppapi
35
36 #
37 # Disable DOS PATH warning when using Cygwin based tools Windows
38 #
39 CYGWIN ?= nodosfilewarning
40 export CYGWIN
41
42
43 # Declare the ALL target first, to make the 'all' target the default build
44 all: hello_tutorial.pexe
45
46 clean:
47         $(RM) hello_tutorial.pexe hello_tutorial.bc
48
49 hello_tutorial.bc: hello_tutorial.cc
50         $(PNACL_CXX) -o $@ $< -O2 $(CXXFLAGS) $(LDFLAGS)
51
52 hello_tutorial.pexe: hello_tutorial.bc
53         $(PNACL_FINALIZE) -o $@ $<
54
55
56 #
57 # Makefile target to run the SDK's simple HTTP server and serve this example.
58 #
59 HTTPD_PY := python $(NACL_SDK_ROOT)/tools/httpd.py
60
61 .PHONY: serve
62 serve: all
63         $(HTTPD_PY) -C $(CURDIR)