129 lines
No EOL
3.5 KiB
Text
129 lines
No EOL
3.5 KiB
Text
ifeq ($(TARGET),nacl)
|
|
ifndef NACL_SDK_ROOT
|
|
$(error Set NACL_SDK_ROOT environment variable)
|
|
endif
|
|
#
|
|
# Disable DOS PATH warning when using Cygwin based tools Windows
|
|
#
|
|
CYGWIN ?= nodosfilewarning
|
|
export CYGWIN
|
|
|
|
OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
|
|
# Turns on warnings (-Wxxx), builds with zero optimization (-O0) and adds debug
|
|
# information (-g) for correctness and ease of debugging.
|
|
WARNINGS:=-Wno-long-long -Wall
|
|
TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
|
|
|
|
nacl_CFLAGS:=-pthread $(WARNINGS)
|
|
nacl_CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
|
|
nacl_CXX:=$(TC_PATH)/bin/i686-nacl-g++
|
|
nacl_CC:=$(TC_PATH)/bin/i686-nacl-gcc
|
|
nacl_STATICLIB_EXT := a
|
|
nacl_DYNAMICLIB_EXT := nexe
|
|
nacl_LIBRARY_PREFIX := lib
|
|
nacl_LDFLAGS := -lppapi
|
|
nacl_GLOBAL_INCLUDES=-I$(TC_PATH)/i686-nacl/usr/include
|
|
|
|
ifeq ($(ARCH),)
|
|
ARCH := x86
|
|
endif
|
|
|
|
ifeq ($(ARCH),x86)
|
|
nacl_CFLAGS += -m32
|
|
nacl_CXXFLAGS += -m32
|
|
nacl_LDFLAGS += -m32
|
|
else ifeq ($(ARCH),x64)
|
|
nacl_CFLAGS += -m64
|
|
nacl_CXXFLAGS += -m64
|
|
nacl_LDFLAGS += -m64
|
|
else
|
|
$(error Undefined ARCH $(ARCH))
|
|
endif
|
|
|
|
|
|
else
|
|
ifndef JAVA_HOME
|
|
$(error Set JAVA_HOME environment variable)
|
|
endif
|
|
ARCH := x86
|
|
ifeq ($(TARGET),)
|
|
ifeq ($(shell uname),Darwin)
|
|
TARGET := darwin
|
|
endif
|
|
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
|
TARGET := cygwin
|
|
endif
|
|
ifeq ($(findstring MINGW,$(shell uname)),MINGW)
|
|
TARGET := win
|
|
endif
|
|
endif
|
|
ifeq ($(TARGET),)
|
|
TARGET := linux
|
|
endif
|
|
|
|
# Windows uses different path separators, because they hate me
|
|
ifeq ($(TARGET),win)
|
|
sep := ;
|
|
else
|
|
sep := :
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
###########################################
|
|
|
|
# os=Default is meant to be generic unix/linux
|
|
linux_CXX := g++
|
|
linux_CC := gcc
|
|
linux_STRIP := strip
|
|
linux_STATICLIB_EXT := a
|
|
linux_DYNAMICLIB_EXT := so
|
|
linux_LIBRARY_PREFIX := lib
|
|
linux_LDFLAGS := -shared -Wl,-Bsymbolic
|
|
#Default_LINKFLAGS := -shared
|
|
|
|
#
|
|
Support10_4 := -isysroot /Developer/SDKs/MacOSX10.4u.sdk
|
|
darwin_CXX := gcc -arch $(arch) -mmacosx-version-min=10.4 $(Support10_4)
|
|
darwin_CC := gcc -arch $(arch) -mmacosx-version-min=10.4 $(Support10_4)
|
|
darwin_STRIP := strip -x
|
|
#darwin_CPP_FLAGS := strip -x
|
|
#darwin_LINKFLAGS := -dynamiclib $(Support10_4)
|
|
|
|
|
|
win_CXX := i586-mingw32msvc-gcc
|
|
win_CC := i586-mingw32msvc-gcc
|
|
win_STRIP := i586-mingw32msvc-strip
|
|
win_CPP_FLAGS := -D_Windows
|
|
win_STATICLIB_EXT := a
|
|
win_DYNAMICLIB_EXT := dll
|
|
win_LIBRARY_PREFIX := lib
|
|
win_LDFLAGS := -shared -Wl,-Bsymbolic
|
|
#win_CFLAGS := -D_JNI_IMPLEMENTATION_ -Ilib/inc_win -I$(JAVA_HOME)/include -O
|
|
#win_LINKFLAGS := -Wl,--kill-at -shared
|
|
############################################################################################################################
|
|
|
|
### Cygwin target ###
|
|
cygwin_CXX := i686-pc-cygwin-g++
|
|
cygwin_CC := i686-pc-cygwin-gcc
|
|
cygwin_STRIP := i686-pc-cygwin-strip
|
|
cygwin_LDFLAGS := -shared -Wl,--kill-at
|
|
cygwin_CFLAGS := -D__int64="long long" -D_JNI_IMPLEMENTATION -D_REENTRANT -D_GNU_SOURCE
|
|
cygwin_CXXFLAGS := -D__int64="long long" -D_JNI_IMPLEMENTATION -D_REENTRANT -D_GNU_SOURCE
|
|
cygwin_STATICLIB_EXT := lib
|
|
cygwin_DYNAMICLIB_EXT := dll
|
|
cygwin_LIBRARY_PREFIX := # empty
|
|
|
|
# Publish chosen settings as global
|
|
CXX := $($(TARGET)_CXX)
|
|
CC := $($(TARGET)_CC)
|
|
STRIP := $($(TARGET)_STRIP)
|
|
CFLAGS := $($(TARGET)_CFLAGS)
|
|
CXXFLAGS := $($(TARGET)_CXXFLAGS)
|
|
LDFLAGS := $($(TARGET)_LDFLAGS)
|
|
LDFLAGS := $($(TARGET)_LDFLAGS)
|
|
GLOBAL_INCLUDES=$($(TARGET)_GLOBAL_INCLUDES)
|
|
STATICLIB_EXT := $($(TARGET)_STATICLIB_EXT)
|
|
DYNAMICLIB_EXT := $($(TARGET)_DYNAMICLIB_EXT)
|
|
LIBRARY_PREFIX := $($(TARGET)_LIBRARY_PREFIX) |