mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
build fixes and refactoring
This commit is contained in:
parent
e892f1bff5
commit
f354abb4a0
@ -2,20 +2,22 @@
|
|||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
# define EXPORT __declspec(dllexport)
|
# define EXPORT __declspec(dllexport)
|
||||||
|
# define SYMBOL(x) binary_classpath_jar_##x
|
||||||
#else
|
#else
|
||||||
# define EXPORT __attribute__ ((visibility("default")))
|
# define EXPORT __attribute__ ((visibility("default")))
|
||||||
|
# define SYMBOL(x) _binary_classpath_jar_##x
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
extern const uint8_t _binary_classpath_jar_start[];
|
extern const uint8_t SYMBOL(start)[];
|
||||||
extern const uint8_t _binary_classpath_jar_size[];
|
extern const uint8_t SYMBOL(size)[];
|
||||||
|
|
||||||
EXPORT const uint8_t*
|
EXPORT const uint8_t*
|
||||||
vmClasspath(unsigned* size)
|
vmClasspath(unsigned* size)
|
||||||
{
|
{
|
||||||
*size = reinterpret_cast<uintptr_t>(_binary_classpath_jar_size);
|
*size = reinterpret_cast<uintptr_t>(SYMBOL(size));
|
||||||
return _binary_classpath_jar_start;
|
return SYMBOL(start);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
76
makefile
76
makefile
@ -10,17 +10,15 @@ endif
|
|||||||
|
|
||||||
build-platform = $(shell uname -s | tr [:upper:] [:lower:])
|
build-platform = $(shell uname -s | tr [:upper:] [:lower:])
|
||||||
|
|
||||||
ifeq ($(build-platform),cygwin_nt-5.1)
|
|
||||||
build-platform = windows
|
|
||||||
endif
|
|
||||||
|
|
||||||
arch = $(build-arch)
|
arch = $(build-arch)
|
||||||
|
|
||||||
platform = $(build-platform)
|
platform = $(build-platform)
|
||||||
|
|
||||||
process = interpret
|
ifeq ($(platform),windows)
|
||||||
|
arch = i386
|
||||||
|
endif
|
||||||
|
|
||||||
mode = debug
|
mode = debug
|
||||||
|
process = interpret
|
||||||
|
|
||||||
build = build
|
build = build
|
||||||
native-build = $(build)/$(platform)/$(arch)/$(mode)
|
native-build = $(build)/$(platform)/$(arch)/$(mode)
|
||||||
@ -52,7 +50,6 @@ strip = :
|
|||||||
show-size = :
|
show-size = :
|
||||||
|
|
||||||
rdynamic = -rdynamic
|
rdynamic = -rdynamic
|
||||||
shared = -shared
|
|
||||||
|
|
||||||
warnings = -Wall -Wextra -Werror -Wunused-parameter \
|
warnings = -Wall -Wextra -Werror -Wunused-parameter \
|
||||||
-Winit-self -Wconversion
|
-Winit-self -Wconversion
|
||||||
@ -66,27 +63,33 @@ build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \
|
|||||||
|
|
||||||
cflags = $(build-cflags)
|
cflags = $(build-cflags)
|
||||||
|
|
||||||
lflags = $(lpthread) -ldl -lm -lz
|
common-lflags = -lm -lz
|
||||||
|
|
||||||
|
lflags = $(common-lflags) $(lpthread) -ldl -rdynamic
|
||||||
|
|
||||||
system = posix
|
system = posix
|
||||||
asm = x86
|
asm = x86
|
||||||
begin-merge-archive = -Wl,--whole-archive
|
|
||||||
end-merge-archive = -Wl,--no-whole-archive
|
object-arch = i386:x86-64
|
||||||
|
object-format = elf64-x86-64
|
||||||
|
pointer-size = 8
|
||||||
|
|
||||||
|
ifeq ($(arch),i386)
|
||||||
|
object-arch = i386
|
||||||
|
object-format = elf32-i386
|
||||||
|
pointer-size = 4
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(platform),darwin)
|
ifeq ($(platform),darwin)
|
||||||
rdynamic =
|
lflags = $(common-lflags) -ldl
|
||||||
thread-cflags =
|
|
||||||
shared = -dynamiclib
|
|
||||||
pthread =
|
|
||||||
lpthread =
|
|
||||||
begin-merge-archive = -Wl,-all_load
|
|
||||||
end-merge-archive =
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(platform),windows)
|
ifeq ($(platform),windows)
|
||||||
inc = /usr/local/win32/include
|
inc = /usr/local/win32/include
|
||||||
lib = /usr/local/win32/lib
|
lib = /usr/local/win32/lib
|
||||||
|
|
||||||
system = windows
|
system = windows
|
||||||
|
object-format = pe-i386
|
||||||
|
|
||||||
cxx = i586-mingw32msvc-g++
|
cxx = i586-mingw32msvc-g++
|
||||||
cc = i586-mingw32msvc-gcc
|
cc = i586-mingw32msvc-gcc
|
||||||
@ -96,7 +99,7 @@ ifeq ($(platform),windows)
|
|||||||
objcopy = i586-mingw32msvc-objcopy
|
objcopy = i586-mingw32msvc-objcopy
|
||||||
|
|
||||||
rdynamic = -Wl,--export-dynamic
|
rdynamic = -Wl,--export-dynamic
|
||||||
lflags = -L$(lib) -lm -lz -lws2_32 -Wl,--kill-at -mwindows -mconsole
|
lflags = -L$(lib) $(common-lflags) -lws2_32 -Wl,--kill-at -mwindows -mconsole
|
||||||
cflags = $(common-cflags) -I$(inc)
|
cflags = $(common-cflags) -I$(inc)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -115,20 +118,6 @@ ifeq ($(mode),fast)
|
|||||||
show-size = ls -l
|
show-size = ls -l
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(arch),i386)
|
|
||||||
object-arch = i386
|
|
||||||
object-format = elf32-i386
|
|
||||||
pointer-size = 4
|
|
||||||
else
|
|
||||||
object-arch = i386:x86-64
|
|
||||||
object-format = elf64-x86-64
|
|
||||||
pointer-size = 8
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(platform),windows)
|
|
||||||
object-format = pe-i386
|
|
||||||
endif
|
|
||||||
|
|
||||||
cpp-objects = $(foreach x,$(1),$(patsubst $(2)/%.cpp,$(3)/%.o,$(x)))
|
cpp-objects = $(foreach x,$(1),$(patsubst $(2)/%.cpp,$(3)/%.o,$(x)))
|
||||||
asm-objects = $(foreach x,$(1),$(patsubst $(2)/%.S,$(3)/%-asm.o,$(x)))
|
asm-objects = $(foreach x,$(1),$(patsubst $(2)/%.S,$(3)/%-asm.o,$(x)))
|
||||||
java-classes = $(foreach x,$(1),$(patsubst $(2)/%.java,$(3)/%.class,$(x)))
|
java-classes = $(foreach x,$(1),$(patsubst $(2)/%.java,$(3)/%.class,$(x)))
|
||||||
@ -210,7 +199,7 @@ flags = -cp $(test-build)
|
|||||||
args = $(flags) $(call class-name,$(test-build),$(input))
|
args = $(flags) $(call class-name,$(test-build),$(input))
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: $(interpreter) $(classpath-classes) $(test-classes)
|
build: $(interpreter) $(archive) $(classpath-classes) $(test-classes)
|
||||||
|
|
||||||
$(input): $(classpath-classes)
|
$(input): $(classpath-classes)
|
||||||
|
|
||||||
@ -310,22 +299,21 @@ $(jni-objects): $(native-build)/%.o: $(classpath)/%.cpp
|
|||||||
$(cxx) $(jni-cflags) -c $(<) -o $(@)
|
$(cxx) $(jni-cflags) -c $(<) -o $(@)
|
||||||
|
|
||||||
$(archive): $(interpreter-objects) $(jni-objects) $(classpath-object)
|
$(archive): $(interpreter-objects) $(jni-objects) $(classpath-object)
|
||||||
ifeq ($(platform),windows)
|
|
||||||
@echo "creating $(@)"
|
|
||||||
$(dlltool) -z $(@).def $(^)
|
|
||||||
$(dlltool) -k -d $(@).def -e $(@).exp
|
|
||||||
$(ar) cru $(@) $(@).exp $(^)
|
|
||||||
$(ranlib) $(@)
|
|
||||||
else
|
|
||||||
@echo "creating $(@)"
|
@echo "creating $(@)"
|
||||||
|
rm -rf $(@)
|
||||||
$(ar) cru $(@) $(^)
|
$(ar) cru $(@) $(^)
|
||||||
$(ranlib) $(@)
|
$(ranlib) $(@)
|
||||||
endif
|
|
||||||
|
|
||||||
$(interpreter): $(archive) $(driver-object)
|
$(interpreter): \
|
||||||
|
$(interpreter-objects) $(jni-objects) $(classpath-object) $(driver-object)
|
||||||
@echo "linking $(@)"
|
@echo "linking $(@)"
|
||||||
$(cc) $(begin-merge-archive) $(^) $(end-merge-archive) \
|
ifeq ($(platform),windows)
|
||||||
$(lflags) $(rdynamic) -o $(@)
|
$(dlltool) -z $(@).def $(^)
|
||||||
|
$(dlltool) -k -d $(@).def -e $(@).exp
|
||||||
|
$(cc) $(@).exp $(^) $(lflags) -o $(@)
|
||||||
|
else
|
||||||
|
$(cc) $(^) $(lflags) -o $(@)
|
||||||
|
endif
|
||||||
@$(strip) --strip-all $(@)
|
@$(strip) --strip-all $(@)
|
||||||
@$(show-size) $(@)
|
@$(show-size) $(@)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user