Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: native_client_sdk/src/examples/debugging/Makefile

Issue 10541180: Cleanup build system (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 CHROME_PATH?=Undefined
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) -fno-omit-frame-pointer
28 LDFLAGS:=-pthread -lppapi
29 CC_SOURCES:=hello_world.c untrusted_crash_dump.c string_stream.c
30 PROJECT:=hello_world
31
32 #
33 # Compute path to compiler
34 #
35 OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
36 TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
37
38 #
39 # Verify we have a valid NACL_SDK_ROOT
40 #
41 ifeq (,$(wildcard $(TC_PATH)))
42 $(warning No valid NACL_SDK_ROOT at $(NACL_SDK_ROOT))
43 ifeq ($(origin NACL_SDK_ROOT), 'file')
44 $(error Override the default value via enviornment variable, or command-line.)
45 else
46 $(error Fix the NACL_SDK_ROOT specified in the environment or command-line.)
47 endif
48 endif
49
50 # Alias for C compiler
51 CC:=$(TC_PATH)/bin/i686-nacl-gcc
52
53
54 #
55 # Disable DOS PATH warning when using Cygwin based tools Windows
56 #
57 CYGWIN ?= nodosfilewarning
58 export CYGWIN
59
60
61 # Default target is everything
62 all : hello_world_x86_32.nexe hello_world_x86_64.nexe
63
64 # Define 32 bit compile and link rules for C sources
65 x86_32_OBJS:=$(patsubst %.c,%_32.o,$(CC_SOURCES))
66 $(x86_32_OBJS) : %_32.o : %.c $(THIS_MAKE)
67 $(CC) -o $@ -c $< -m32 -O0 -g $(CCFLAGS)
68
69 $(PROJECT)_x86_32.nexe : $(x86_32_OBJS)
70 $(CC) -o $@ $^ -m32 -O0 -g $(CCFLAGS) $(LDFLAGS)
71
72 # Define 64 bit compile and link rules for C sources
73 x86_64_OBJS:=$(patsubst %.c,%_64.o,$(CC_SOURCES))
74 $(x86_64_OBJS) : %_64.o : %.c $(THIS_MAKE)
75 $(CC) -o $@ -c $< -m64 -O0 -g $(CCFLAGS)
76
77 $(PROJECT)_x86_64.nexe : $(x86_64_OBJS)
78 $(CC) -o $@ $^ -m64 -O0 -g $(CCFLAGS) $(LDFLAGS)
79
80 # Define a phony rule so it always runs, to build nexe and start up server.
81 .PHONY: RUN
82 RUN: all
83 python ../httpd.py
84
85
86 #
87 # Setup environment to use SDK's version of the NaCl plugin, instead of the
88 # one built into Chrome. This requries launching Chrome which means we must
89 # be able to find it. It also means that we must determine which versions
90 # of the plugin, loader, irt, and any other helpers we must use.
91 #
92 HELPER_PATH:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py --helper)
93 IRTBIN_PATH:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py --irtbin)
94 LOADER_PATH:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py --loader)
95 PLUGIN_PATH:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py --plugin)
96 CHROME_ARGS:=--incognito --no-sandbox
97 CHROME_ARGS+="--register-pepper-plugins=$(PLUGIN_PATH);application/x-nacl"
98 CHROME_ARGS+="localhost:5103/debugging.html"
99
100
101 .PHONY: SETUP_FOR_CHROME
102 SETUP_FOR_CHROME:
103 ifeq (,$(wildcard $(CHROME_PATH)))
104 $(warning No valid Chrome found at CHROME_PATH=$(CHROME_PATH))
105 $(error Set CHROME_PATH via an environment variable, or command-line.)
106 endif
107
108
109 ifneq (,$(wildcard $(CHROME_PATH)))
110 export NACL_DANGEROUS_ENABLE_FILE_ACCESS=1
111 export NACL_SECURITY_DISABLE=1
112 export NACL_UNTRUSTED_EXCEPTION_HANDLING=1
113 export NACL_SEL_LDR=$(LOADER_PATH)
114 export NACL_IRT_LIBRARY=$(IRTBIN_PATH)
115 export NACL_SEL_LDR_BOOTSTRAP=$(HELPER_PATH)
116 endif
117
118
119 TRACE: SETUP_FOR_CHROME all
120 $(CHROME_PATH) $(CHROME_ARGS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698