mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
various makefile refinements for better supporting native Windows builds
This commit is contained in:
parent
3575e28e87
commit
e2c04b2761
77
makefile
77
makefile
@ -3,15 +3,10 @@ MAKEFLAGS = -s
|
|||||||
name = avian
|
name = avian
|
||||||
version = 0.1.1
|
version = 0.1.1
|
||||||
|
|
||||||
build-arch = $(shell uname -m)
|
build-arch = $(shell uname -m | sed 's/^i.86$$/i386/')
|
||||||
ifeq ($(build-arch),i586)
|
|
||||||
build-arch = i386
|
|
||||||
endif
|
|
||||||
ifeq ($(build-arch),i686)
|
|
||||||
build-arch = i386
|
|
||||||
endif
|
|
||||||
|
|
||||||
build-platform = $(shell uname -s | tr [:upper:] [:lower:])
|
build-platform = \
|
||||||
|
$(shell uname -s | tr [:upper:] [:lower:] | sed 's/^mingw32.*$$/windows/')
|
||||||
|
|
||||||
arch = $(build-arch)
|
arch = $(build-arch)
|
||||||
platform = $(build-platform)
|
platform = $(build-platform)
|
||||||
@ -41,11 +36,12 @@ cxx = $(build-cxx)
|
|||||||
cc = $(build-cc)
|
cc = $(build-cc)
|
||||||
ar = ar
|
ar = ar
|
||||||
ranlib = ranlib
|
ranlib = ranlib
|
||||||
|
dlltool = dlltool
|
||||||
objcopy = objcopy
|
objcopy = objcopy
|
||||||
vg = nice valgrind --num-callers=32 --db-attach=yes --freelist-vol=100000000
|
vg = nice valgrind --num-callers=32 --db-attach=yes --freelist-vol=100000000
|
||||||
vg += --leak-check=full --suppressions=valgrind.supp
|
vg += --leak-check=full --suppressions=valgrind.supp
|
||||||
db = gdb --args
|
db = gdb --args
|
||||||
javac = javac
|
javac = "$(JAVA_HOME)/bin/javac"
|
||||||
jar = jar
|
jar = jar
|
||||||
strip = :
|
strip = :
|
||||||
strip-all = --strip-all
|
strip-all = --strip-all
|
||||||
@ -55,12 +51,12 @@ rdynamic = -rdynamic
|
|||||||
warnings = -Wall -Wextra -Werror -Wunused-parameter -Winit-self
|
warnings = -Wall -Wextra -Werror -Wunused-parameter -Winit-self
|
||||||
|
|
||||||
common-cflags = $(warnings) -fno-rtti -fno-exceptions \
|
common-cflags = $(warnings) -fno-rtti -fno-exceptions \
|
||||||
-I$(JAVA_HOME)/include -idirafter $(src) -I$(native-build) \
|
"-I$(JAVA_HOME)/include" -idirafter $(src) -I$(native-build) \
|
||||||
-D__STDC_LIMIT_MACROS -D_JNI_IMPLEMENTATION_ -DAVIAN_VERSION=\"$(version)\" \
|
-D__STDC_LIMIT_MACROS -D_JNI_IMPLEMENTATION_ -DAVIAN_VERSION=\"$(version)\" \
|
||||||
-DBOOT_CLASSPATH=\"[classpathJar]\"
|
-DBOOT_CLASSPATH=\"[classpathJar]\"
|
||||||
|
|
||||||
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \
|
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \
|
||||||
-I$(JAVA_HOME)/include/linux -I$(src) -pthread
|
"-I$(JAVA_HOME)/include/linux" -I$(src) -pthread
|
||||||
|
|
||||||
cflags = $(build-cflags)
|
cflags = $(build-cflags)
|
||||||
|
|
||||||
@ -77,8 +73,6 @@ pointer-size = 8
|
|||||||
|
|
||||||
so-prefix = lib
|
so-prefix = lib
|
||||||
so-suffix = .so
|
so-suffix = .so
|
||||||
exe-suffix =
|
|
||||||
|
|
||||||
|
|
||||||
shared = -shared
|
shared = -shared
|
||||||
|
|
||||||
@ -89,8 +83,7 @@ ifeq ($(arch),i386)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(platform),darwin)
|
ifeq ($(platform),darwin)
|
||||||
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \
|
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden -I$(src)
|
||||||
-I$(JAVA_HOME)/include/linux -I$(src)
|
|
||||||
lflags = $(common-lflags) -ldl -framework CoreFoundation
|
lflags = $(common-lflags) -ldl -framework CoreFoundation
|
||||||
rdynamic =
|
rdynamic =
|
||||||
strip-all = -S -x
|
strip-all = -S -x
|
||||||
@ -99,35 +92,7 @@ ifeq ($(platform),darwin)
|
|||||||
shared = -dynamiclib
|
shared = -dynamiclib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(platform),mingw32_nt-6.0)
|
|
||||||
# A native Windows build (i.e. not cross-compiled).
|
|
||||||
build-cflags = $(common-cflags) \
|
|
||||||
-I$(JAVA_HOME)/include/win32 -I$(src) -mthreads
|
|
||||||
lflags = $(common-lflags) -lmthreads -ldl
|
|
||||||
inc = $(root)/win32/include
|
|
||||||
lib = $(root)/win32/lib
|
|
||||||
|
|
||||||
system = windows
|
|
||||||
object-format = pe-i386
|
|
||||||
|
|
||||||
so-prefix =
|
|
||||||
so-suffix = .dll
|
|
||||||
exe-suffix = .exe
|
|
||||||
|
|
||||||
cxx = g++
|
|
||||||
cc = gcc
|
|
||||||
dlltool = dlltool
|
|
||||||
ar = ar
|
|
||||||
ranlib = ranlib
|
|
||||||
objcopy = objcopy
|
|
||||||
|
|
||||||
rdynamic = -Wl,--export-dynamic
|
|
||||||
lflags = -L$(lib) $(common-lflags) -lws2_32 -mwindows -mconsole
|
|
||||||
cflags = $(common-cflags) -I$(inc)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(platform),windows)
|
ifeq ($(platform),windows)
|
||||||
# A Windows cross-compiled build
|
|
||||||
inc = $(root)/win32/include
|
inc = $(root)/win32/include
|
||||||
lib = $(root)/win32/lib
|
lib = $(root)/win32/lib
|
||||||
|
|
||||||
@ -138,14 +103,18 @@ ifeq ($(platform),windows)
|
|||||||
so-suffix = .dll
|
so-suffix = .dll
|
||||||
exe-suffix = .exe
|
exe-suffix = .exe
|
||||||
|
|
||||||
cxx = i586-mingw32msvc-g++
|
ifeq ($(build-platform),windows)
|
||||||
cc = i586-mingw32msvc-gcc
|
build-cflags = $(common-cflags) \
|
||||||
dlltool = i586-mingw32msvc-dlltool
|
"-I$(JAVA_HOME)/include/win32" -I$(src) -mthreads
|
||||||
ar = i586-mingw32msvc-ar
|
else
|
||||||
ranlib = i586-mingw32msvc-ranlib
|
cxx = i586-mingw32msvc-g++
|
||||||
objcopy = i586-mingw32msvc-objcopy
|
cc = i586-mingw32msvc-gcc
|
||||||
|
dlltool = i586-mingw32msvc-dlltool
|
||||||
|
ar = i586-mingw32msvc-ar
|
||||||
|
ranlib = i586-mingw32msvc-ranlib
|
||||||
|
objcopy = i586-mingw32msvc-objcopy
|
||||||
|
endif
|
||||||
|
|
||||||
rdynamic = -Wl,--export-dynamic
|
|
||||||
lflags = -L$(lib) $(common-lflags) -lws2_32 -mwindows -mconsole
|
lflags = -L$(lib) $(common-lflags) -lws2_32 -mwindows -mconsole
|
||||||
cflags = $(common-cflags) -I$(inc)
|
cflags = $(common-cflags) -I$(inc)
|
||||||
endif
|
endif
|
||||||
@ -324,7 +293,7 @@ $(classpath-dep): $(classpath-sources)
|
|||||||
@echo "compiling classpath classes"
|
@echo "compiling classpath classes"
|
||||||
@mkdir -p $(dir $(@))
|
@mkdir -p $(dir $(@))
|
||||||
$(javac) -d $(dir $(@)) -bootclasspath $(classpath-build) \
|
$(javac) -d $(dir $(@)) -bootclasspath $(classpath-build) \
|
||||||
$(shell make -s --no-print-directory $(classpath-classes))
|
$(shell $(MAKE) -s --no-print-directory $(classpath-classes))
|
||||||
@touch $(@)
|
@touch $(@)
|
||||||
|
|
||||||
$(test-build)/%.class: $(test)/%.java
|
$(test-build)/%.class: $(test)/%.java
|
||||||
@ -334,7 +303,7 @@ $(test-dep): $(test-sources)
|
|||||||
@echo "compiling test classes"
|
@echo "compiling test classes"
|
||||||
@mkdir -p $(dir $(@))
|
@mkdir -p $(dir $(@))
|
||||||
$(javac) -d $(dir $(@)) -bootclasspath $(classpath-build) \
|
$(javac) -d $(dir $(@)) -bootclasspath $(classpath-build) \
|
||||||
$(shell make -s --no-print-directory $(test-classes))
|
$(shell $(MAKE) -s --no-print-directory $(test-classes))
|
||||||
@touch $(@)
|
@touch $(@)
|
||||||
|
|
||||||
define compile-object
|
define compile-object
|
||||||
@ -400,9 +369,7 @@ $(executable): \
|
|||||||
$(vm-objects) $(classpath-object) $(jni-objects) $(driver-object) \
|
$(vm-objects) $(classpath-object) $(jni-objects) $(driver-object) \
|
||||||
$(boot-object)
|
$(boot-object)
|
||||||
@echo "linking $(@)"
|
@echo "linking $(@)"
|
||||||
|
ifeq ($(platform),windows)
|
||||||
ifneq (,$(filter $(platform),windows mingw32_nt-6.0))
|
|
||||||
# This is either cross-compiled or native Windows build
|
|
||||||
$(dlltool) -z $(@).def $(^)
|
$(dlltool) -z $(@).def $(^)
|
||||||
$(dlltool) -k -d $(@).def -e $(@).exp
|
$(dlltool) -k -d $(@).def -e $(@).exp
|
||||||
$(cc) $(@).exp $(^) $(lflags) -o $(@)
|
$(cc) $(@).exp $(^) $(lflags) -o $(@)
|
||||||
|
Loading…
Reference in New Issue
Block a user