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

Unified Diff: examples/srpc/duality/nacl_build.mk

Issue 2856050: Adding srpc example to naclports. (Closed) Base URL: http://naclports.googlecode.com/svn/trunk/src/
Patch Set: '' Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « examples/srpc/duality/loader.cc ('k') | examples/srpc/duality/npp_gate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/srpc/duality/nacl_build.mk
===================================================================
--- examples/srpc/duality/nacl_build.mk (revision 0)
+++ examples/srpc/duality/nacl_build.mk (revision 0)
@@ -0,0 +1,79 @@
+# Copyright 2010, The Native Client SDK Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can
+# be found in the LICENSE file.
+
+# Common makefile for the examples. This has some basic variables, such as
+# CC (the compiler) and some suffix rules such as .c.o.
+#
+# The main purpose of this makefile component is to demonstrate building a
+# Native Client module (.nexe)
+
+.SUFFIXES:
+.SUFFIXES: .c .cc .cpp .o
+
+.PHONY: check_variables
+
+ifeq ($(origin OS), undefined)
+ ifeq ($(shell uname -s), Darwin)
+ OS=Darwin
+ else
+ OS=$(shell uname -o)
+ endif
+endif
+
+ifeq ($(OS), $(filter $(OS), Windows_NT Cygwin))
+ PLATFORM = win
+ TARGET = x86
+endif
+ifeq ($(OS), $(filter $(OS), Darwin MACOS))
+ PLATFORM = mac
+ TARGET = x86
+endif
+
+# Look for 'Linux' in the $(OS) string. $(OS) is assumed to be a Linux
+# variant if the result of $(findstring) is not empty.
+ifneq (, $(findstring Linux, $(OS)))
+ PLATFORM = linux
+ TARGET = x86
+endif
+
+NACL_SDK_ROOT ?= .
+
+NACL_TOOLCHAIN_DIR = toolchain/$(PLATFORM)_$(TARGET)
+
+CC = $(NACL_SDK_ROOT)/$(NACL_TOOLCHAIN_DIR)/bin/nacl-gcc
+CPP = $(NACL_SDK_ROOT)/$(NACL_TOOLCHAIN_DIR)/bin/nacl-g++
+
+%_x86_32.o: %.c
+ $(CC) $(CFLAGS) -m32 $(INCLUDES) $(OPT_FLAGS) -c -o $@ $<
+
+%_x86_32.o: %.cc
+ $(CPP) $(CFLAGS) -m32 $(INCLUDES) $(OPT_FLAGS) -c -o $@ $<
+
+%_x86_32.o: %.cpp
+ $(CPP) $(CFLAGS) -m32 $(INCLUDES) $(OPT_FLAGS) -c -o $@ $<
+
+%_x86_64.o: %.c
+ $(CC) $(CFLAGS) -m64 $(INCLUDES) $(OPT_FLAGS) -c -o $@ $<
+
+%_x86_64.o: %.cc
+ $(CPP) $(CFLAGS) -m64 $(INCLUDES) $(OPT_FLAGS) -c -o $@ $<
+
+%_x86_64.o: %.cpp
+ $(CPP) $(CFLAGS) -m64 $(INCLUDES) $(OPT_FLAGS) -c -o $@ $<
+
+# Make sure certain variables are defined. This rule is set as a dependency
+# for all the .nexe builds in the examples.
+check_variables:
+ifeq ($(origin OS), undefined)
+ @echo "Error: OS is undefined" ; exit 42
+endif
+ifeq ($(origin PLATFORM), undefined)
+ @echo "Error: PLATFORM is undefined (OS = $(OS))" ; exit 42
+endif
+ifeq ($(origin TARGET), undefined)
+ @echo "Error: TARGET is undefined (OS = $(OS))" ; exit 42
+endif
+ifeq ($(origin NACL_SDK_ROOT), undefined)
+ @echo "Error: NACL_SDK_ROOT is undefined" ; exit 42
+endif
« no previous file with comments | « examples/srpc/duality/loader.cc ('k') | examples/srpc/duality/npp_gate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698