OLD | NEW |
| (Empty) |
1 # Copyright (c) 2011 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 # Project information | |
12 # | |
13 # These variables store project specific settings for the project name | |
14 # build flags, files to copy or install. In the examples it is typically | |
15 # only the list of sources and project name that will actually change and | |
16 # the rest of the makefile is boilerplate for defining build rules. | |
17 # | |
18 PROJECT:=pong | |
19 LDFLAGS:=-lppapi_cpp -lppapi | |
20 CXX_SOURCES:=$(PROJECT).cc pong_module.cc view.cc | |
21 | |
22 | |
23 # | |
24 # Get pepper directory for toolchain and includes. | |
25 # | |
26 # If PEPPER_ROOT is not set, then assume it can be found a two directories up, | |
27 # from the default example directory location. | |
28 # | |
29 THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST))) | |
30 NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..) | |
31 | |
32 # Project Build flags | |
33 WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror | |
34 CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS) | |
35 | |
36 # | |
37 # Compute tool paths | |
38 # | |
39 # | |
40 OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py) | |
41 TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib) | |
42 CXX:=$(TC_PATH)/bin/i686-nacl-g++ | |
43 | |
44 # | |
45 # Disable DOS PATH warning when using Cygwin based tools Windows | |
46 # | |
47 CYGWIN ?= nodosfilewarning | |
48 export CYGWIN | |
49 | |
50 | |
51 # Declare the ALL target first, to make the 'all' target the default build | |
52 all: $(PROJECT)_x86_32.nexe $(PROJECT)_x86_64.nexe | |
53 | |
54 # Define 32 bit compile and link rules for C++ sources | |
55 x86_32_OBJS:=$(patsubst %.cc,%_32.o,$(CXX_SOURCES)) | |
56 $(x86_32_OBJS) : %_32.o : %.cc $(THIS_MAKE) | |
57 $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS) | |
58 | |
59 $(PROJECT)_x86_32.nexe : $(x86_32_OBJS) | |
60 $(CXX) -o $@ $^ -m32 -O0 -g $(CXXFLAGS) $(LDFLAGS) | |
61 | |
62 # Define 64 bit compile and link rules for C++ sources | |
63 x86_64_OBJS:=$(patsubst %.cc,%_64.o,$(CXX_SOURCES)) | |
64 $(x86_64_OBJS) : %_64.o : %.cc $(THIS_MAKE) | |
65 $(CXX) -o $@ -c $< -m64 -O0 -g $(CXXFLAGS) | |
66 | |
67 $(PROJECT)_x86_64.nexe : $(x86_64_OBJS) | |
68 $(CXX) -o $@ $^ -m64 -O0 -g $(CXXFLAGS) $(LDFLAGS) | |
69 | |
70 | |
71 # Define a phony rule so it always runs, to build nexe and start up server. | |
72 .PHONY: RUN | |
73 RUN: all | |
74 python ../httpd.py | |
75 | |
76 | |
OLD | NEW |