2012-06-05 09:30:57 +02:00
|
|
|
ifndef $(ARCH)
|
2012-06-04 23:49:39 +02:00
|
|
|
ARCH := x86
|
|
|
|
endif
|
2012-06-05 09:30:57 +02:00
|
|
|
|
2012-06-04 23:49:39 +02:00
|
|
|
############################################
|
|
|
|
############# NACL ### TARGET
|
2012-06-04 09:13:33 +02:00
|
|
|
ifeq ($(TARGET),nacl)
|
|
|
|
ifndef NACL_SDK_ROOT
|
|
|
|
$(error Set NACL_SDK_ROOT environment variable)
|
2012-05-15 20:48:06 +02:00
|
|
|
endif
|
2012-06-04 09:13:33 +02:00
|
|
|
#
|
|
|
|
# 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)
|
2012-05-15 20:48:06 +02:00
|
|
|
|
2012-06-04 23:49:39 +02:00
|
|
|
CFLAGS:=-pthread $(WARNINGS)
|
|
|
|
CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
|
|
|
|
CXX:=$(TC_PATH)/bin/i686-nacl-g++
|
|
|
|
CC:=$(TC_PATH)/bin/i686-nacl-gcc
|
|
|
|
STATICLIB_EXT := a
|
|
|
|
DYNAMICLIB_EXT := nexe
|
|
|
|
LIBRARY_PREFIX := lib
|
2012-06-05 09:30:57 +02:00
|
|
|
LDFLAGS := -lppapi_cpp -lppapi
|
2012-06-04 23:49:39 +02:00
|
|
|
GLOBAL_INCLUDES=-I../zlib/zlib_library -I$(TC_PATH)/i686-nacl/usr/include
|
2012-06-05 09:30:57 +02:00
|
|
|
RT_NOT_SUPPORTED := defined
|
|
|
|
ZLIB_BUILD := defined
|
2012-06-04 09:13:33 +02:00
|
|
|
|
|
|
|
ifeq ($(ARCH),x86)
|
2012-06-05 00:02:43 +02:00
|
|
|
CFLAGS += -m32
|
|
|
|
CXXFLAGS += -m32
|
|
|
|
LDFLAGS += -m32
|
2012-06-04 09:13:33 +02:00
|
|
|
else ifeq ($(ARCH),x64)
|
2012-06-05 00:02:43 +02:00
|
|
|
CFLAGS += -m64
|
|
|
|
CXXFLAGS += -m64
|
|
|
|
LDFLAGS += -m64
|
2012-06-04 09:13:33 +02:00
|
|
|
else
|
|
|
|
$(error Undefined ARCH $(ARCH))
|
|
|
|
endif
|
2012-05-15 20:48:06 +02:00
|
|
|
|
|
|
|
|
2012-06-04 09:13:33 +02:00
|
|
|
else
|
2012-06-04 23:49:39 +02:00
|
|
|
############################################
|
|
|
|
### EVERYTHING ELSE REQUIRES JAVA_HOME #####
|
2012-06-04 09:13:33 +02:00
|
|
|
ifndef JAVA_HOME
|
|
|
|
$(error Set JAVA_HOME environment variable)
|
|
|
|
endif
|
2012-06-04 23:49:39 +02:00
|
|
|
|
2012-05-31 21:01:27 +02:00
|
|
|
ifeq ($(TARGET),)
|
2012-05-15 20:48:06 +02:00
|
|
|
ifeq ($(shell uname),Darwin)
|
2012-05-31 21:01:27 +02:00
|
|
|
TARGET := darwin
|
2012-05-15 20:48:06 +02:00
|
|
|
endif
|
|
|
|
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
2012-05-31 21:01:27 +02:00
|
|
|
TARGET := cygwin
|
2012-05-15 20:48:06 +02:00
|
|
|
endif
|
|
|
|
ifeq ($(findstring MINGW,$(shell uname)),MINGW)
|
2012-05-31 21:01:27 +02:00
|
|
|
TARGET := win
|
2012-05-15 20:48:06 +02:00
|
|
|
endif
|
|
|
|
endif
|
2012-06-04 23:49:39 +02:00
|
|
|
############################################
|
|
|
|
####### DEFAULT LINUX ########## TARGET
|
|
|
|
CXX := g++
|
|
|
|
CC := gcc
|
|
|
|
STRIP := strip
|
|
|
|
STATICLIB_EXT := a
|
|
|
|
DYNAMICLIB_EXT := so
|
|
|
|
LIBRARY_PREFIX := lib
|
|
|
|
LDFLAGS := -shared -Wl,-Bsymbolic
|
|
|
|
|
|
|
|
############################################
|
|
|
|
####### Windows ########## TARGET
|
2012-05-31 21:01:27 +02:00
|
|
|
ifeq ($(TARGET),win)
|
2012-06-04 23:49:39 +02:00
|
|
|
CXX := i586-mingw32msvc-gcc
|
|
|
|
CC := i586-mingw32msvc-gcc
|
|
|
|
STRIP := i586-mingw32msvc-strip
|
|
|
|
WINDRES :=i586-mingw32msvc-windres
|
|
|
|
RANLIB := i586-mingw32msvc-ranlib
|
|
|
|
WINDRES := i586-mingw32msvc-windres
|
|
|
|
AR := i586-mingw32msvc-ar
|
|
|
|
GLOBAL_INCLUDES := -I../pthread/pthreads_library -I../zlib/zlib_library
|
2012-06-05 09:30:57 +02:00
|
|
|
RT_NOT_SUPPORTED := defined
|
|
|
|
ZLIB_BUILD := defined
|
|
|
|
PTHREAD_BUILD := defined
|
2012-06-04 23:49:39 +02:00
|
|
|
COMMONFLAGS := -D_Windows -DXMD_H -DHAVE_BOOLEAN -DRT_NOT_SUPPORTED
|
|
|
|
CPP_FLAGS := $(COMMONFLAGS)
|
|
|
|
CFLAGS := -D_JNI_IMPLEMENTATION $(COMMONFLAGS)
|
|
|
|
STATICLIB_EXT := a
|
|
|
|
DYNAMICLIB_EXT := dll
|
|
|
|
LIBRARY_PREFIX := lib
|
|
|
|
LDFLAGS := -shared -Wl,-Bsymbolic
|
|
|
|
|
|
|
|
else ifeq ($(TARGET),cygwin)
|
|
|
|
############################################
|
|
|
|
####### Cygwin ########## TARGET
|
|
|
|
|
|
|
|
CXX := i686-pc-cygwin-g++
|
|
|
|
CC := i686-pc-cygwin-gcc
|
|
|
|
STRIP := i686-pc-cygwin-strip
|
|
|
|
LDFLAGS := -shared -Wl,--kill-at
|
|
|
|
CFLAGS := -D__int64="long long" -D_JNI_IMPLEMENTATION -D_REENTRANT -D_GNU_SOURCE
|
|
|
|
CXXFLAGS := -D__int64="long long" -D_JNI_IMPLEMENTATION -D_REENTRANT -D_GNU_SOURCE
|
|
|
|
STATICLIB_EXT := lib
|
|
|
|
DYNAMICLIB_EXT := dll
|
|
|
|
LIBRARY_PREFIX := # empty
|
2012-05-15 20:48:06 +02:00
|
|
|
|
2012-06-04 09:13:33 +02:00
|
|
|
endif
|
|
|
|
|
2012-06-04 23:49:39 +02:00
|
|
|
endif
|