diff options
author | sbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-27 01:35:45 +0000 |
---|---|---|
committer | sbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-27 01:35:45 +0000 |
commit | f0fa95012ce88263ca65e8cf5fb4e7667bfc54e6 (patch) | |
tree | ac858ac4a510ceab6a1c9b2ea36800abd274842d /native_client_sdk/src | |
parent | 5a9f47ad788a638bae138edc5e35751c4e5865d2 (diff) | |
download | chromium_src-f0fa95012ce88263ca65e8cf5fb4e7667bfc54e6.zip chromium_src-f0fa95012ce88263ca65e8cf5fb4e7667bfc54e6.tar.gz chromium_src-f0fa95012ce88263ca65e8cf5fb4e7667bfc54e6.tar.bz2 |
[NaCl SDK] Make is easier to override linux host compiler
Switch from HOST_CC/HOST_CC/etc to the more standard
CC/CXX/etc for the names of the varaibles in the
SDK example build system.
This allow things like "CXX=clang++ make TOOLCHAIN=linux".
Also, fix kernel_wrap.h so that it compiles with
clang++ on desktop linux.
R=binji@chromium.org
Review URL: https://codereview.chromium.org/85813004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237472 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk/src')
-rw-r--r-- | native_client_sdk/src/libraries/nacl_io/kernel_wrap.h | 8 | ||||
-rw-r--r-- | native_client_sdk/src/tools/host_gcc.mk | 31 | ||||
-rw-r--r-- | native_client_sdk/src/tools/nacl_gcc.mk | 6 |
3 files changed, 22 insertions, 23 deletions
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h b/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h index 39eb863..e8e4e99 100644 --- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h +++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h @@ -56,9 +56,9 @@ int _fstat32(int fd, struct _stat32* buf); int _fstat64(int fd, struct _stat64* buf); int _fstat32i64(int fd, struct _stat32i64* buf); int _fstat64i32(int fd, struct _stat64i32* buf); -#else +#elif !defined(__linux__) struct stat; -int fstat(int fd, struct stat* buf) NOTHROW; +extern int fstat(int fd, struct stat* buf) NOTHROW; #endif int fsync(int fd); int ftruncate(int fd, off_t length) NOTHROW; @@ -90,8 +90,8 @@ int _stat32(const char* path, struct _stat32* buf); int _stat64(const char* path, struct _stat64* buf); int _stat32i64(const char* path, struct _stat32i64* buf); int _stat64i32(const char* path, struct _stat64i32* buf); -#else -int stat(const char* path, struct stat* buf) NOTHROW; +#elif !defined(__linux__) +extern int stat(const char* path, struct stat* buf) NOTHROW; #endif int symlink(const char* oldpath, const char* newpath) NOTHROW; int umount(const char* path) NOTHROW; diff --git a/native_client_sdk/src/tools/host_gcc.mk b/native_client_sdk/src/tools/host_gcc.mk index fad4a87..f474054 100644 --- a/native_client_sdk/src/tools/host_gcc.mk +++ b/native_client_sdk/src/tools/host_gcc.mk @@ -14,17 +14,17 @@ # We use the C++ compiler for everything and then use the -Wl,-as-needed flag # in the linker to drop libc++ unless it's actually needed. # -HOST_CC ?= $(NACL_COMPILER_PREFIX) gcc -HOST_CXX ?= $(NACL_COMPILER_PREFIX) g++ -HOST_LINK ?= g++ -HOST_LIB ?= ar -HOST_STRIP ?= strip +CC ?= $(NACL_COMPILER_PREFIX) gcc +CXX ?= $(NACL_COMPILER_PREFIX) g++ +LINK ?= $(CXX) +LIB ?= ar +STRIP ?= strip # Adding -Wl,-Bsymbolic means that symbols defined within the module are always # used by the moulde, and not shadowed by symbols already loaded in, for # exmaple, libc. Without this the libc symbols (or anything injected with # LD_PRELOAD will take precedence). -LDFLAGS ?= -Wl,-Map,$(OUTDIR)/$(TARGET).map -Wl,-Bsymbolic +HOST_LDFLAGS ?= -Wl,-Map,$(OUTDIR)/$(TARGET).map -Wl,-Bsymbolic ifeq (,$(findstring gcc,$(shell $(WHICH) gcc))) $(warning To skip the host build use:) @@ -32,9 +32,8 @@ $(warning "make all_versions NO_HOST_BUILDS=1") $(error Unable to find gcc in PATH while building Host build) endif - -LINUX_WARNINGS ?= -Wno-long-long -Wall -Werror -LINUX_CFLAGS = -fPIC -pthread $(LINUX_WARNINGS) -I$(NACL_SDK_ROOT)/include -I$(NACL_SDK_ROOT)/include/linux +HOST_WARNINGS ?= -Wno-long-long -Wall -Werror +HOST_CFLAGS = -fPIC -pthread $(HOST_WARNINGS) -I$(NACL_SDK_ROOT)/include -I$(NACL_SDK_ROOT)/include/linux # @@ -46,14 +45,14 @@ LINUX_CFLAGS = -fPIC -pthread $(LINUX_WARNINGS) -I$(NACL_SDK_ROOT)/include -I$(N define C_COMPILER_RULE -include $(call SRC_TO_DEP,$(1)) $(call SRC_TO_OBJ,$(1)): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp - $(call LOG,CC ,$$@,$(HOST_CC) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(LINUX_CFLAGS) $(2)) + $(call LOG,CC ,$$@,$(CC) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(HOST_CFLAGS) $(2)) @$(FIXDEPS) $(call SRC_TO_DEP_PRE_FIXUP,$(1)) endef define CXX_COMPILER_RULE -include $(call SRC_TO_DEP,$(1)) $(call SRC_TO_OBJ,$(1)): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp - $(call LOG,CXX ,$$@,$(HOST_CXX) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(LINUX_CFLAGS) $(2)) + $(call LOG,CXX ,$$@,$(CXX) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(HOST_CFLAGS) $(2)) @$(FIXDEPS) $(call SRC_TO_DEP_PRE_FIXUP,$(1)) endef @@ -100,7 +99,7 @@ all: $(LIBDIR)/$(OSNAME)_host/$(CONFIG)/lib$(1).a $(LIBDIR)/$(OSNAME)_host/$(CONFIG)/lib$(1).a: $(foreach src,$(2),$(call SRC_TO_OBJ,$(src))) $(MKDIR) -p $$(dir $$@) $(RM) -f $$@ - $(call LOG,LIB,$$@,$(HOST_LIB) -cr $$@ $$^) + $(call LOG,LIB,$$@,$(LIB) -cr $$@ $$^) endef @@ -112,19 +111,19 @@ endef # $3 = List of libs # $4 = List of deps # $5 = List of lib dirs -# $6 = Other Linker Args +# $6 = Linker Args # ifdef STANDALONE define LINKER_RULE all: $(1) $(1): $(2) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp) - $(call LOG,LINK,$$@,$(HOST_LINK) -o $(1) $(2) $(LDFLAGS) $(NACL_LDFLAGS) $(foreach path,$(5),-L$(path)/$(OSNAME)_host)/$(CONFIG) $(foreach lib,$(3),-l$(lib)) $(6)) + $(call LOG,LINK,$$@,$(LINK) -o $(1) $(2) $(HOST_LDFLAGS) $(NACL_LDFLAGS) $(LDFLAGS) $(foreach path,$(5),-L$(path)/$(OSNAME)_host)/$(CONFIG) $(foreach lib,$(3),-l$(lib)) $(6)) endef else define LINKER_RULE all: $(1) $(1): $(2) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp) - $(call LOG,LINK,$$@,$(HOST_LINK) -shared -o $(1) $(2) $(LDFLAGS) $(NACL_LDFLAGS) $(foreach path,$(5),-L$(path)/$(OSNAME)_host)/$(CONFIG) $(foreach lib,$(3),-l$(lib)) $(6)) + $(call LOG,LINK,$$@,$(LINK) -shared -o $(1) $(2) $(HOST_LDFLAGS) $(NACL_LDFLAGS) $(LDFLAGS) $(foreach path,$(5),-L$(path)/$(OSNAME)_host)/$(CONFIG) $(foreach lib,$(3),-l$(lib)) $(6)) endef endif @@ -157,7 +156,7 @@ all: $(LIB_LIST) $(DEPS_LIST) define STRIP_RULE all: $(OUTDIR)/$(1)$(HOST_EXT) $(OUTDIR)/$(1)$(HOST_EXT): $(OUTDIR)/$(2)$(HOST_EXT) - $(call LOG,STRIP,$$@,$(HOST_STRIP) --strip-debug -o $$@ $$^) + $(call LOG,STRIP,$$@,$(STRIP) --strip-debug -o $$@ $$^) endef diff --git a/native_client_sdk/src/tools/nacl_gcc.mk b/native_client_sdk/src/tools/nacl_gcc.mk index d758a88..2f51e36 100644 --- a/native_client_sdk/src/tools/nacl_gcc.mk +++ b/native_client_sdk/src/tools/nacl_gcc.mk @@ -178,7 +178,7 @@ define SO_LINKER_RULE ifneq (,$(findstring x86_32,$(ARCHES))) all: $(OUTDIR)/lib$(1)_x86_32.so $(OUTDIR)/lib$(1)_x86_32.so: $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_x86_32_pic)) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp) - $(call LOG,LINK,$$@,$(X86_32_LINK) -o $$@ $$(filter %.o,$$^) $(LDFLAGS_SHARED) -m32 $(NACL_LDFLAGS) $(X86_32_LDFLAGS) $(foreach path,$(5),-L$(path)/$(TOOLCHAIN)_x86_32/$(CONFIG)) $(foreach lib,$(3),-l$(lib))) + $(call LOG,LINK,$$@,$(X86_32_LINK) -o $$@ $$(filter %.o,$$^) $(LDFLAGS_SHARED) -m32 $(NACL_LDFLAGS) $(X86_32_LDFLAGS) $(LDFLAGS) $(foreach path,$(5),-L$(path)/$(TOOLCHAIN)_x86_32/$(CONFIG)) $(foreach lib,$(3),-l$(lib))) $(call LOG,VALIDATE,$$@,$(NCVAL) $$@) $(STAMPDIR)/$(1).stamp: $(LIBDIR)/$(TOOLCHAIN)_x86_32/$(CONFIG)/lib$(1).so @@ -195,7 +195,7 @@ endif ifneq (,$(findstring x86_64,$(ARCHES))) all: $(OUTDIR)/lib$(1)_x86_64.so $(OUTDIR)/lib$(1)_x86_64.so: $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_x86_64_pic)) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp) - $(call LOG,LINK,$$@,$(X86_32_LINK) -o $$@ $$(filter %.o,$$^) $(LDFLAGS_SHARED) -m64 $(NACL_LDFLAGS) $(X86_64_LDFLAGS) $(foreach path,$(5),-L$(path)/$(TOOLCHAIN)_x86_64/$(CONFIG)) $(foreach lib,$(3),-l$(lib))) + $(call LOG,LINK,$$@,$(X86_32_LINK) -o $$@ $$(filter %.o,$$^) $(LDFLAGS_SHARED) -m64 $(NACL_LDFLAGS) $(X86_64_LDFLAGS) $(LDFLAGS) $(foreach path,$(5),-L$(path)/$(TOOLCHAIN)_x86_64/$(CONFIG)) $(foreach lib,$(3),-l$(lib))) $(call LOG,VALIDATE,$$@,$(NCVAL) $$@) $(STAMPDIR)/$(1).stamp: $(LIBDIR)/$(TOOLCHAIN)_x86_64/$(CONFIG)/lib$(1).so @@ -288,7 +288,7 @@ endef # $2 = List of Sources # $3 = List of LIBS # $4 = List of DEPS -# $5 = POSIX Link Flags +# $5 = Link Flags # $6 = Library Paths # define LINKER_RULE |