2020-07-30 18:04:41 +00:00
|
|
|
# Java include directory pathnames
|
|
|
|
# The Windows files need to be copied from a Windows JDK installation
|
2020-08-03 18:51:46 +00:00
|
|
|
include_linux = /usr/lib/jvm/java-14-openjdk-`\
|
2020-07-30 18:04:41 +00:00
|
|
|
uname -r | sed 's/.*-//'`/include
|
|
|
|
include_windows = jni-windows-include
|
|
|
|
|
|
|
|
# Default goal
|
|
|
|
.PHONY: default
|
|
|
|
default:
|
|
|
|
@echo
|
|
|
|
@echo "Planet Virtual Boy Emulator"
|
|
|
|
@echo " https://www.planetvb.com/"
|
2020-08-05 19:33:04 +00:00
|
|
|
@echo " August 5, 2020"
|
2020-07-30 18:04:41 +00:00
|
|
|
@echo
|
|
|
|
@echo "Intended build environment: Debian i386 or amd64"
|
|
|
|
@echo " gcc-multilib"
|
|
|
|
@echo " mingw-w64"
|
2020-08-03 18:51:46 +00:00
|
|
|
@echo " openjdk-14-jdk"
|
2020-07-30 18:04:41 +00:00
|
|
|
@echo
|
|
|
|
@echo "Usage: make <recipe>"
|
|
|
|
@echo " Package recipes:"
|
2020-08-03 02:21:59 +00:00
|
|
|
@echo " build Compiles the native modules and desktop application"
|
2020-07-30 18:04:41 +00:00
|
|
|
@echo " clean Deletes all output files"
|
|
|
|
@echo " core Check the native core library for style errors"
|
|
|
|
@echo " desktop Compiles the Java desktop application"
|
|
|
|
@echo " native Builds all native modules"
|
|
|
|
@echo " pack Bundles everything in a .jar file"
|
2020-08-05 02:17:56 +00:00
|
|
|
@echo " release Produces a .jar and deletes all intermediate files"
|
2020-07-30 18:04:41 +00:00
|
|
|
@echo " Native recipes:"
|
|
|
|
@echo " lin32 Builds native module linux_x86"
|
|
|
|
@echo " lin64 Builds native module linux_x86-64"
|
|
|
|
@echo " win32 Builds native module windows_x86"
|
|
|
|
@echo " win64 Builds native module windows_x86-64"
|
|
|
|
@echo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Package Recipes #
|
|
|
|
###############################################################################
|
|
|
|
|
2020-08-03 02:21:59 +00:00
|
|
|
# Perform a full build process of the native modules and desktop application
|
|
|
|
.PHONY: build
|
|
|
|
build:
|
2020-07-30 18:04:41 +00:00
|
|
|
@make -s core
|
|
|
|
@make -s desktop
|
|
|
|
@make -s native
|
2020-08-03 02:21:59 +00:00
|
|
|
|
2020-07-30 18:04:41 +00:00
|
|
|
# Delete all output files
|
|
|
|
.PHONY: clean
|
|
|
|
clean: clean_most
|
|
|
|
@rm -f pvbemu_*.jar
|
|
|
|
|
|
|
|
# Check the native core library for style errors
|
|
|
|
.PHONY: core
|
|
|
|
core:
|
|
|
|
@echo " Checking native core library for style errors"
|
2020-08-04 01:34:02 +00:00
|
|
|
$(eval coreargs = -c -Isrc/core/include -Werror -Wall -Wextra -Wpedantic \
|
2020-07-30 18:04:41 +00:00
|
|
|
-fno-strict-aliasing -fsyntax-only src/core/vue.c)
|
|
|
|
@gcc -std=c90 $(coreargs)
|
2020-08-04 01:34:02 +00:00
|
|
|
@gcc -std=c90 -D VUE_BIGENDIAN $(coreargs)
|
2020-07-30 18:04:41 +00:00
|
|
|
@gcc -std=c99 $(coreargs)
|
2020-08-04 01:34:02 +00:00
|
|
|
@gcc -std=c99 -D VUE_BIGENDIAN $(coreargs)
|
2020-07-30 18:04:41 +00:00
|
|
|
@gcc -std=c11 $(coreargs)
|
2020-08-04 01:34:02 +00:00
|
|
|
@gcc -std=c11 -D VUE_BIGENDIAN $(coreargs)
|
2020-07-30 18:04:41 +00:00
|
|
|
|
|
|
|
# Compile the Java desktop application
|
|
|
|
.PHONY: desktop
|
|
|
|
desktop: clean_desktop
|
|
|
|
@echo " Compiling Java desktop application"
|
2020-08-01 20:42:28 +00:00
|
|
|
@javac -sourcepath src/desktop --release 10 -Xlint:unchecked \
|
2020-08-06 21:37:05 +00:00
|
|
|
-h src/desktop/vue -d . src/desktop/Main.java
|
2020-07-30 18:04:41 +00:00
|
|
|
|
|
|
|
# Build all native modules
|
|
|
|
.PHONY: native
|
|
|
|
native:
|
|
|
|
@make -s lin32
|
|
|
|
@make -s lin64
|
|
|
|
@make -s win32
|
|
|
|
@make -s win64
|
|
|
|
|
|
|
|
# Package the release into a .jar file
|
|
|
|
.PHONY: pack
|
|
|
|
pack:
|
|
|
|
$(eval jarname = "pvbemu_`date +%Y%m%d`.jar")
|
|
|
|
@echo " Bundling into $(jarname)"
|
2020-08-05 19:33:04 +00:00
|
|
|
@jar -cfe $(jarname) Main *.class license.txt \
|
|
|
|
app images locale native util vue
|
2020-07-30 18:04:41 +00:00
|
|
|
|
2020-08-05 02:17:56 +00:00
|
|
|
# Performs a full build and packages it into a .jar
|
|
|
|
.PHONY: release
|
|
|
|
release:
|
|
|
|
@make -s build
|
|
|
|
@make -s pack
|
|
|
|
@echo " Removing temporary files"
|
|
|
|
@make -s clean_most
|
|
|
|
|
2020-07-30 18:04:41 +00:00
|
|
|
# Delete only Java .class files
|
|
|
|
.PHONY: clean_desktop
|
|
|
|
clean_desktop:
|
2020-08-01 20:42:28 +00:00
|
|
|
@rm -r -f *.class app util vue
|
2020-07-30 18:04:41 +00:00
|
|
|
|
|
|
|
# Delete everything but the .jar
|
|
|
|
.PHONY: clean_most
|
|
|
|
clean_most: clean_desktop
|
2020-08-06 21:37:05 +00:00
|
|
|
@rm -f src/desktop/vue/vue_NativeVUE.h native/*.dll native/*.so
|
2020-07-30 18:04:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Native Recipes #
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
# JNI header file
|
2020-08-06 21:37:05 +00:00
|
|
|
src/desktop/vue/vue_NativeVUE.h: src/desktop/vue/NativeVUE.java
|
|
|
|
@javac -h src/desktop/vue -sourcepath src/desktop -d . \
|
2020-07-30 18:04:41 +00:00
|
|
|
src/desktop/vue/NativeVUE.java
|
2020-08-03 18:51:46 +00:00
|
|
|
@sleep 3
|
2020-07-30 18:04:41 +00:00
|
|
|
|
|
|
|
# linux_x86
|
|
|
|
.PHONY: lin32_pre
|
2020-08-06 21:37:05 +00:00
|
|
|
lin32_pre: src/desktop/vue/vue_NativeVUE.h
|
2020-07-30 18:04:41 +00:00
|
|
|
$(eval name = linux_x86)
|
|
|
|
$(eval prefix = `uname -m`-linux-gnu-)
|
|
|
|
$(eval include = -I$(include_linux) -I$(include_linux)/linux)
|
|
|
|
$(eval gccargs = -m32 -lm)
|
|
|
|
$(eval ext = .so)
|
|
|
|
.PHONY: lin32
|
|
|
|
lin32: lin32_pre native_common
|
|
|
|
|
|
|
|
# linux_x86-64
|
|
|
|
.PHONY: lin64_pre
|
2020-08-06 21:37:05 +00:00
|
|
|
lin64_pre: src/desktop/vue/vue_NativeVUE.h
|
2020-07-30 18:04:41 +00:00
|
|
|
$(eval name = linux_x86-64)
|
|
|
|
$(eval prefix = `uname -m`-linux-gnu-)
|
|
|
|
$(eval include = -I$(include_linux) -I$(include_linux)/linux)
|
|
|
|
$(eval gccargs = -m64 -lm)
|
|
|
|
$(eval ext = .so)
|
|
|
|
.PHONY: lin64
|
|
|
|
lin64: lin64_pre native_common
|
|
|
|
|
|
|
|
# windows_x86
|
|
|
|
.PHONY: win32_pre
|
2020-08-06 21:37:05 +00:00
|
|
|
win32_pre: src/desktop/vue/vue_NativeVUE.h
|
2020-07-30 18:04:41 +00:00
|
|
|
$(eval name = windows_x86)
|
|
|
|
$(eval prefix = i686-w64-mingw32-)
|
|
|
|
$(eval include = -I$(include_windows) -I$(include_windows)/win32)
|
|
|
|
$(eval ext = .dll)
|
|
|
|
.PHONY: win32
|
|
|
|
win32: win32_pre native_common
|
|
|
|
|
|
|
|
# windows_x86-64
|
|
|
|
.PHONY: win64_pre
|
2020-08-06 21:37:05 +00:00
|
|
|
win64_pre: src/desktop/vue/vue_NativeVUE.h
|
2020-07-30 18:04:41 +00:00
|
|
|
$(eval name = windows_x86-64)
|
|
|
|
$(eval prefix = x86_64-w64-mingw32-)
|
|
|
|
$(eval include = -I$(include_windows) -I$(include_windows)/win32)
|
|
|
|
$(eval ext = .dll)
|
|
|
|
.PHONY: win64
|
|
|
|
win64: win64_pre native_common
|
|
|
|
|
|
|
|
# Common recipe for building native modules
|
|
|
|
.PHONY: native_common
|
|
|
|
native_common:
|
|
|
|
@echo " Building native module $(name)"
|
2020-08-03 18:51:46 +00:00
|
|
|
@$(prefix)gcc $(include) -Isrc/core/include $(gccargs) -s -shared -O2 \
|
2020-08-04 01:34:02 +00:00
|
|
|
-fno-strict-aliasing -Werror \
|
2020-08-06 21:37:05 +00:00
|
|
|
-o native/$(name)$(ext) src/desktop/vue/NativeVUE.c src/core/vue.c
|