| OLD | NEW |
| (Empty) |
| 1 # Copyright (c) 2012 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 # | |
| 12 # Get pepper directory for toolchain and includes. | |
| 13 # | |
| 14 # If NACL_SDK_ROOT is not set, then assume it can be found a two directories up, | |
| 15 # from the default example directory location. | |
| 16 # | |
| 17 THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST))) | |
| 18 NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..) | |
| 19 | |
| 20 | |
| 21 # | |
| 22 # Project Build flags | |
| 23 # | |
| 24 # Turns on warnings (-Wxxx), builds with zero optimization (-O0) and adds debug | |
| 25 # information (-g) for correctness and ease of debugging. | |
| 26 WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -Werror -pedantic | |
| 27 CFLAGS:=-pthread -O0 -g $(WARNINGS) | |
| 28 | |
| 29 | |
| 30 # | |
| 31 # Compute path to compiler | |
| 32 # | |
| 33 OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py) | |
| 34 TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_pnacl) | |
| 35 | |
| 36 | |
| 37 # Alias for C/C++ compiler and translater | |
| 38 CC:=$(TC_PATH)/newlib/bin/pnacl-clang | |
| 39 TRANSLATE:=$(TC_PATH)/newlib/bin/pnacl-translate | |
| 40 | |
| 41 # | |
| 42 # Disable DOS PATH warning when using Cygwin based tools Windows | |
| 43 # | |
| 44 CYGWIN ?= nodosfilewarning | |
| 45 export CYGWIN | |
| 46 | |
| 47 # Default target is everything | |
| 48 all : hello_world_x86_32.nexe hello_world_x86_64.nexe hello_world_arm.nexe | |
| 49 | |
| 50 # Define compile and link rule for portable NEXE format | |
| 51 hello_world.pexe : hello_world.c $(THIS_MAKE) | |
| 52 $(CC) -o $@ $< -O0 -g $(CFLAGS) -lppapi | |
| 53 | |
| 54 # Define translation rules | |
| 55 hello_world_x86_32.nexe : hello_world.pexe | |
| 56 $(TRANSLATE) -arch x86-32 $< -o $@ | |
| 57 | |
| 58 hello_world_x86_64.nexe : hello_world.pexe | |
| 59 $(TRANSLATE) -arch x86-64 $< -o $@ | |
| 60 | |
| 61 hello_world_arm.nexe : hello_world.pexe | |
| 62 $(TRANSLATE) -arch arm $< -o $@ | |
| 63 | |
| 64 # Define a phony rule so it always runs, to build nexe and start up server. | |
| 65 .PHONY: RUN | |
| 66 RUN: all | |
| 67 python ../httpd.py | |
| OLD | NEW |