corda/makefile

2074 lines
61 KiB
Makefile
Raw Normal View History

2013-01-27 03:07:18 +00:00
MAKEFLAGS = -s
name = avian
2013-07-02 20:39:20 +00:00
version = 0.7
2011-02-26 19:45:22 +00:00
build-arch := $(shell uname -m \
| sed 's/^i.86$$/i386/' \
| sed 's/^x86pc$$/i386/' \
2012-08-02 16:49:32 +00:00
| sed 's/amd64/x86_64/' \
2011-02-26 19:45:22 +00:00
| sed 's/^arm.*$$/arm/' \
| sed 's/ppc/powerpc/')
2009-02-15 19:51:39 +00:00
ifeq (Power,$(filter Power,$(build-arch)))
2008-06-04 22:21:27 +00:00
build-arch = powerpc
endif
2007-06-29 16:42:39 +00:00
build-platform := \
$(shell uname -s | tr [:upper:] [:lower:] \
| sed 's/^mingw32.*$$/mingw32/' \
| sed 's/^cygwin.*$$/cygwin/')
2007-09-21 14:16:43 +00:00
arch = $(build-arch)
target-arch = $(arch)
2009-06-01 18:12:29 +00:00
bootimage-platform = \
$(subst cygwin,windows,$(subst mingw32,windows,$(build-platform)))
platform = $(bootimage-platform)
codegen-targets = native
mode = fast
2008-01-03 19:49:42 +00:00
process = compile
ifneq ($(process),compile)
options := -$(process)
endif
ifneq ($(mode),fast)
options := $(options)-$(mode)
endif
ifneq ($(lzma),)
options := $(options)-lzma
endif
ifeq ($(bootimage),true)
options := $(options)-bootimage
endif
ifeq ($(heapdump),true)
options := $(options)-heapdump
endif
ifeq ($(tails),true)
options := $(options)-tails
endif
ifeq ($(continuations),true)
options := $(options)-continuations
endif
ifeq ($(codegen-targets),all)
options := $(options)-all
endif
aot-only = false
root := $(shell (cd .. && pwd))
build = build/$(platform)-$(arch)$(options)
2013-01-28 17:15:29 +00:00
host-build-root = $(build)/host
classpath-build = $(build)/classpath
test-build = $(build)/test
src = src
classpath-src = classpath
test = test
2013-02-15 03:54:20 +00:00
unittest = unittest
win32 ?= $(root)/win32
win64 ?= $(root)/win64
winrt ?= $(root)/winrt
wp8 ?= $(root)/wp8
classpath = avian
test-executable = $(shell pwd)/$(executable)
boot-classpath = $(classpath-build)
embed-prefix = /avian-embedded
native-path = echo
ifeq ($(build-platform),cygwin)
native-path = cygpath -m
endif
2012-06-02 21:43:42 +00:00
windows-path = echo
path-separator = :
ifneq (,$(filter mingw32 cygwin,$(build-platform)))
path-separator = ;
endif
target-path-separator = :
ifeq ($(platform),windows)
target-path-separator = ;
endif
library-path-variable = LD_LIBRARY_PATH
ifeq ($(build-platform),darwin)
library-path-variable = DYLD_LIBRARY_PATH
endif
library-path = $(library-path-variable)=$(build)
2012-08-01 16:02:55 +00:00
ifneq ($(openjdk),)
openjdk-arch = $(arch)
ifeq ($(arch),x86_64)
openjdk-arch = amd64
endif
ifneq ($(openjdk-src),)
include openjdk-src.mk
options := $(options)-openjdk-src
classpath-objects = $(openjdk-objects) $(openjdk-local-objects)
classpath-cflags = -DAVIAN_OPENJDK_SRC -DBOOT_JAVAHOME
openjdk-jar-dep = $(build)/openjdk-jar.dep
classpath-jar-dep = $(openjdk-jar-dep)
javahome = $(embed-prefix)/javahomeJar
javahome-files = lib/currency.data lib/security/java.security \
lib/security/java.policy lib/security/cacerts
ifneq (,$(wildcard $(openjdk)/jre/lib/zi))
javahome-files += lib/zi
endif
ifneq (,$(wildcard $(openjdk)/jre/lib/tzdb.dat))
javahome-files += lib/tzdb.dat
endif
local-policy = lib/security/local_policy.jar
ifneq (,$(wildcard $(openjdk)/jre/$(local-policy)))
javahome-files += $(local-policy)
endif
export-policy = lib/security/US_export_policy.jar
ifneq (,$(wildcard $(openjdk)/jre/$(export-policy)))
javahome-files += $(export-policy)
endif
ifeq ($(platform),windows)
javahome-files += lib/tzmappings
endif
javahome-object = $(build)/javahome-jar.o
boot-javahome-object = $(build)/boot-javahome.o
2013-03-26 14:30:26 +00:00
stub-sources = $(src)/openjdk/stubs.cpp
stub-objects = $(call cpp-objects,$(stub-sources),$(src),$(build))
else
soname-flag = -Wl,-soname -Wl,$(so-prefix)jvm$(so-suffix)
version-script-flag = -Wl,--version-script=openjdk.ld
options := $(options)-openjdk
test-executable = $(shell pwd)/$(executable-dynamic)
ifeq ($(build-platform),darwin)
library-path = \
$(library-path-variable)=$(build):$(openjdk)/jre/lib
else
library-path = \
$(library-path-variable)=$(build):$(openjdk)/jre/lib/$(openjdk-arch)
endif
javahome = "$$($(native-path) "$(openjdk)/jre")"
endif
2013-01-28 17:15:29 +00:00
classpath = openjdk
boot-classpath := "$(boot-classpath)$(path-separator)$$($(native-path) "$(openjdk)/jre/lib/rt.jar")"
build-javahome = $(openjdk)/jre
endif
ifneq ($(android),)
options := $(options)-android
classpath-jar-dep = $(build)/android.dep
luni-native = $(android)/libcore/luni/src/main/native
classpath-cflags = -DBOOT_JAVAHOME
android-cflags = -I$(luni-native) \
-I$(android)/libnativehelper/include/nativehelper \
-I$(android)/system/core/include \
-I$(android)/external/zlib \
-I$(android)/external/icu4c/i18n \
-I$(android)/external/icu4c/common \
-I$(android)/external/expat \
-I$(android)/external/openssl/include \
-I$(android)/libcore/include \
-I$(build)/android-src/external/fdlibm \
-I$(build)/android-src \
-fno-exceptions \
-D_FILE_OFFSET_BITS=64 \
-DOS_SHARED_LIB_FORMAT_STR="\"$(so-prefix)%s$(so-suffix)\"" \
-DJNI_JARJAR_PREFIX= \
-D__DARWIN_UNIX03=1 \
2014-03-03 20:41:58 +00:00
-D__PROVIDE_FIXMES \
-g3 \
-Werror
luni-cpps := $(shell find $(luni-native) -name '*.cpp')
libnativehelper-native := $(android)/libnativehelper
libnativehelper-cpps := $(libnativehelper-native)/JniConstants.cpp \
$(libnativehelper-native)/toStringArray.cpp
crypto-native := $(android)/libcore/crypto/src/main/native
crypto-cpps := $(crypto-native)/org_conscrypt_NativeCrypto.cpp
2014-03-15 18:21:24 +00:00
ifeq ($(platform),windows)
android-cflags += -D__STDC_CONSTANT_MACROS
blacklist = $(luni-native)/java_io_Console.cpp \
$(luni-native)/java_lang_ProcessManager.cpp \
2014-03-15 18:21:24 +00:00
$(luni-native)/libcore_net_RawSocket.cpp
luni-cpps := $(filter-out $(blacklist),$(luni-cpps))
icu-libs := $(android)/external/icu4c/lib/sicuin.a \
$(android)/external/icu4c/lib/sicuuc.a \
$(android)/external/icu4c/lib/sicudt.a
platform-lflags := -lgdi32
else
android-cflags += -fPIC -DHAVE_SYS_UIO_H
icu-libs := $(android)/external/icu4c/lib/libicui18n.a \
$(android)/external/icu4c/lib/libicuuc.a \
$(android)/external/icu4c/lib/libicudata.a
endif
classpath-lflags := \
$(icu-libs) \
$(android)/external/fdlibm/libfdm.a \
$(android)/external/expat/.libs/libexpat.a \
$(android)/openssl-upstream/libssl.a \
$(android)/openssl-upstream/libcrypto.a \
$(platform-lflags) \
-lstdc++
ifeq ($(platform),linux)
classpath-lflags += -lrt
endif
classpath-objects = \
$(call cpp-objects,$(luni-cpps),$(luni-native),$(build)) \
$(call cpp-objects,$(crypto-cpps),$(crypto-native),$(build)) \
$(call cpp-objects,$(libnativehelper-cpps),$(libnativehelper-native),$(build))
luni-java = $(android)/libcore/luni/src/main/java
luni-javas := $(shell find $(luni-java) -name '*.java')
luni-nonjavas := $(shell find $(luni-java) -not -type d -not -name '*.java')
luni-copied-nonjavas = $(call noop-files,$(luni-nonjavas),$(luni-java),)
libdvm-java = $(android)/libcore/libdvm/src/main/java
libdvm-javas := $(shell find $(libdvm-java) -name '*.java')
crypto-java = $(android)/libcore/crypto/src/main/java
crypto-javas := $(shell find $(crypto-java) -name '*.java')
dalvik-java = $(android)/libcore/dalvik/src/main/java
dalvik-javas := $(shell find $(dalvik-java) -name '*.java')
xml-java = $(android)/libcore/xml/src/main/java
xml-javas := $(shell find $(xml-java) -name '*.java')
android-classes = \
$(call java-classes,$(luni-javas),$(luni-java),$(build)/android) \
$(call java-classes,$(libdvm-javas),$(libdvm-java),$(build)/android) \
$(call java-classes,$(crypto-javas),$(crypto-java),$(build)/android) \
$(call java-classes,$(dalvik-javas),$(dalvik-java),$(build)/android) \
$(call java-classes,$(xml-javas),$(xml-java),$(build)/android)
classpath = android
javahome-files = tzdata
javahome-object = $(build)/javahome-jar.o
boot-javahome-object = $(build)/boot-javahome.o
build-javahome = $(android)/bionic/libc/zoneinfo
stub-sources = $(src)/android/stubs.cpp
stub-objects = $(call cpp-objects,$(stub-sources),$(src),$(build))
endif
ifeq ($(classpath),avian)
jni-sources := $(shell find $(classpath-src) -name '*.cpp')
jni-objects = $(call cpp-objects,$(jni-sources),$(classpath-src),$(build))
classpath-objects = $(jni-objects)
2009-06-04 23:54:06 +00:00
endif
input = List
ifeq ($(use-clang),true)
2013-10-27 14:36:32 +00:00
build-cxx = clang++ -std=c++11
build-cc = clang
else
build-cxx = g++
build-cc = gcc
endif
2007-07-17 01:55:49 +00:00
mflag =
2010-02-05 23:40:48 +00:00
ifneq ($(platform),darwin)
ifeq ($(arch),i386)
mflag = -m32
endif
ifeq ($(arch),x86_64)
mflag = -m64
endif
endif
2010-02-05 23:40:48 +00:00
target-format = elf
cxx = $(build-cxx) $(mflag)
cc = $(build-cc) $(mflag)
ar = ar
ranlib = ranlib
dlltool = dlltool
2008-01-04 02:17:42 +00:00
vg = nice valgrind --num-callers=32 --db-attach=yes --freelist-vol=100000000
vg += --leak-check=full --suppressions=valgrind.supp
db = gdb --args
javac = "$(JAVA_HOME)/bin/javac" -encoding UTF-8
javah = "$(JAVA_HOME)/bin/javah"
jar = "$(JAVA_HOME)/bin/jar"
strip = strip
strip-all = --strip-all
rdynamic = -rdynamic
cflags_debug = -O0 -g3
cflags_debug_fast = -O0 -g3
cflags_stress = -O0 -g3
cflags_stress_major = -O0 -g3
ifeq ($(use-clang),true)
cflags_fast = -O3 -g3
cflags_small = -Oz -g3
else
cflags_fast = -O3 -g3
cflags_small = -Os -g3
endif
# note that we suppress the non-virtual-dtor warning because we never
# use the delete operator, which means we don't need virtual
# destructors:
warnings = -Wall -Wextra -Werror -Wunused-parameter -Winit-self \
-Wno-non-virtual-dtor
target-cflags = -DTARGET_BYTES_PER_WORD=$(pointer-size)
2012-08-01 16:02:55 +00:00
common-cflags = $(warnings) -fno-rtti -fno-exceptions -I$(classpath-src) \
"-I$(JAVA_HOME)/include" -I$(src) -I$(build) -Iinclude $(classpath-cflags) \
-D__STDC_LIMIT_MACROS -D_JNI_IMPLEMENTATION_ -DAVIAN_VERSION=\"$(version)\" \
-DAVIAN_INFO="\"$(info)\"" \
-DUSE_ATOMIC_OPERATIONS -DAVIAN_JAVA_HOME=\"$(javahome)\" \
-DAVIAN_EMBED_PREFIX=\"$(embed-prefix)\" $(target-cflags)
asmflags = $(target-cflags) -I$(src)
2011-01-29 00:05:42 +00:00
ifneq (,$(filter i386 x86_64,$(arch)))
ifeq ($(use-frame-pointer),true)
common-cflags += -fno-omit-frame-pointer -DAVIAN_USE_FRAME_POINTER
asmflags += -DAVIAN_USE_FRAME_POINTER
endif
endif
2007-10-26 14:34:54 +00:00
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \
"-I$(JAVA_HOME)/include/linux" -I$(src) -pthread
2007-10-26 14:34:54 +00:00
converter-cflags = -D__STDC_CONSTANT_MACROS -Iinclude/ -Isrc/ \
-fno-rtti -fno-exceptions \
-DAVIAN_TARGET_ARCH=AVIAN_ARCH_UNKNOWN \
-DAVIAN_TARGET_FORMAT=AVIAN_FORMAT_UNKNOWN \
2012-06-03 00:56:07 +00:00
-Wall -Wextra -Werror -Wunused-parameter -Winit-self -Wno-non-virtual-dtor
2010-11-23 22:54:35 +00:00
2007-10-26 14:34:54 +00:00
cflags = $(build-cflags)
common-lflags = -lm -lz
2007-10-26 21:02:39 +00:00
2013-10-27 14:36:32 +00:00
ifeq ($(use-clang),true)
ifeq ($(build-platform),darwin)
common-lflags += -Wl,-export_dynamic
else
ifneq ($(platform),windows)
common-lflags += -Wl,-E
else
common-lflags += -Wl,--export-all-symbols
endif
endif
endif
build-lflags = -lz -lpthread -ldl
lflags = $(common-lflags) -lpthread -ldl
2007-10-26 14:34:54 +00:00
build-system = posix
system = posix
2007-10-23 01:00:57 +00:00
asm = x86
2007-10-26 21:02:39 +00:00
pointer-size = 8
so-prefix = lib
so-suffix = .so
static-prefix = lib
static-suffix = .a
output = -o $(1)
asm-output = -o $(1)
asm-input = -c $(1)
asm-format = S
as = $(cc)
ld = $(cc)
build-ld = $(build-cc)
default-remote-test-host = localhost
default-remote-test-port = 22
ifeq ($(remote-test-host),)
remote-test-host = $(default-remote-test-host)
else
remote-test = true
endif
ifeq ($(remote-test-port),)
remote-test-port = $(default-remote-test-port)
else
remote-test = true
endif
remote-test-user = ${USER}
remote-test-dir = /tmp/avian-test-${USER}
static = -static
shared = -shared
rpath = -Wl,-rpath=\$$ORIGIN -Wl,-z,origin
2012-06-04 15:51:11 +00:00
no-error = -Wno-error
2010-11-15 23:27:00 +00:00
openjdk-extra-cflags = -fvisibility=hidden
bootimage-cflags = -DTARGET_BYTES_PER_WORD=$(pointer-size)
bootimage-symbols = _binary_bootimage_bin_start:_binary_bootimage_bin_end
codeimage-symbols = _binary_codeimage_bin_start:_binary_codeimage_bin_end
2013-09-04 03:03:29 +00:00
developer-dir := $(shell if test -d /Developer/Platforms/$(target).platform/Developer/SDKs; then echo /Developer; \
2012-03-07 15:55:01 +00:00
else echo /Applications/Xcode.app/Contents/Developer; fi)
ifeq ($(build-arch),powerpc)
ifneq ($(arch),$(build-arch))
bootimage-cflags += -DTARGET_OPPOSITE_ENDIAN
endif
endif
ifeq ($(arch),i386)
pointer-size = 4
endif
2008-06-04 22:21:27 +00:00
ifeq ($(arch),powerpc)
asm = powerpc
pointer-size = 4
2011-02-28 05:54:59 +00:00
ifneq ($(arch),$(build-arch))
bootimage-cflags += -DTARGET_OPPOSITE_ENDIAN
endif
2011-03-01 19:20:23 +00:00
ifneq ($(platform),darwin)
ifneq ($(arch),$(build-arch))
cxx = powerpc-linux-gnu-g++
cc = powerpc-linux-gnu-gcc
ar = powerpc-linux-gnu-ar
ranlib = powerpc-linux-gnu-ranlib
strip = powerpc-linux-gnu-strip
endif
2011-02-28 05:54:59 +00:00
endif
2008-06-04 22:21:27 +00:00
endif
2009-08-06 19:25:20 +00:00
ifeq ($(arch),arm)
2010-11-09 03:48:08 +00:00
asm = arm
pointer-size = 4
ifeq ($(build-platform),darwin)
ios = true
else
no-psabi = -Wno-psabi
cflags += -marm $(no-psabi)
endif
2010-11-09 18:28:58 +00:00
ifneq ($(arch),$(build-arch))
ifneq ($(platform),darwin)
cxx = arm-linux-gnueabi-g++
cc = arm-linux-gnueabi-gcc
ar = arm-linux-gnueabi-ar
ranlib = arm-linux-gnueabi-ranlib
strip = arm-linux-gnueabi-strip
endif
2010-11-09 18:28:58 +00:00
endif
2009-08-06 19:25:20 +00:00
endif
ifneq ($(platform),darwin)
# By default, assume we can't use armv7-specific instructions on
# non-iOS platforms. Ideally, we'd detect this at runtime.
armv6=true
endif
ifeq ($(armv6),true)
cflags += -DAVIAN_ASSUME_ARMV6
endif
ifeq ($(ios),true)
cflags += -DAVIAN_IOS
use-lto = false
endif
ifeq ($(build-platform),darwin)
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden -I$(src)
2013-11-05 00:26:57 +00:00
cflags += -Wno-deprecated-declarations
build-lflags += -framework CoreFoundation
endif
ifeq ($(platform),qnx)
cflags = $(common-cflags) -fPIC -fvisibility=hidden -I$(src)
lflags = $(common-lflags) -lsocket
ifeq ($(build-platform),qnx)
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden -I$(src)
build-lflags = $(common-lflags)
else
ifeq ($(arch),i386)
prefix = i486-pc-nto-qnx6.5.0-
else
prefix = arm-unknown-nto-qnx6.5.0-
endif
endif
cxx = $(prefix)g++
cc = $(prefix)gcc
ar = $(prefix)ar
ranlib = $(prefix)ranlib
strip = $(prefix)strip
rdynamic = -Wl,--export-dynamic
endif
2012-08-02 16:36:16 +00:00
ifeq ($(platform),freebsd)
# There is no -ldl on FreeBSD
build-lflags = $(common-lflags) -lz -lpthread
lflags = $(common-lflags) -lpthread
# include/freebsd instead of include/linux
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \
"-I$(JAVA_HOME)/include/freebsd" -I$(src) -pthread
cflags = $(build-cflags)
endif
2013-01-23 23:55:23 +00:00
ifeq ($(platform),android)
ifeq ($(build-platform),cygwin)
2013-01-24 14:17:52 +00:00
ndk = "$$(cygpath -u "$(ANDROID_NDK)")"
else
ndk = $(ANDROID_NDK)
endif
ifeq ($(android-version),)
android-version = 5
endif
ifeq ($(android-toolchain),)
android-toolchain = 4.7
endif
ifeq ($(arch),arm)
android-toolchain-name = arm-linux-androideabi
android-toolchain-prefix = arm-linux-androideabi-
endif
ifeq ($(arch),i386)
android-toolchain-name = x86
android-toolchain-prefix = i686-linux-android-
endif
ifeq ($(android-arm-arch),)
android-arm-arch = armv5
endif
options := $(options)-api$(android-version)-$(android-toolchain)-$(android-arm-arch)
2013-01-24 14:17:52 +00:00
build-cflags = $(common-cflags) -I$(src)
build-lflags = -lz -lpthread
2013-01-24 14:17:52 +00:00
ifeq ($(subst cygwin,windows,$(subst mingw32,windows,$(build-platform))),windows)
toolchain-host-platform = $(subst cygwin,windows,$(subst mingw32,windows,$(build-platform)))
build-system = windows
build-cxx = i686-w64-mingw32-g++
build-cc = i686-w64-mingw32-gcc
sysroot = "$$(cygpath -w "$(ndk)/platforms/android-$(android-version)/arch-arm")"
2013-01-24 14:17:52 +00:00
build-cflags += "-I$(JAVA_HOME)/include/win32"
else
2013-01-24 14:39:14 +00:00
toolchain-host-platform = $(subst cygwin,windows,$(subst mingw32,windows,$(build-platform)))-*
sysroot = $(ndk)/platforms/android-$(android-version)/arch-arm
2013-01-24 14:17:52 +00:00
build-cflags += "-I$(JAVA_HOME)/include/linux"
build-lflags += -ldl
2013-01-24 14:17:52 +00:00
endif
toolchain = $(ndk)/toolchains/$(android-toolchain-name)-$(android-toolchain)/prebuilt/$(toolchain-host-platform)
cflags = "-I$(sysroot)/usr/include" "-I$(JAVA_HOME)/include/linux" $(common-cflags) "-I$(src)" -std=c++11 $(no-psabi)
lflags = "-L$(sysroot)/usr/lib" $(common-lflags) -llog
target-format = elf
2013-01-24 14:17:52 +00:00
use-lto = false
ifeq ($(arch),arm)
cflags += -marm -march=$(android-arm-arch) -ftree-vectorize -ffast-math -mfloat-abi=softfp
endif
ifeq ($(arch),i386)
endif
cxx = $(toolchain)/bin/$(android-toolchain-prefix)g++ --sysroot="$(sysroot)"
cc = $(toolchain)/bin/$(android-toolchain-prefix)gcc --sysroot="$(sysroot)"
as = $(cxx)
ar = $(toolchain)/bin/$(android-toolchain-prefix)ar
ranlib = $(toolchain)/bin/$(android-toolchain-prefix)ranlib
strip = $(toolchain)/bin/$(android-toolchain-prefix)strip
2013-01-23 23:55:23 +00:00
endif
2012-08-02 16:36:16 +00:00
ifeq ($(platform),darwin)
target-format = macho
ifeq (${OSX_SDK_SYSROOT},)
OSX_SDK_SYSROOT = 10.4u
endif
ifeq (${OSX_SDK_VERSION},)
OSX_SDK_VERSION = 10.4
endif
ifneq ($(build-platform),darwin)
cxx = i686-apple-darwin8-g++ $(mflag)
cc = i686-apple-darwin8-gcc $(mflag)
ar = i686-apple-darwin8-ar
ranlib = i686-apple-darwin8-ranlib
strip = i686-apple-darwin8-strip
2011-05-26 17:57:30 +00:00
sysroot = /opt/mac/SDKs/MacOSX${OSX_SDK_SYSROOT}.sdk
cflags = -I$(sysroot)/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Headers/ \
$(common-cflags) -fPIC -fvisibility=hidden -I$(src)
endif
ifneq ($(ios),true)
platform-dir = $(developer-dir)/Platforms/MacOSX.platform
sdk-dir = $(platform-dir)/Developer/SDKs
mac-version := $(shell \
if test -d $(sdk-dir)/MacOSX10.9.sdk; then echo 10.9; \
elif test -d $(sdk-dir)/MacOSX10.8.sdk; then echo 10.8; \
elif test -d $(sdk-dir)/MacOSX10.7.sdk; then echo 10.7; \
elif test -d $(sdk-dir)/MacOSX10.6.sdk; then echo 10.6; \
else echo; fi)
sysroot = $(sdk-dir)/MacOSX$(mac-version).sdk
endif
soname-flag =
2010-11-08 04:23:25 +00:00
version-script-flag =
2012-06-04 15:52:06 +00:00
lflags = $(common-lflags) -ldl -framework CoreFoundation
2012-06-06 18:58:24 +00:00
ifeq (,$(shell ld -v 2>&1 | grep cctools))
2012-06-04 15:52:06 +00:00
lflags += -Wl,-compatibility_version,1.0.0
endif
ifneq ($(arch),arm)
2012-03-11 22:26:46 +00:00
lflags += -framework CoreServices -framework SystemConfiguration \
-framework Security
endif
2008-12-19 02:52:03 +00:00
ifeq ($(bootimage),true)
bootimage-lflags = -Wl,-segprot,__RWX,rwx,rwx
2008-12-19 02:52:03 +00:00
endif
2008-03-31 04:23:51 +00:00
rdynamic =
2007-11-01 20:37:51 +00:00
strip-all = -S -x
so-suffix = .dylib
shared = -dynamiclib
rpath =
ifeq ($(ios),true)
ifeq ($(arch),i386)
target = iPhoneSimulator
sdk = iphonesimulator$(ios-version)
arch = i386
arch-flag = -arch i386
release = Release-iphonesimulator
else
target = iPhoneOS
sdk = iphoneos$(ios-version)
arch = arm
arch-flag = -arch armv7
release = Release-iphoneos
endif
platform-dir = $(developer-dir)/Platforms/$(target).platform
sdk-dir = $(platform-dir)/Developer/SDKs
ios-version := $(shell \
if test -d $(sdk-dir)/$(target)7.0.sdk; then echo 7.0; \
elif test -d $(sdk-dir)/$(target)6.1.sdk; then echo 6.1; \
elif test -d $(sdk-dir)/$(target)6.0.sdk; then echo 6.0; \
elif test -d $(sdk-dir)/$(target)5.1.sdk; then echo 5.1; \
elif test -d $(sdk-dir)/$(target)5.0.sdk; then echo 5.0; \
elif test -d $(sdk-dir)/$(target)4.3.sdk; then echo 4.3; \
elif test -d $(sdk-dir)/$(target)4.2.sdk; then echo 4.2; \
else echo; fi)
ifeq ($(ios-version),)
x := $(error "couldn't find SDK")
endif
ios-bin = $(platform-dir)/Developer/usr/bin
found-gcc = $(shell if test -f $(ios-bin)/gcc; then echo true; else echo false; fi)
ifeq ($(found-gcc),false)
use-clang = true
endif
ifeq ($(use-clang),true)
cxx = clang -std=c++11
cc = clang
else
cxx = $(ios-bin)/g++
cc = $(ios-bin)/gcc
endif
ar = $(ios-bin)/ar
ranlib = $(ios-bin)/ranlib
strip = $(ios-bin)/strip
flags = -isysroot $(sdk-dir)/$(target)$(ios-version).sdk \
$(arch-flag)
classpath-extra-cflags += $(flags)
cflags += $(flags)
asmflags += $(flags)
lflags += $(flags)
endif
ifeq ($(arch),powerpc)
classpath-extra-cflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION}
2011-05-26 17:57:30 +00:00
cflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION}
asmflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION}
lflags += -arch ppc -mmacosx-version-min=${OSX_SDK_VERSION}
endif
ifeq ($(arch),i386)
classpath-extra-cflags += \
-arch i386 -mmacosx-version-min=${OSX_SDK_VERSION}
2011-05-26 17:57:30 +00:00
cflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION}
asmflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION}
lflags += -arch i386 -mmacosx-version-min=${OSX_SDK_VERSION}
endif
2009-12-01 21:24:33 +00:00
ifeq ($(arch),x86_64)
classpath-extra-cflags += -arch x86_64
2009-12-01 21:24:33 +00:00
cflags += -arch x86_64
asmflags += -arch x86_64
lflags += -arch x86_64
endif
2013-11-05 00:26:57 +00:00
cflags += -I$(JAVA_HOME)/include/darwin
endif
2007-10-26 21:02:39 +00:00
openjdk-extra-cflags += $(classpath-extra-cflags)
find-tool = $(shell if ( command -v "$(1)$(2)" >/dev/null ); then (echo "$(1)$(2)") else (echo "$(2)"); fi)
ifeq ($(platform),windows)
target-format = pe
inc = "$(win32)/include"
lib = "$(win32)/lib"
embed-prefix = c:/avian-embedded
system = windows
so-prefix =
so-suffix = .dll
exe-suffix = .exe
rpath =
lflags = -L$(lib) $(common-lflags) -lws2_32 -liphlpapi -mconsole
cflags = -I$(inc) $(common-cflags) -DWINVER=0x0500
2011-09-30 21:21:12 +00:00
ifeq (,$(filter mingw32 cygwin,$(build-platform)))
2010-11-15 23:27:00 +00:00
openjdk-extra-cflags += -I$(src)/openjdk/caseSensitive
prefix := $(shell i686-w64-mingw32-gcc --version >/dev/null 2>&1 \
&& echo i686-w64-mingw32- || echo x86_64-w64-mingw32-)
cxx = $(prefix)g++ -m32
cc = $(prefix)gcc -m32
dlltool = $(prefix)dlltool -mi386 --as-flags=--32
ar = $(prefix)ar
ranlib = $(prefix)ranlib
strip = $(prefix)strip --strip-all
else
2010-11-12 23:53:16 +00:00
build-system = windows
2009-02-14 00:03:46 +00:00
common-cflags += "-I$(JAVA_HOME)/include/win32"
2010-11-13 02:04:17 +00:00
build-cflags = $(common-cflags) -I$(src) -I$(inc) -mthreads
2010-11-15 23:27:00 +00:00
openjdk-extra-cflags =
2010-11-13 02:04:17 +00:00
build-lflags = -L$(lib) $(common-lflags)
ifeq ($(build-platform),cygwin)
build-cxx = i686-w64-mingw32-g++
build-cc = i686-w64-mingw32-gcc
dlltool = i686-w64-mingw32-dlltool
ar = i686-w64-mingw32-ar
ranlib = i686-w64-mingw32-ranlib
strip = i686-w64-mingw32-strip
endif
endif
2009-06-11 15:36:53 +00:00
ifeq ($(arch),x86_64)
ifeq ($(build-platform),cygwin)
build-cxx = x86_64-w64-mingw32-g++
build-cc = x86_64-w64-mingw32-gcc
endif
cxx = x86_64-w64-mingw32-g++ $(mflag)
cc = x86_64-w64-mingw32-gcc $(mflag)
dlltool = $(call find-tool,x86_64-w64-mingw32-,dlltool)
ar = $(call find-tool,x86_64-w64-mingw32-,ar)
ranlib = $(call find-tool,x86_64-w64-mingw32-,ranlib)
strip = $(call find-tool,x86_64-w64-mingw32-,strip)
inc = "$(win64)/include"
lib = "$(win64)/lib"
2012-03-18 00:47:22 +00:00
else
shared += -Wl,--add-stdcall-alias
2009-06-11 15:36:53 +00:00
endif
2012-12-05 00:37:02 +00:00
embed = $(build-embed)/embed$(exe-suffix)
embed-loader = $(build-embed-loader)/embed-loader$(exe-suffix)
2012-11-13 08:11:49 +00:00
embed-loader-o = $(build-embed)/embed-loader.o
endif
ifeq ($(platform),wp8)
ifeq ($(shell uname -s | grep -i -c WOW64),1)
programFiles = Program Files (x86)
2012-06-03 00:56:07 +00:00
else
programFiles = Program Files
2012-06-03 00:56:07 +00:00
endif
ifeq ($(MSVS_ROOT),)
# Environment variable MSVS_ROOT not found. It should be something like
# "C:\$(programFiles)\Microsoft Visual Studio 11.0"
MSVS_ROOT = C:\$(programFiles)\Microsoft Visual Studio 11.0
endif
ifeq ($(MSVC_ROOT),)
# Environment variable MSVC_ROOT not found. It should be something like
# "C:\$(programFiles)\Microsoft Visual Studio 11.0\VC"
MSVC_ROOT = $(MSVS_ROOT)\VC
endif
ifeq ($(WP80_SDK),)
# Environment variable WP8_SDK not found. It should be something like
# "C:\Program Files[ (x86)]\Microsoft Visual Studio 11.0\VC\WPSDK\WP80"
# TODO: Lookup in SOFTWARE\Microsoft\Microsoft SDKs\WindowsPhone\v8.0
2013-01-29 12:21:02 +00:00
WP80_SDK = $(MSVS_ROOT)\VC\WPSDK\WP80
endif
ifeq ($(WP80_KIT),)
# Environment variable WP8_KIT not found. It should be something like
# "c:\Program Files[ (x86)]\Windows Phone Kits\8.0"
# TODO: Lookup in SOFTWARE\Microsoft\Microsoft SDKs\WindowsPhone\v8.0
WP80_KIT = C:\$(programFiles)\Windows Phone Kits\8.0
endif
ifeq ($(WIN8_KIT),)
# Environment variable WIN8_KIT not found. It should be something like
# "c:\Program Files[ (x86)]\Windows Kits\8.0"
WIN8_KIT = C:\$(programFiles)\Windows Kits\8.0
endif
ifeq ($(build-platform),cygwin)
windows-path = cygpath -w
else
windows-path = $(native-path)
endif
windows-java-home := $(shell $(windows-path) "$(JAVA_HOME)")
target-format = pe
ms_cl_compiler = wp8
use-lto = false
supports_avian_executable = false
aot-only = true
2013-02-09 11:09:58 +00:00
ifneq ($(bootimage),true)
2013-02-09 11:18:39 +00:00
x := $(error Windows Phone 8 target requires bootimage=true)
endif
system = windows
build-system = windows
static-prefix =
static-suffix = .lib
so-prefix =
so-suffix = .dll
exe-suffix = .exe
manifest-flags = -MANIFEST:NO
ifeq ($(arch),arm)
wp8_arch = \x86_arm
vc_arch = \arm
w8kit_arch = arm
deps_arch = ARM
as = "$$(cygpath -u "$(WP80_SDK)\bin\x86_arm\armasm.exe")"
cxx = "$$(cygpath -u "$(WP80_SDK)\bin\x86_arm\cl.exe")"
ld = "$$(cygpath -u "$(WP80_SDK)\bin\x86_arm\link.exe")"
2013-01-31 10:54:51 +00:00
asmflags = -machine ARM -32
asm-output = -o $(1)
asm-input = $(1)
machine_type = ARM
2013-01-31 10:54:51 +00:00
bootimage-symbols = binary_bootimage_bin_start:binary_bootimage_bin_end
codeimage-symbols = binary_codeimage_bin_start:binary_codeimage_bin_end
endif
ifeq ($(arch),i386)
wp8_arch =
vc_arch =
w8kit_arch = x86
deps_arch = x86
asmflags = $(target-cflags) -safeseh -nologo -Gd
as = "$$(cygpath -u "$(WP80_SDK)\bin\ml.exe")"
cxx = "$$(cygpath -u "$(WP80_SDK)\bin\cl.exe")"
ld = "$$(cygpath -u "$(WP80_SDK)\bin\link.exe")"
ifeq ($(mode),debug)
asmflags += -Zd
endif
ifeq ($(mode),debug-fast)
asmflags += -Zd
endif
asm-output = $(output)
machine_type = X86
endif
PATH := $(shell cygpath -u "$(MSVS_ROOT)\Common7\IDE"):$(shell cygpath -u "$(WP80_SDK)\bin$(wp8_arch)"):$(shell cygpath -u "$(WP80_SDK)\bin"):${PATH}
build-cflags = $(common-cflags) -I$(src) -I$(inc) -mthreads
build-lflags = -lz -lpthread
cflags = -nologo \
-AI"$(WP80_KIT)\Windows Metadata" \
-I"$(WP80_SDK)\include" -I"$(WP80_KIT)\Include" -I"$(WP80_KIT)\Include\minwin" -I"$(WP80_KIT)\Include\mincore" \
-DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP -D_USRDLL -D_WINDLL \
-DAVIAN_VERSION=\"$(version)\" -D_JNI_IMPLEMENTATION_ \
-DUSE_ATOMIC_OPERATIONS -DAVIAN_JAVA_HOME=\"$(javahome)\" \
-DAVIAN_EMBED_PREFIX=\"$(embed-prefix)\" \
2013-02-02 07:38:03 +00:00
-I"$(shell $(windows-path) "$(wp8)/zlib/upstream")" -I"$(shell $(windows-path) "$(wp8)/interop/avian-interop-client")" \
-I"$(shell $(windows-path) "$(wp8)/include")" -I$(src) -I$(classpath-src) \
-I"$(build)" \
-I"$(windows-java-home)/include" -I"$(windows-java-home)/include/win32" \
-DTARGET_BYTES_PER_WORD=$(pointer-size) \
2013-02-02 07:38:03 +00:00
-Gd -EHsc
common-lflags =
ifeq ($(mode),debug)
build-type = Debug
endif
ifeq ($(mode),debug-fast)
build-type = Debug
endif
ifeq ($(mode),stress_major)
build-type = Release
endif
ifeq ($(mode),fast)
build-type = Release
endif
ifeq ($(mode),fast)
build-type = Release
endif
ifeq ($(mode),small)
build-type = Release
endif
arflags = -MACHINE:$(machine_type)
lflags = $(common-lflags) -nologo \
-MACHINE:$(machine_type) \
-LIBPATH:"$(WP80_KIT)\lib\$(w8kit_arch)" -LIBPATH:"$(WP80_SDK)\lib$(vc_arch)" -LIBPATH:"$(WIN8_KIT)\Lib\win8\um\$(w8kit_arch)" \
ws2_32.lib \
2013-02-02 07:38:03 +00:00
"$(shell $(windows-path) "$(wp8)\lib\$(deps_arch)\$(build-type)\zlib.lib")" "$(shell $(windows-path) "$(wp8)\lib\$(deps_arch)\$(build-type)\ThreadEmulation.lib")" \
"$(shell $(windows-path) "$(wp8)\lib\$(deps_arch)\$(build-type)\AvianInteropClient.lib")"
lflags += -NXCOMPAT -DYNAMICBASE -SUBSYSTEM:CONSOLE -TLBID:1
lflags += -NODEFAULTLIB:"ole32.lib" -NODEFAULTLIB:"kernel32.lib"
lflags += PhoneAppModelHost.lib WindowsPhoneCore.lib -WINMD -WINMDFILE:$(subst $(so-suffix),.winmd,$(@))
cc = $(cxx)
asm-format = masm
shared = -dll
ar = "$$(cygpath -u "$(WP80_SDK)\bin\lib.exe")"
arflags += -nologo
ifeq ($(build-platform),cygwin)
build-cxx = i686-w64-mingw32-g++
build-cc = i686-w64-mingw32-gcc
dlltool = i686-w64-mingw32-dlltool
ranlib =
strip =
endif
output = -Fo$(1)
#TODO: -MT or -ZW?
cflags_debug = -Od -Zi -MDd
cflags_debug_fast = -Od -Zi -MDd
cflags_stress = -O0 -g3 -MD
cflags_stress_major = -O0 -g3 -MD
cflags_fast = -O2 -Zi -MD
cflags_small = -O1s -Zi -MD
# -GL [whole program optimization] in 'fast' and 'small' breaks compilation for some reason
ifeq ($(mode),debug)
cflags +=
lflags +=
endif
ifeq ($(mode),debug-fast)
cflags += -DNDEBUG
lflags +=
endif
ifeq ($(mode),stress_major)
cflags +=
lflags +=
endif
ifeq ($(mode),fast)
cflags +=
lflags +=
endif
# -LTCG is needed only if -GL is used
ifeq ($(mode),fast)
cflags += -DNDEBUG
lflags += -LTCG
arflags +=
endif
ifeq ($(mode),small)
cflags += -DNDEBUG
lflags += -LTCG
arflags +=
endif
strip = :
endif
2012-12-05 22:30:49 +00:00
ifdef msvc
2012-06-04 15:51:11 +00:00
no-error =
2013-03-04 18:09:59 +00:00
target-format = pe
2012-06-02 21:43:42 +00:00
windows-path = $(native-path)
windows-java-home := $(shell $(windows-path) "$(JAVA_HOME)")
zlib := $(shell $(windows-path) "$(win32)/msvc")
ms_cl_compiler = regular
2013-03-04 18:09:59 +00:00
as = $(build-cc)
cxx = "$(msvc)/BIN/cl.exe"
cc = $(cxx)
ld = "$(msvc)/BIN/link.exe"
mt = "mt.exe"
2013-03-04 18:09:59 +00:00
ar = "$(msvc)/BIN/lib.exe"
manifest-flags = -MANIFEST -MANIFESTFILE:$(@).manifest
cflags = -nologo -DAVIAN_VERSION=\"$(version)\" -D_JNI_IMPLEMENTATION_ \
2011-01-21 23:14:21 +00:00
-DUSE_ATOMIC_OPERATIONS -DAVIAN_JAVA_HOME=\"$(javahome)\" \
-DAVIAN_EMBED_PREFIX=\"$(embed-prefix)\" \
2012-08-15 23:42:31 +00:00
-Fd$(build)/$(name).pdb -I"$(zlib)/include" -I$(src) -I$(classpath-src) \
2013-03-04 18:09:59 +00:00
-I"$(build)" -Iinclude \
2012-02-17 01:22:11 +00:00
-I"$(windows-java-home)/include" -I"$(windows-java-home)/include/win32" \
-DTARGET_BYTES_PER_WORD=$(pointer-size)
2012-06-02 21:43:42 +00:00
ifneq ($(lzma),)
2012-06-02 21:43:42 +00:00
cflags += -I$(shell $(windows-path) "$(lzma)")
endif
shared = -dll
lflags = -nologo -LIBPATH:"$(zlib)/lib" -DEFAULTLIB:ws2_32 \
2012-12-05 22:30:49 +00:00
-DEFAULTLIB:zlib -DEFAULTLIB:user32 -MANIFEST -debug
2009-08-27 15:30:34 +00:00
output = -Fo$(1)
2013-03-04 18:09:59 +00:00
cflags_debug = -Od -Zi -MDd
cflags_debug_fast = -Od -Zi -DNDEBUG
cflags_fast = -O2 -GL -Zi -DNDEBUG
cflags_small = -O1s -Zi -GL -DNDEBUG
ifeq ($(mode),fast)
lflags += -LTCG
endif
ifeq ($(mode),small)
lflags += -LTCG
endif
2013-03-04 18:09:59 +00:00
use-lto = false
strip = :
endif
ifeq ($(mode),debug)
optimization-cflags = $(cflags_debug)
converter-cflags += $(cflags_debug)
strip = :
endif
2008-01-12 00:15:34 +00:00
ifeq ($(mode),debug-fast)
optimization-cflags = $(cflags_debug_fast) -DNDEBUG
strip = :
2008-01-12 00:15:34 +00:00
endif
ifeq ($(mode),stress)
optimization-cflags = $(cflags_stress) -DVM_STRESS
strip = :
endif
ifeq ($(mode),stress-major)
optimization-cflags = $(cflags_stress_major) -DVM_STRESS -DVM_STRESS_MAJOR
strip = :
endif
ifeq ($(mode),fast)
optimization-cflags = $(cflags_fast) -DNDEBUG
endif
ifeq ($(mode),small)
optimization-cflags = $(cflags_small) -DNDEBUG
endif
ifeq ($(use-lto),true)
ifeq ($(use-clang),true)
optimization-cflags += -flto
lflags += $(optimization-cflags)
else
# only try to use LTO when GCC 4.6.0 or greater is available
gcc-major := $(shell $(cc) -dumpversion | cut -f1 -d.)
gcc-minor := $(shell $(cc) -dumpversion | cut -f2 -d.)
ifeq ($(shell expr 4 \< $(gcc-major) \
\| \( 4 \<= $(gcc-major) \& 6 \<= $(gcc-minor) \)),1)
optimization-cflags += -flto
no-lto = -fno-lto
lflags += $(optimization-cflags)
endif
endif
endif
cflags += $(optimization-cflags)
ifndef ms_cl_compiler
ifneq ($(platform),darwin)
ifeq ($(arch),i386)
# this is necessary to support __sync_bool_compare_and_swap:
cflags += -march=i586
lflags += -march=i586
endif
endif
endif
2012-12-05 22:30:49 +00:00
c-objects = $(foreach x,$(1),$(patsubst $(2)/%.c,$(3)/%.o,$(x)))
cpp-objects = $(foreach x,$(1),$(patsubst $(2)/%.cpp,$(3)/%.o,$(x)))
asm-objects = $(foreach x,$(1),$(patsubst $(2)/%.$(asm-format),$(3)/%-asm.o,$(x)))
java-classes = $(foreach x,$(1),$(patsubst $(2)/%.java,$(3)/%.class,$(x)))
noop-files = $(foreach x,$(1),$(patsubst $(2)/%,$(3)/%,$(x)))
generated-code = \
$(build)/type-enums.cpp \
$(build)/type-declarations.cpp \
$(build)/type-constructors.cpp \
$(build)/type-initializations.cpp \
$(build)/type-java-initializations.cpp \
$(build)/type-name-initializations.cpp \
$(build)/type-maps.cpp
2007-07-06 23:50:26 +00:00
vm-depends := $(generated-code) \
$(shell find src include -name '*.h' -or -name '*.inc.cpp')
2007-07-06 23:50:26 +00:00
vm-sources = \
$(src)/system/$(system).cpp \
2014-02-22 00:06:17 +00:00
$(src)/system/$(system)/signal.cpp \
$(src)/finder.cpp \
2007-07-06 23:50:26 +00:00
$(src)/machine.cpp \
2007-11-26 23:15:53 +00:00
$(src)/util.cpp \
2013-02-15 14:35:17 +00:00
$(src)/heap/heap.cpp \
2007-09-25 23:53:11 +00:00
$(src)/$(process).cpp \
$(src)/classpath-$(classpath).cpp \
$(src)/builtin.cpp \
$(src)/jnienv.cpp \
$(src)/process.cpp
2007-06-29 02:58:48 +00:00
vm-asm-sources = $(src)/$(asm).$(asm-format)
target-asm = $(asm)
2012-11-13 08:11:49 +00:00
build-embed = $(build)/embed
build-embed-loader = $(build)/embed-loader
2013-04-02 08:37:20 +00:00
embed-loader-sources = $(src)/embedded-loader.cpp
2012-11-13 08:11:49 +00:00
embed-loader-objects = $(call cpp-objects,$(embed-loader-sources),$(src),$(build-embed-loader))
embed-sources = $(src)/embed.cpp
embed-objects = $(call cpp-objects,$(embed-sources),$(src),$(build-embed))
compiler-sources = \
$(src)/codegen/compiler.cpp \
2013-02-17 02:50:34 +00:00
$(wildcard $(src)/codegen/compiler/*.cpp) \
$(src)/codegen/registers.cpp \
$(src)/codegen/runtime.cpp \
2014-02-25 22:15:37 +00:00
$(src)/codegen/targets.cpp \
$(src)/util/fixed-allocator.cpp
2013-02-17 02:50:34 +00:00
x86-assembler-sources = $(wildcard $(src)/codegen/target/x86/*.cpp)
2013-02-17 02:50:34 +00:00
arm-assembler-sources = $(wildcard $(src)/codegen/target/arm/*.cpp)
2013-02-17 02:50:34 +00:00
powerpc-assembler-sources = $(wildcard $(src)/codegen/target/powerpc/*.cpp)
all-assembler-sources = \
2013-02-17 02:50:34 +00:00
$(x86-assembler-sources) \
$(arm-assembler-sources) \
$(powerpc-assembler-sources)
2013-02-17 02:50:34 +00:00
native-assembler-sources = $($(target-asm)-assembler-sources)
all-codegen-target-sources = \
$(compiler-sources) \
$(native-assembler-sources)
ifeq ($(process),compile)
vm-sources += $(compiler-sources)
ifeq ($(codegen-targets),native)
vm-sources += $(native-assembler-sources)
endif
ifeq ($(codegen-targets),all)
vm-sources += $(all-assembler-sources)
endif
2007-12-09 22:45:43 +00:00
vm-asm-sources += $(src)/compile-$(asm).$(asm-format)
endif
cflags += -DAVIAN_PROCESS_$(process)
ifeq ($(aot-only),true)
2013-01-28 17:15:29 +00:00
cflags += -DAVIAN_AOT_ONLY
endif
2007-06-29 02:58:48 +00:00
vm-cpp-objects = $(call cpp-objects,$(vm-sources),$(src),$(build))
all-codegen-target-objects = $(call cpp-objects,$(all-codegen-target-sources),$(src),$(build))
vm-asm-objects = $(call asm-objects,$(vm-asm-sources),$(src),$(build))
vm-objects = $(vm-cpp-objects) $(vm-asm-objects)
heapwalk-sources = $(src)/heapwalk.cpp
heapwalk-objects = \
$(call cpp-objects,$(heapwalk-sources),$(src),$(build))
unittest-objects = $(call cpp-objects,$(unittest-sources),$(unittest),$(build)/unittest)
2013-02-15 03:54:20 +00:00
ifeq ($(heapdump),true)
vm-sources += $(src)/heapdump.cpp
vm-heapwalk-objects = $(heapwalk-objects)
cflags += -DAVIAN_HEAPDUMP
endif
ifeq ($(tails),true)
cflags += -DAVIAN_TAILS
endif
ifeq ($(continuations),true)
cflags += -DAVIAN_CONTINUATIONS
asmflags += -DAVIAN_CONTINUATIONS
endif
bootimage-generator-sources = $(src)/tools/bootimage-generator/main.cpp $(src)/util/arg-parser.cpp $(stub-sources)
ifneq ($(lzma),)
bootimage-generator-sources += $(src)/lzma-encode.cpp
endif
bootimage-generator-objects = \
$(call cpp-objects,$(bootimage-generator-sources),$(src),$(build))
bootimage-generator = $(build)/bootimage-generator
bootimage-object = $(build)/bootimage-bin.o
codeimage-object = $(build)/codeimage-bin.o
ifeq ($(bootimage),true)
vm-classpath-objects = $(bootimage-object) $(codeimage-object)
cflags += -DBOOT_IMAGE -DAVIAN_CLASSPATH=\"\"
else
vm-classpath-objects = $(classpath-object)
cflags += -DBOOT_CLASSPATH=\"[classpathJar]\" \
-DAVIAN_CLASSPATH=\"[classpathJar]\"
endif
cflags += $(extra-cflags)
lflags += $(extra-lflags)
openjdk-cflags += $(extra-cflags)
driver-source = $(src)/main.cpp
driver-object = $(build)/main.o
2010-11-27 21:46:07 +00:00
driver-dynamic-objects = \
$(build)/main-dynamic.o
boot-source = $(src)/boot.cpp
boot-object = $(build)/boot.o
generator-depends := $(wildcard $(src)/*.h)
generator-sources = \
$(src)/tools/type-generator/main.cpp \
$(src)/system/$(build-system).cpp \
2014-02-22 00:06:17 +00:00
$(src)/system/$(build-system)/signal.cpp \
$(src)/finder.cpp
ifneq ($(lzma),)
2012-06-02 21:43:42 +00:00
common-cflags += -I$(lzma) -DAVIAN_USE_LZMA -D_7ZIP_ST
vm-sources += \
$(src)/lzma-decode.cpp
generator-sources += \
$(src)/lzma-decode.cpp
lzma-decode-sources = \
$(lzma)/C/LzmaDec.c
lzma-decode-objects = \
$(call c-objects,$(lzma-decode-sources),$(lzma)/C,$(build))
lzma-encode-sources = \
$(lzma)/C/LzmaEnc.c \
$(lzma)/C/LzFind.c
lzma-encode-objects = \
$(call c-objects,$(lzma-encode-sources),$(lzma)/C,$(build))
lzma-encoder = $(build)/lzma/lzma
lzma-encoder-cflags = -D__STDC_CONSTANT_MACROS -fno-rtti -fno-exceptions \
-I$(lzma)/C
lzma-encoder-sources = \
$(src)/lzma/main.cpp
lzma-encoder-objects = \
$(call cpp-objects,$(lzma-encoder-sources),$(src),$(build))
lzma-encoder-lzma-sources = $(lzma-encode-sources) $(lzma-decode-sources)
lzma-encoder-lzma-objects = \
2012-06-02 21:43:42 +00:00
$(call generator-c-objects,$(lzma-encoder-lzma-sources),$(lzma)/C,$(build))
lzma-loader = $(build)/lzma/load.o
endif
generator-cpp-objects = \
$(foreach x,$(1),$(patsubst $(2)/%.cpp,$(3)/%-build.o,$(x)))
generator-c-objects = \
$(foreach x,$(1),$(patsubst $(2)/%.c,$(3)/%-build.o,$(x)))
generator-objects = \
$(call generator-cpp-objects,$(generator-sources),$(src),$(build))
generator-lzma-objects = \
$(call generator-c-objects,$(lzma-decode-sources),$(lzma)/C,$(build))
generator = $(build)/generator
all-depends = $(shell find include -name '*.h')
object-writer-depends = $(shell find $(src)/tools/object-writer -name '*.h')
object-writer-sources = $(shell find $(src)/tools/object-writer -name '*.cpp')
object-writer-objects = $(call cpp-objects,$(object-writer-sources),$(src),$(build))
2012-04-25 15:09:26 +00:00
binary-to-object-depends = $(shell find $(src)/tools/binary-to-object/ -name '*.h')
binary-to-object-sources = $(shell find $(src)/tools/binary-to-object/ -name '*.cpp')
binary-to-object-objects = $(call cpp-objects,$(binary-to-object-sources),$(src),$(build))
converter-sources = $(object-writer-sources)
converter-tool-depends = $(binary-to-object-depends) $(all-depends)
converter-tool-sources = $(binary-to-object-sources)
2012-04-25 15:09:26 +00:00
converter-objects = $(call cpp-objects,$(converter-sources),$(src),$(build))
converter-tool-objects = $(call cpp-objects,$(converter-tool-sources),$(src),$(build))
2012-04-25 15:09:26 +00:00
converter = $(build)/binaryToObject/binaryToObject
static-library = $(build)/$(static-prefix)$(name)$(static-suffix)
executable = $(build)/$(name)${exe-suffix}
dynamic-library = $(build)/$(so-prefix)jvm$(so-suffix)
executable-dynamic = $(build)/$(name)-dynamic$(exe-suffix)
2007-06-30 02:39:01 +00:00
2013-02-15 03:54:20 +00:00
unittest-executable = $(build)/$(name)-unittest${exe-suffix}
ifneq ($(classpath),avian)
# Assembler, ConstantPool, and Stream are not technically needed for a
# working build, but we include them since our Subroutine test uses
# them to synthesize a class:
classpath-sources := \
$(classpath-src)/avian/Addendum.java \
2013-02-21 22:37:17 +00:00
$(classpath-src)/avian/AnnotationInvocationHandler.java \
$(classpath-src)/avian/Assembler.java \
$(classpath-src)/avian/Callback.java \
$(classpath-src)/avian/Cell.java \
$(classpath-src)/avian/ClassAddendum.java \
$(classpath-src)/avian/InnerClassReference.java \
$(classpath-src)/avian/Classes.java \
$(classpath-src)/avian/ConstantPool.java \
$(classpath-src)/avian/Continuations.java \
$(classpath-src)/avian/FieldAddendum.java \
$(classpath-src)/avian/Function.java \
$(classpath-src)/avian/IncompatibleContinuationException.java \
$(classpath-src)/avian/Machine.java \
$(classpath-src)/avian/MethodAddendum.java \
$(classpath-src)/avian/Singleton.java \
$(classpath-src)/avian/Stream.java \
$(classpath-src)/avian/SystemClassLoader.java \
$(classpath-src)/avian/Traces.java \
$(classpath-src)/avian/VMClass.java \
$(classpath-src)/avian/VMField.java \
$(classpath-src)/avian/VMMethod.java \
$(classpath-src)/avian/avianvmresource/Handler.java
ifeq ($(openjdk),)
classpath-sources := $(classpath-sources) \
$(classpath-src)/sun/reflect/ConstantPool.java \
$(classpath-src)/java/lang/ReflectiveOperationException.java \
$(classpath-src)/java/net/ProtocolFamily.java \
$(classpath-src)/java/net/StandardProtocolFamily.java \
$(classpath-src)/sun/misc/Cleaner.java \
$(classpath-src)/sun/misc/Unsafe.java \
2013-02-21 22:37:17 +00:00
$(classpath-src)/java/lang/reflect/Proxy.java
endif
else
classpath-sources := $(shell find $(classpath-src) -name '*.java')
endif
classpath-classes = \
$(call java-classes,$(classpath-sources),$(classpath-src),$(classpath-build))
classpath-object = $(build)/classpath-jar.o
classpath-dep = $(classpath-build).dep
vm-classes = \
avian/*.class \
avian/resource/*.class
test-support-sources = $(shell find $(test)/avian/ -name '*.java')
test-sources = $(wildcard $(test)/*.java)
2012-08-01 16:02:55 +00:00
test-cpp-sources = $(wildcard $(test)/*.cpp)
test-sources += $(test-support-sources)
test-support-classes = $(call java-classes, $(test-support-sources),$(test),$(test-build))
test-classes = $(call java-classes,$(test-sources),$(test),$(test-build))
2012-08-01 16:02:55 +00:00
test-cpp-objects = $(call cpp-objects,$(test-cpp-sources),$(test),$(test-build))
test-library = $(build)/$(so-prefix)test$(so-suffix)
test-dep = $(test-build).dep
test-extra-sources = $(wildcard $(test)/extra/*.java)
test-extra-classes = \
$(call java-classes,$(test-extra-sources),$(test),$(test-build))
test-extra-dep = $(test-build)-extra.dep
2013-02-15 03:54:20 +00:00
unittest-sources = \
$(wildcard $(unittest)/*.cpp) \
2013-02-17 19:10:18 +00:00
$(wildcard $(unittest)/util/*.cpp) \
2013-02-15 03:54:20 +00:00
$(wildcard $(unittest)/codegen/*.cpp)
unittest-depends = \
$(wildcard $(unittest)/*.h)
ifeq ($(continuations),true)
continuation-tests = \
extra.ComposableContinuations \
extra.Continuations \
extra.Coroutines \
extra.DynamicWind
endif
2011-03-15 23:51:32 +00:00
ifeq ($(tails),true)
tail-tests = \
extra.Tails
endif
2012-05-02 19:38:00 +00:00
ifeq ($(target-arch),i386)
cflags += -DAVIAN_TARGET_ARCH=AVIAN_ARCH_X86
endif
ifeq ($(target-arch),x86_64)
cflags += -DAVIAN_TARGET_ARCH=AVIAN_ARCH_X86_64
endif
ifeq ($(target-arch),powerpc)
cflags += -DAVIAN_TARGET_ARCH=AVIAN_ARCH_POWERPC
endif
ifeq ($(target-arch),arm)
cflags += -DAVIAN_TARGET_ARCH=AVIAN_ARCH_ARM
endif
ifeq ($(target-format),elf)
cflags += -DAVIAN_TARGET_FORMAT=AVIAN_FORMAT_ELF
endif
ifeq ($(target-format),pe)
cflags += -DAVIAN_TARGET_FORMAT=AVIAN_FORMAT_PE
endif
ifeq ($(target-format),macho)
cflags += -DAVIAN_TARGET_FORMAT=AVIAN_FORMAT_MACHO
2012-08-02 16:36:16 +00:00
endif
class-name = $(patsubst $(1)/%.class,%,$(2))
2007-10-28 01:54:30 +00:00
class-names = $(foreach x,$(2),$(call class-name,$(1),$(x)))
test-flags = -Djava.library.path=$(build) \
-cp $(build)/test$(target-path-separator)$(build)/extra-dir
test-args = $(test-flags) $(input)
2007-06-21 01:38:02 +00:00
.PHONY: build
ifneq ($(supports_avian_executable),false)
build: $(static-library) $(executable) $(dynamic-library) $(lzma-loader) \
2012-06-02 19:23:52 +00:00
$(lzma-encoder) $(executable-dynamic) $(classpath-dep) $(test-dep) \
2012-11-13 08:11:49 +00:00
$(test-extra-dep) $(embed)
else
build: $(static-library) $(dynamic-library) $(lzma-loader) \
$(lzma-encoder) $(classpath-dep) $(test-dep) \
$(test-extra-dep) $(embed)
endif
2009-09-05 22:04:43 +00:00
$(test-dep): $(classpath-dep)
$(test-extra-dep): $(classpath-dep)
2007-06-21 01:38:02 +00:00
.PHONY: run
2007-09-30 16:32:17 +00:00
run: build
$(library-path) $(test-executable) $(test-args)
.PHONY: debug
2007-09-30 16:32:17 +00:00
debug: build
$(library-path) gdb --args $(test-executable) $(test-args)
.PHONY: vg
2007-09-30 16:32:17 +00:00
vg: build
$(library-path) $(vg) $(test-executable) $(test-args)
.PHONY: test
test: build-test run-test
.PHONY: build-test
build-test: build $(build)/run-tests.sh $(build)/test.sh $(unittest-executable)
.PHONY: run-test
run-test:
ifneq ($(remote-test),true)
/bin/sh $(build)/run-tests.sh
else
@echo "running tests on $(remote-test-user)@$(remote-test-host):$(remote-test-port), in $(remote-test-dir)"
rsync $(build) -rav --exclude '*.o' --rsh="ssh -p$(remote-test-port)" $(remote-test-user)@$(remote-test-host):$(remote-test-dir)
ssh -p$(remote-test-port) $(remote-test-user)@$(remote-test-host) sh "$(remote-test-dir)/$(platform)-$(arch)$(options)/run-tests.sh"
endif
.PHONY: jdk-test
2013-12-07 02:30:04 +00:00
jdk-test: $(test-dep) $(build)/classpath.jar $(build)/jdk-run-tests.sh $(build)/test.sh
/bin/sh $(build)/jdk-run-tests.sh
2009-04-11 17:54:43 +00:00
.PHONY: tarball
tarball:
@echo "creating build/avian-$(version).tar.bz2"
@mkdir -p build
(cd .. && tar --exclude=build --exclude='.*' --exclude='*~' -cjf \
avian/build/avian-$(version).tar.bz2 avian)
2008-02-27 00:19:15 +00:00
.PHONY: javadoc
javadoc:
$(JAVA_HOME)/bin/javadoc -sourcepath classpath -d build/javadoc -subpackages avian:java \
-windowtitle "Avian v$(version) Class Library API" \
-doctitle "Avian v$(version) Class Library API" \
-header "Avian v$(version)" \
-bottom "<a href=\"http://oss.readytalk.com/avian/\">http://oss.readytalk.com/avian</a>"
2008-02-27 00:19:15 +00:00
.PHONY: clean-current
clean-current:
@echo "removing $(build)"
rm -rf $(build)
.PHONY: clean
clean:
2007-06-29 16:42:39 +00:00
@echo "removing build"
rm -rf build
2013-01-29 07:40:29 +00:00
ifeq ($(continuations),true)
$(build)/compile-x86-asm.o: $(src)/continuations-x86.$(asm-format)
2013-01-29 07:40:29 +00:00
endif
$(build)/run-tests.sh: $(test-classes) makefile $(build)/extra-dir/multi-classpath-test.txt $(build)/test/multi-classpath-test.txt
echo 'cd $$(dirname $$0)' > $(@)
echo "sh ./test.sh 2>/dev/null \\" >> $(@)
echo "$(shell echo $(library-path) | sed 's|$(build)|\.|g') ./$(name)-unittest${exe-suffix} ./$(notdir $(test-executable)) $(mode) \"-Djava.library.path=. -cp test$(target-path-separator)extra-dir\" \\" >> $(@)
echo "$(call class-names,$(test-build),$(filter-out $(test-support-classes), $(test-classes))) \\" >> $(@)
echo "$(continuation-tests) $(tail-tests)" >> $(@)
$(build)/jdk-run-tests.sh: $(test-classes) makefile $(build)/extra-dir/multi-classpath-test.txt $(build)/test/multi-classpath-test.txt
echo 'cd $$(dirname $$0)' > $(@)
echo "sh ./test.sh 2>/dev/null \\" >> $(@)
echo "'' true $(JAVA_HOME)/bin/java $(mode) \"-Xmx128m -Djava.library.path=. -cp test$(path-separator)extra-dir$(path-separator)classpath\" \\" >> $(@)
echo "$(call class-names,$(test-build),$(filter-out $(test-support-classes), $(test-classes))) \\" >> $(@)
echo "$(continuation-tests) $(tail-tests)" >> $(@)
$(build)/extra-dir/multi-classpath-test.txt:
mkdir -p $(build)/extra-dir
echo "$@" > $@
$(build)/test/multi-classpath-test.txt:
echo "$@" > $@
$(build)/test.sh: $(test)/test.sh
cp $(<) $(@)
gen-arg = $(shell echo $(1) | sed -e 's:$(build)/type-\(.*\)\.cpp:\1:')
$(generated-code): %.cpp: $(src)/types.def $(generator) $(classpath-dep)
@echo "generating $(@)"
2007-10-28 01:54:30 +00:00
@mkdir -p $(dir $(@))
2010-09-21 00:38:38 +00:00
$(generator) $(boot-classpath) $(<) $(@) $(call gen-arg,$(@))
$(classpath-build)/%.class: $(classpath-src)/%.java
@echo $(<)
$(classpath-dep): $(classpath-sources) $(classpath-jar-dep)
@echo "compiling classpath classes"
2009-06-04 23:54:06 +00:00
@mkdir -p $(classpath-build)
classes="$(shell $(MAKE) -s --no-print-directory build=$(build) \
$(classpath-classes))"; if [ -n "$${classes}" ]; then \
$(javac) -source 1.6 -target 1.6 \
-d $(classpath-build) -bootclasspath $(boot-classpath) \
$${classes}; fi
@touch $(@)
2007-06-29 02:58:48 +00:00
$(build)/android-src/%.cpp: $(luni-native)/%.cpp
cp $(<) $(@)
$(build)/android-src/%.cpp: $(libnativehelper-native)/%.cpp
cp $(<) $(@)
$(build)/android-src/%.cpp: $(crypto-native)/%.cpp
cp $(<) $(@)
$(build)/%.o: $(build)/android-src/%.cpp $(build)/android.dep
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
$(cxx) $(android-cflags) $(classpath-extra-cflags) -c \
$$($(windows-path) $(<)) $(call output,$(@))
$(build)/android.dep: $(luni-javas) $(libdvm-javas) $(crypto-javas) \
$(dalvik-javas) $(xml-javas) $(luni-nonjavas)
@echo "compiling luni classes"
@mkdir -p $(classpath-build)
@mkdir -p $(build)/android
@mkdir -p $(build)/android-src/external/fdlibm
@mkdir -p $(build)/android-src/libexpat
cp $(android)/external/fdlibm/fdlibm.h $(build)/android-src/external/fdlibm/
cp $(android)/external/expat/lib/expat*.h $(build)/android-src/libexpat/
cp -a $(luni-java)/* $(libdvm-java)/* $(crypto-java)/* $(dalvik-java)/* \
$(xml-java)/* $(build)/android-src/
find $(build)/android-src -name '*.java' > $(build)/android.txt
$(javac) -Xmaxerrs 1000 -d $(build)/android -sourcepath $(luni-java) \
@$(build)/android.txt
2013-02-21 22:37:17 +00:00
rm $(build)/android/sun/misc/Unsafe* \
$(build)/android/java/lang/reflect/Proxy*
for x in $(luni-copied-nonjavas); \
do cp $(luni-java)$${x} $(build)/android$${x} ; \
done
# fix security.properties - get rid of "com.android" in front of classes starting with "org"
sed -i -e 's/\(.*=\)com\.android\.\(org\..*\)/\1\2/g' \
$(build)/android/java/security/security.properties
chmod +w $(build)/android/java/security/security.properties
cp -r $(build)/android/* $(classpath-build)
@touch $(@)
$(test-build)/%.class: $(test)/%.java
2007-11-02 21:08:14 +00:00
@echo $(<)
2012-08-01 16:02:55 +00:00
$(test-dep): $(test-sources) $(test-library)
@echo "compiling test classes"
@mkdir -p $(test-build)
files="$(shell $(MAKE) -s --no-print-directory build=$(build) $(test-classes))"; \
if test -n "$${files}"; then \
$(javac) -source 1.6 -target 1.6 \
-classpath $(test-build) -d $(test-build) -bootclasspath $(boot-classpath) $${files}; \
fi
$(javac) -source 1.2 -target 1.1 -XDjsrlimit=0 -d $(test-build) \
-bootclasspath $(boot-classpath) test/Subroutine.java
@touch $(@)
$(test-extra-dep): $(test-extra-sources)
@echo "compiling extra test classes"
@mkdir -p $(test-build)
files="$(shell $(MAKE) -s --no-print-directory build=$(build) $(test-extra-classes))"; \
if test -n "$${files}"; then \
$(javac) -source 1.6 -target 1.6 \
-d $(test-build) -bootclasspath $(boot-classpath) $${files}; \
fi
@touch $(@)
define compile-object
@echo "compiling $(@)"
2007-10-28 01:54:30 +00:00
@mkdir -p $(dir $(@))
2012-06-02 21:43:42 +00:00
$(cxx) $(cflags) -c $$($(windows-path) $(<)) $(call output,$(@))
endef
define compile-asm-object
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
$(as) $(asmflags) $(call asm-output,$(@)) $(call asm-input,$(<))
endef
2013-02-15 03:54:20 +00:00
define compile-unittest-object
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
2013-03-04 18:09:59 +00:00
$(cxx) $(cflags) -c $$($(windows-path) $(<)) -I$(unittest) $(call output,$(@))
2013-02-15 03:54:20 +00:00
endef
$(vm-cpp-objects): $(build)/%.o: $(src)/%.cpp $(vm-depends)
$(compile-object)
ifeq ($(process),interpret)
$(all-codegen-target-objects): $(build)/%.o: $(src)/%.cpp $(vm-depends)
$(compile-object)
endif
2013-02-15 03:54:20 +00:00
$(unittest-objects): $(build)/unittest/%.o: $(unittest)/%.cpp $(vm-depends) $(unittest-depends)
$(compile-unittest-object)
2012-08-01 16:02:55 +00:00
$(test-cpp-objects): $(test-build)/%.o: $(test)/%.cpp $(vm-depends)
$(compile-object)
$(test-library): $(test-cpp-objects)
@echo "linking $(@)"
ifdef ms_cl_compiler
$(ld) $(shared) $(lflags) $(^) -out:$(@) \
-debug -PDB:$(subst $(so-suffix),.pdb,$(@)) \
-IMPLIB:$(test-build)/$(name).lib $(manifest-flags)
ifdef mt
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);2"
endif
2012-08-01 16:02:55 +00:00
else
$(ld) $(^) $(shared) $(lflags) -o $(@)
endif
2012-11-13 08:11:49 +00:00
ifdef embed
$(embed): $(embed-objects) $(embed-loader-o)
@echo "building $(embed)"
ifdef ms_cl_compiler
$(ld) $(lflags) $(^) -out:$(@) \
-debug -PDB:$(subst $(exe-suffix),.pdb,$(@)) $(manifest-flags)
ifdef mt
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
endif
2012-12-05 22:30:49 +00:00
else
$(cxx) $(^) $(lflags) $(static) $(call output,$(@))
endif
2012-12-05 00:37:02 +00:00
2012-11-13 08:11:49 +00:00
$(build-embed)/%.o: $(src)/%.cpp
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
2012-12-05 22:30:49 +00:00
$(cxx) $(cflags) -c $(<) $(call output,$(@))
2012-12-05 00:37:02 +00:00
2012-11-13 08:11:49 +00:00
$(embed-loader-o): $(embed-loader) $(converter)
@mkdir -p $(dir $(@))
$(converter) $(<) $(@) _binary_loader_start \
_binary_loader_end $(target-format) $(arch)
2013-04-02 08:37:20 +00:00
$(embed-loader): $(embed-loader-objects) $(vm-objects) $(classpath-objects) \
$(heapwalk-objects) $(lzma-decode-objects)
ifdef ms_cl_compiler
2013-03-01 21:52:27 +00:00
$(ld) $(lflags) $(^) -out:$(@) \
-debug -PDB:$(subst $(exe-suffix),.pdb,$(@)) $(manifest-flags)
ifdef mt
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
endif
2012-12-05 22:30:49 +00:00
else
2013-03-01 21:52:27 +00:00
$(dlltool) -z $(addsuffix .def,$(basename $(@))) $(^)
2012-11-13 08:11:49 +00:00
$(dlltool) -d $(addsuffix .def,$(basename $(@))) -e $(addsuffix .exp,$(basename $(@)))
2013-03-01 21:52:27 +00:00
$(ld) $(addsuffix .exp,$(basename $(@))) $(^) \
2012-12-05 22:30:49 +00:00
$(lflags) $(bootimage-lflags) -o $(@)
endif
$(strip) $(strip-all) $(@)
2012-11-13 08:11:49 +00:00
$(build-embed-loader)/%.o: $(src)/%.cpp
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
2012-12-05 22:30:49 +00:00
$(cxx) $(cflags) -c $(<) $(call output,$(@))
2012-11-13 08:11:49 +00:00
endif
$(build)/%.o: $(lzma)/C/%.c
2012-06-03 00:56:07 +00:00
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
2013-10-27 14:36:32 +00:00
$(cc) $(cflags) $(no-error) -c $$($(windows-path) $(<)) $(call output,$(@))
$(vm-asm-objects): $(build)/%-asm.o: $(src)/%.$(asm-format)
$(compile-asm-object)
$(bootimage-generator-objects): $(build)/%.o: $(src)/%.cpp $(vm-depends)
$(compile-object)
$(heapwalk-objects): $(build)/%.o: $(src)/%.cpp $(vm-depends)
$(compile-object)
$(driver-object): $(driver-source)
$(compile-object)
2010-11-27 21:46:07 +00:00
$(build)/main-dynamic.o: $(driver-source)
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
$(cxx) $(cflags) -DBOOT_LIBRARY=\"$(so-prefix)jvm$(so-suffix)\" \
2009-08-27 15:30:34 +00:00
-c $(<) $(call output,$(@))
$(boot-object): $(boot-source)
$(compile-object)
$(boot-javahome-object): $(src)/boot-javahome.cpp
$(compile-object)
$(object-writer-objects) $(binary-to-object-objects): $(build)/%.o: $(src)/%.cpp $(binary-to-object-depends) $(object-writer-depends) $(all-depends)
2012-04-25 15:09:26 +00:00
@mkdir -p $(dir $(@))
$(build-cxx) $(converter-cflags) -c $(<) -o $(@)
$(converter): $(converter-objects) $(converter-tool-objects)
@mkdir -p $(dir $(@))
$(build-cc) $(^) -g -o $(@)
$(lzma-encoder-objects): $(build)/lzma/%.o: $(src)/lzma/%.cpp
@mkdir -p $(dir $(@))
$(build-cxx) $(lzma-encoder-cflags) -c $(<) -o $(@)
$(lzma-encoder): $(lzma-encoder-objects) $(lzma-encoder-lzma-objects)
$(build-cc) $(^) -g -o $(@)
$(lzma-loader): $(src)/lzma/load.cpp
$(compile-object)
$(build)/classpath.jar: $(classpath-dep) $(classpath-jar-dep)
@echo "creating $(@)"
(wd=$$(pwd) && \
cd $(classpath-build) && \
$(jar) c0f "$$($(native-path) "$${wd}/$(@)")" .)
$(classpath-object): $(build)/classpath.jar $(converter)
2008-03-31 04:23:51 +00:00
@echo "creating $(@)"
$(converter) $(<) $(@) _binary_classpath_jar_start \
_binary_classpath_jar_end $(target-format) $(arch)
2010-11-15 23:27:00 +00:00
$(build)/javahome.jar:
@echo "creating $(@)"
(wd=$$(pwd) && \
2010-11-15 23:27:00 +00:00
cd "$(build-javahome)" && \
$(jar) c0f "$$($(native-path) "$${wd}/$(@)")" $(javahome-files))
$(javahome-object): $(build)/javahome.jar $(converter)
@echo "creating $(@)"
$(converter) $(<) $(@) _binary_javahome_jar_start \
_binary_javahome_jar_end $(target-format) $(arch)
define compile-generator-object
@echo "compiling $(@)"
2007-10-28 01:54:30 +00:00
@mkdir -p $(dir $(@))
$(build-cxx) -DPOINTER_SIZE=$(pointer-size) -O0 -g3 $(build-cflags) \
-c $(<) -o $(@)
endef
$(generator-objects): $(generator-depends)
$(generator-objects): $(build)/%-build.o: $(src)/%.cpp
$(compile-generator-object)
2012-06-02 21:43:42 +00:00
$(build)/%-build.o: $(lzma)/C/%.c
2012-06-03 00:56:07 +00:00
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
$(build-cxx) -DPOINTER_SIZE=$(pointer-size) -O0 -g3 $(build-cflags) \
2012-06-04 15:51:11 +00:00
$(no-error) -c $(<) -o $(@)
$(jni-objects): $(build)/%.o: $(classpath-src)/%.cpp
$(compile-object)
2007-06-25 01:34:07 +00:00
$(static-library): $(vm-objects) $(classpath-objects) $(vm-heapwalk-objects) \
$(javahome-object) $(boot-javahome-object) $(lzma-decode-objects)
@echo "creating $(@)"
@rm -rf $(build)/libavian
@mkdir -p $(build)/libavian
2007-10-26 21:02:39 +00:00
rm -rf $(@)
for x in $(^); \
do cp $${x} $(build)/libavian/$$(echo $${x} | sed s:/:_:g); \
done
ifdef ms_cl_compiler
$(ar) $(arflags) $(build)/libavian/*.o -out:$(@)
else
$(ar) cru $(@) $(build)/libavian/*.o
$(ranlib) $(@)
endif
$(bootimage-object) $(codeimage-object): $(bootimage-generator) \
$(classpath-jar-dep)
2013-01-28 17:15:29 +00:00
@echo "generating bootimage and codeimage binaries from $(classpath-build) using $(<)"
$(<) -cp $(classpath-build) -bootimage $(bootimage-object) -codeimage $(codeimage-object) \
-bootimage-symbols $(bootimage-symbols) \
-codeimage-symbols $(codeimage-symbols)
executable-objects = $(vm-objects) $(classpath-objects) $(driver-object) \
$(vm-heapwalk-objects) $(boot-object) $(vm-classpath-objects) \
$(javahome-object) $(boot-javahome-object) $(lzma-decode-objects)
unittest-executable-objects = $(unittest-objects) $(vm-objects) \
2013-10-27 14:36:32 +00:00
$(build)/util/arg-parser.o $(stub-objects) $(lzma-decode-objects)
2013-02-15 03:54:20 +00:00
ifeq ($(process),interpret)
unittest-executable-objects += $(all-codegen-target-objects)
endif
2013-02-18 14:50:37 +00:00
# apparently, make does poorly with ifs inside of defines, and indented defines.
# I suggest re-indenting the following before making edits (and unindenting afterwards):
ifneq ($(platform),windows)
define link-executable
@echo linking $(@)
$(ld) $(^) $(rdynamic) $(lflags) $(classpath-lflags) $(bootimage-lflags) \
-o $(@)
2013-02-18 14:50:37 +00:00
endef
else
ifdef ms_cl_compiler
ifdef mt
2013-02-18 14:50:37 +00:00
define link-executable
@echo linking $(@)
$(ld) $(lflags) $(^) -out:$(@) \
-debug -PDB:$(subst $(exe-suffix),.pdb,$(@)) $(manifest-flags)
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
2013-02-18 14:50:37 +00:00
endef
else
define link-executable
@echo linking $(@)
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
2013-02-18 14:50:37 +00:00
endef
endif
else
2013-02-18 14:50:37 +00:00
define link-executable
@echo linking $(@)
$(dlltool) -z $(@).def $(^)
$(dlltool) -d $(@).def -e $(@).exp
$(ld) $(@).exp $(^) $(lflags) $(classpath-lflags) -o $(@)
2013-02-18 14:50:37 +00:00
endef
endif
2007-10-26 21:02:39 +00:00
endif
2013-02-18 14:50:37 +00:00
$(executable): $(executable-objects)
$(link-executable)
2013-02-15 03:54:20 +00:00
$(unittest-executable): $(unittest-executable-objects)
2013-02-18 14:50:37 +00:00
$(link-executable)
$(bootimage-generator): $(bootimage-generator-objects) $(vm-objects)
2013-01-28 17:15:29 +00:00
echo building $(bootimage-generator) arch=$(build-arch) platform=$(bootimage-platform)
2009-09-06 00:26:13 +00:00
$(MAKE) mode=$(mode) \
ios=false \
2013-01-28 17:15:29 +00:00
build=$(host-build-root) \
arch=$(build-arch) \
aot-only=false \
target-arch=$(arch) \
armv6=$(armv6) \
2009-06-01 18:12:29 +00:00
platform=$(bootimage-platform) \
target-format=$(target-format) \
openjdk=$(openjdk) \
openjdk-src=$(openjdk-src) \
bootimage-generator= \
build-bootimage-generator=$(bootimage-generator) \
target-cflags="$(bootimage-cflags)" \
target-asm=$(asm) \
2009-09-06 00:26:13 +00:00
$(bootimage-generator)
$(build-bootimage-generator): \
$(vm-objects) $(classpath-object) \
$(heapwalk-objects) $(bootimage-generator-objects) $(converter-objects) \
$(lzma-decode-objects) $(lzma-encode-objects)
@echo "linking $(@)"
2007-10-26 21:02:39 +00:00
ifeq ($(platform),windows)
ifdef ms_cl_compiler
$(ld) $(bootimage-generator-lflags) $(lflags) $(^) -out:$(@) \
-debug -PDB:$(subst $(exe-suffix),.pdb,$(@)) $(manifest-flags)
ifdef mt
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
endif
else
2007-10-26 21:02:39 +00:00
$(dlltool) -z $(@).def $(^)
$(dlltool) -d $(@).def -e $(@).exp
$(ld) $(@).exp $(^) $(bootimage-generator-lflags) $(lflags) -o $(@)
endif
2007-10-26 21:02:39 +00:00
else
$(ld) $(^) $(rdynamic) $(bootimage-generator-lflags) $(lflags) -o $(@)
2007-10-26 21:02:39 +00:00
endif
$(dynamic-library): $(vm-objects) $(dynamic-object) $(classpath-objects) \
$(vm-heapwalk-objects) $(boot-object) $(vm-classpath-objects) \
$(classpath-libraries) $(javahome-object) $(boot-javahome-object) \
$(lzma-decode-objects)
@echo "linking $(@)"
ifdef ms_cl_compiler
$(ld) $(shared) $(lflags) $(^) -out:$(@) \
-debug -PDB:$(subst $(so-suffix),.pdb,$(@)) \
-IMPLIB:$(subst $(so-suffix),.lib,$(@)) $(manifest-flags)
ifdef mt
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);2"
endif
else
$(ld) $(^) $(version-script-flag) $(soname-flag) \
$(shared) $(lflags) $(classpath-lflags) $(bootimage-lflags) \
2010-11-08 04:23:25 +00:00
-o $(@)
endif
2008-03-31 04:23:51 +00:00
$(strip) $(strip-all) $(@)
# todo: the $(no-lto) flag below is due to odd undefined reference errors on
# Ubuntu 11.10 which may be fixable without disabling LTO.
2010-11-27 21:46:07 +00:00
$(executable-dynamic): $(driver-dynamic-objects) $(dynamic-library)
@echo "linking $(@)"
ifdef ms_cl_compiler
$(ld) $(lflags) -LIBPATH:$(build) -DEFAULTLIB:$(name) \
2013-03-04 18:09:59 +00:00
-debug -PDB:$(subst $(exe-suffix),.pdb,$(@)) \
$(driver-dynamic-objects) -out:$(@) $(manifest-flags)
ifdef mt
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
endif
else
$(ld) $(driver-dynamic-objects) -L$(build) -ljvm $(lflags) $(no-lto) $(rpath) -o $(@)
endif
$(strip) $(strip-all) $(@)
$(generator): $(generator-objects) $(generator-lzma-objects)
@echo "linking $(@)"
$(build-ld) $(^) $(build-lflags) -o $(@)
$(openjdk-objects): $(build)/openjdk/%-openjdk.o: $(openjdk-src)/%.c \
$(openjdk-headers-dep)
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
sed 's/^static jclass ia_class;//' < $(<) > $(build)/openjdk/$(notdir $(<))
ifeq ($(ios),true)
sed \
-e 's/^#ifndef __APPLE__/#if 1/' \
-e 's/^#ifdef __APPLE__/#if 0/' \
< "$(openjdk-src)/solaris/native/java/lang/ProcessEnvironment_md.c" \
> $(build)/openjdk/ProcessEnvironment_md.c
sed \
-e 's/^#ifndef __APPLE__/#if 1/' \
-e 's/^#ifdef __APPLE__/#if 0/' \
< "$(openjdk-src)/solaris/native/java/lang/UNIXProcess_md.c" \
> $(build)/openjdk/UNIXProcess_md.c
endif
if [ -f openjdk-patches/$(notdir $(<)).patch ]; then \
( cd $(build) && patch -p0 ) < openjdk-patches/$(notdir $(<)).patch; \
fi
2010-11-15 23:27:00 +00:00
$(cc) -fPIC $(openjdk-extra-cflags) $(openjdk-cflags) \
$(optimization-cflags) -w -c $(build)/openjdk/$(notdir $(<)) \
$(call output,$(@)) -Wno-return-type
$(openjdk-local-objects): $(build)/openjdk/%-openjdk.o: $(src)/openjdk/%.c \
$(openjdk-headers-dep)
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
$(cc) -fPIC $(openjdk-extra-cflags) $(openjdk-cflags) \
$(optimization-cflags) -w -c $(<) $(call output,$(@))
2010-11-15 23:27:00 +00:00
$(openjdk-headers-dep):
@echo "generating openjdk headers"
@mkdir -p $(dir $(@))
$(javah) -d $(build)/openjdk -bootclasspath $(boot-classpath) \
$(openjdk-headers-classes)
2010-11-30 00:39:41 +00:00
ifeq ($(platform),windows)
sed 's/^#ifdef _WIN64/#if 1/' \
< "$(openjdk-src)/windows/native/java/net/net_util_md.h" \
> $(build)/openjdk/net_util_md.h
sed \
-e 's/\(^#include "net_util.h"\)/\1\n#if (defined _INC_NLDEF) || (defined _WS2DEF_)\n#define HIDE(x) hide_##x\n#else\n#define HIDE(x) x\n#define _WINSOCK2API_\n#endif/' \
-e 's/\(IpPrefix[a-zA-Z_]*\)/HIDE(\1)/' \
-e 's/\(IpSuffix[a-zA-Z_]*\)/HIDE(\1)/' \
-e 's/\(IpDad[a-zA-Z_]*\)/HIDE(\1)/' \
-e 's/\(ScopeLevel[a-zA-Z_]*\)/HIDE(\1)/' \
-e 's/\(SCOPE_LEVEL[a-zA-Z_]*\)/HIDE(\1)/' \
< "$(openjdk-src)/windows/native/java/net/NetworkInterface.h" \
> $(build)/openjdk/NetworkInterface.h
echo 'static int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP);' >> $(build)/openjdk/NetworkInterface.h
endif
ifeq ($(platform),darwin)
mkdir -p $(build)/openjdk/netinet
for file in \
$(sysroot)/usr/include/netinet/ip.h \
$(sysroot)/usr/include/netinet/in_systm.h \
$(sysroot)/usr/include/netinet/ip_icmp.h \
$(sysroot)/usr/include/netinet/in_var.h \
$(sysroot)/usr/include/netinet/icmp6.h \
$(sysroot)/usr/include/netinet/ip_var.h; do \
if [ ! -f "$(build)/openjdk/netinet/$$(basename $${file})" ]; then \
ln "$${file}" "$(build)/openjdk/netinet/$$(basename $${file})"; \
fi; \
done
mkdir -p $(build)/openjdk/netinet6
for file in \
$(sysroot)/usr/include/netinet6/in6_var.h; do \
if [ ! -f "$(build)/openjdk/netinet6/$$(basename $${file})" ]; then \
ln "$${file}" "$(build)/openjdk/netinet6/$$(basename $${file})"; \
fi; \
done
mkdir -p $(build)/openjdk/net
for file in \
$(sysroot)/usr/include/net/if_arp.h; do \
if [ ! -f "$(build)/openjdk/net/$$(basename $${file})" ]; then \
ln "$${file}" "$(build)/openjdk/net/$$(basename $${file})"; \
fi; \
done
mkdir -p $(build)/openjdk/sys
for file in \
$(sysroot)/usr/include/sys/kern_event.h \
$(sysroot)/usr/include/sys/sys_domain.h; do \
if [ ! -f "$(build)/openjdk/sys/$$(basename $${file})" ]; then \
ln "$${file}" "$(build)/openjdk/sys/$$(basename $${file})"; \
fi; \
done
2010-11-30 00:39:41 +00:00
endif
@touch $(@)
2010-11-15 23:27:00 +00:00
$(openjdk-jar-dep):
@echo "extracting openjdk classes"
@mkdir -p $(dir $(@))
@mkdir -p $(classpath-build)
2010-11-15 23:27:00 +00:00
(cd $(classpath-build) && \
$(jar) xf "$$($(native-path) "$(openjdk)/jre/lib/rt.jar")" && \
$(jar) xf "$$($(native-path) "$(openjdk)/jre/lib/jsse.jar")" && \
$(jar) xf "$$($(native-path) "$(openjdk)/jre/lib/jce.jar")" && \
$(jar) xf "$$($(native-path) "$(openjdk)/jre/lib/charsets.jar")" && \
$(jar) xf "$$($(native-path) "$(openjdk)/jre/lib/ext/sunjce_provider.jar")" && \
2010-11-15 23:27:00 +00:00
$(jar) xf "$$($(native-path) "$(openjdk)/jre/lib/resources.jar")")
@touch $(@)