97 lines
2.4 KiB
Text
Executable file
97 lines
2.4 KiB
Text
Executable file
# Make default definitions
|
|
ifndef $(ARCH)
|
|
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
|
# Cygwin returns 'unknown'
|
|
ARCH := i386
|
|
else
|
|
ARCH := $(shell uname -i)
|
|
endif
|
|
endif
|
|
|
|
############################################
|
|
############# NACL ### TARGET
|
|
ifeq ($(TARGET),nacl)
|
|
ifndef NACL_SDK_ROOT
|
|
$(error Set NACL_SDK_ROOT environment variable)
|
|
endif
|
|
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
|
NACL_SDK_ROOT := $(shell cygpath -u "$(NACL_SDK_ROOT)")
|
|
endif
|
|
|
|
OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
|
|
NACL_TOOLCHAIN:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
|
|
CXX := $(NACL_TOOLCHAIN)/bin/i686-nacl-g++
|
|
CC := $(NACL_TOOLCHAIN)/bin/i686-nacl-gcc
|
|
AR := $(NACL_TOOLCHAIN)/bin/i686-nacl-ar
|
|
STATICLIB_EXT := a
|
|
DYNAMICLIB_EXT := nexe
|
|
LIBRARY_PREFIX := lib
|
|
LDLIBS += -lppapi_cpp -lppapi
|
|
GLOBAL_INCLUDES := -I../zlib/zlib_library -I$(NACL_TOOLCHAIN)/i686-nacl/usr/include
|
|
ZLIB_BUILD := defined
|
|
CFLAGS := -D__int64="long long"
|
|
CXXFLAGS := -D__int64="long long"
|
|
|
|
else
|
|
############################################
|
|
### EVERYTHING ELSE REQUIRES JAVA_HOME #####
|
|
ifndef JAVA_HOME
|
|
$(error Set JAVA_HOME environment variable)
|
|
endif
|
|
|
|
ifeq ($(TARGET),)
|
|
ifeq ($(shell uname),Darwin)
|
|
TARGET := darwin
|
|
endif
|
|
ifeq ($(shell uname),Linux)
|
|
TARGET := linux
|
|
endif
|
|
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
|
TARGET := windows
|
|
endif
|
|
ifeq ($(findstring MINGW,$(shell uname)),MINGW)
|
|
TARGET := windows
|
|
endif
|
|
endif
|
|
|
|
############################################
|
|
####### Windows via MinGW/Linux and MinGW/Cygwin target
|
|
ifeq ($(TARGET),windows)
|
|
CXX := i686-w64-mingw32-g++
|
|
CC := i686-w64-mingw32-gcc
|
|
AR := i686-w64-mingw32-ar
|
|
GLOBAL_INCLUDES := -I../zlib/zlib_library
|
|
ZLIB_BUILD := defined
|
|
STATICLIB_EXT := lib
|
|
DYNAMICLIB_EXT := dll
|
|
LIBRARY_PREFIX := # empty
|
|
LDFLAGS := -Wl,--kill-at -static-libstdc++ -static-libgcc
|
|
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
|
# Latest MinGW compiler under Cygwin needs this
|
|
CFLAGS := -D__int64="long long"
|
|
CXXFLAGS := -D__int64="long long"
|
|
endif
|
|
############################################
|
|
####### DEFAULT LINUX ########## TARGET
|
|
else
|
|
CXX := g++
|
|
CC := gcc
|
|
STRIP := strip
|
|
STATICLIB_EXT := a
|
|
DYNAMICLIB_EXT := so
|
|
LIBRARY_PREFIX := lib
|
|
endif
|
|
|
|
ifeq ($(ARCH),i386)
|
|
CFLAGS += -m32
|
|
CXXFLAGS += -m32
|
|
LDFLAGS += -m32
|
|
else ifeq ($(ARCH),x86_64)
|
|
CFLAGS += -m64
|
|
CXXFLAGS += -m64
|
|
LDFLAGS += -m64
|
|
else
|
|
$(error Undefined ARCH $(ARCH))
|
|
endif
|
|
|
|
endif
|