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-03 18:51:46 +00:00
|
|
|
@echo " August 3, 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-31 19:20:27 +00:00
|
|
|
@echo " bundle Produces a .jar and deletes all intermediate files"
|
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"
|
|
|
|
@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
|
|
|
|
|
|
|
# Performs a full build and packages it into a .jar
|
|
|
|
.PHONY: bundle
|
|
|
|
bundle:
|
|
|
|
@make -s build
|
2020-07-30 18:04:41 +00:00
|
|
|
@make -s pack
|
|
|
|
@echo " Removing temporary files"
|
|
|
|
@make -s clean_most
|
|
|
|
|
|
|
|
# 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"
|
|
|
|
$(eval coreargs = -c -Isrc/core/include -Wall -Wextra \
|
|
|
|
-fno-strict-aliasing -fsyntax-only src/core/vue.c)
|
|
|
|
@gcc -std=c90 $(coreargs)
|
|
|
|
@gcc -std=c99 $(coreargs)
|
|
|
|
@gcc -std=c11 $(coreargs)
|
|
|
|
|
|
|
|
# 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-03 18:51:46 +00:00
|
|
|
-h src/desktop/native -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)"
|
|
|
|
@jar -cfe $(jarname) Main *.class \
|
2020-08-01 23:28:47 +00:00
|
|
|
app images locale native src util vue makefile license.txt
|
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-01 20:42:28 +00:00
|
|
|
@rm -f src/desktop/native/vue_NativeVUE.h native/*.dll native/*.so
|
2020-07-30 18:04:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Native Recipes #
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
# JNI header file
|
|
|
|
src/desktop/native/vue_NativeVUE.h: src/desktop/vue/NativeVUE.java
|
|
|
|
@javac -h src/desktop/native -sourcepath src/desktop -d . \
|
|
|
|
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
|
|
|
|
lin32_pre: src/desktop/native/vue_NativeVUE.h
|
|
|
|
$(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
|
|
|
|
lin64_pre: src/desktop/native/vue_NativeVUE.h
|
|
|
|
$(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
|
|
|
|
win32_pre: src/desktop/native/vue_NativeVUE.h
|
|
|
|
$(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
|
|
|
|
win64_pre: src/desktop/native/vue_NativeVUE.h
|
|
|
|
$(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-07-30 18:04:41 +00:00
|
|
|
-fno-strict-aliasing \
|
|
|
|
-o native/$(name)$(ext) src/desktop/native/native.c src/core/vue.c
|