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.
6 # GNU Make based build file. For details on GNU Make see:
7 # http://www.gnu.org/software/make/manual/make.html
11 # Get pepper directory for toolchain and includes.
13 # If NACL_SDK_ROOT is not set, then assume it can be found three directories up.
15 THIS_MAKEFILE
:= $(abspath
$(lastword
$(MAKEFILE_LIST
)))
16 NACL_SDK_ROOT ?
= $(abspath
$(dir $(THIS_MAKEFILE
))..
/..
)
19 WARNINGS
:= -Wno-long-long
-Wall
-Wswitch-enum
-pedantic
-Werror
20 CXXFLAGS
:= -pthread
-std
=gnu
++98 $(WARNINGS
)
25 GETOS
:= python
$(NACL_SDK_ROOT
)/tools
/getos.py
26 OSHELPERS
= python
$(NACL_SDK_ROOT
)/tools
/oshelpers.py
27 OSNAME
:= $(shell $(GETOS
))
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
37 # Disable DOS PATH warning when using Cygwin based tools Windows
39 CYGWIN ?
= nodosfilewarning
43 # Declare the ALL target first, to make the 'all' target the default build
44 all: hello_tutorial.pexe
47 $(RM
) hello_tutorial.pexe hello_tutorial.bc
49 hello_tutorial.bc
: hello_tutorial.
cc
50 $(PNACL_CXX
) -o
$@
$< -O2
$(CXXFLAGS
) $(LDFLAGS
)
52 hello_tutorial.pexe
: hello_tutorial.bc
53 $(PNACL_FINALIZE
) -o
$@
$<
57 # Makefile target to run the SDK's simple HTTP server and serve this example.
59 HTTPD_PY
:= python
$(NACL_SDK_ROOT
)/tools
/httpd.py
63 $(HTTPD_PY
) -C
$(CURDIR
)