pull latest sameboy, rework build system into a makefile
This commit is contained in:
parent
5e34dc6166
commit
e242d35a22
Binary file not shown.
Binary file not shown.
|
@ -1,6 +0,0 @@
|
||||||
.sconsign.dblite
|
|
||||||
BizInterface.os
|
|
||||||
blip_buf.os
|
|
||||||
config.log
|
|
||||||
libsameboy.dll.a
|
|
||||||
.sconf_temp
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
ROOT_DIR := $(realpath .)
|
||||||
|
CORE_DIR := $(realpath $(ROOT_DIR)/libsameboy/Core)
|
||||||
|
OUTPUTDLL_DIR := $(realpath $(ROOT_DIR)/../../Assets/dll)
|
||||||
|
OUTPUTDLLCOPY_DIR := $(realpath $(ROOT_DIR)/../../output/dll)
|
||||||
|
|
||||||
|
OUT_DIR := $(ROOT_DIR)/obj
|
||||||
|
OBJ_DIR := $(OUT_DIR)/release
|
||||||
|
DOBJ_DIR := $(OUT_DIR)/debug
|
||||||
|
|
||||||
|
CC := gcc
|
||||||
|
CCFLAGS := -I$(CORE_DIR) -Wall -Wextra -std=gnu11 -fomit-frame-pointer -Wno-strict-aliasing \
|
||||||
|
-Wno-multichar -Wno-implicit-fallthrough -Wno-sign-compare -Wno-unused-parameter \
|
||||||
|
-Wno-int-in-bool-context -Wno-missing-field-initializers -Wno-overflow -Wno-unused-result \
|
||||||
|
-D_GNU_SOURCE -D_USE_MATH_DEFINES -DNDEBUG -DGB_INTERNAL -DGB_DISABLE_DEBUGGER \
|
||||||
|
-DGB_DISABLE_CHEATS -DGB_DISABLE_TIMEKEEPING -DGB_DISABLE_REWIND -DGB_VERSION=
|
||||||
|
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
TARGET := libsameboy.dll
|
||||||
|
else
|
||||||
|
TARGET := libsameboy.so
|
||||||
|
endif
|
||||||
|
|
||||||
|
SRCS := \
|
||||||
|
$(CORE_DIR)/apu.c \
|
||||||
|
$(CORE_DIR)/random.c \
|
||||||
|
$(CORE_DIR)/camera.c \
|
||||||
|
$(CORE_DIR)/rumble.c \
|
||||||
|
$(CORE_DIR)/save_state.c \
|
||||||
|
$(CORE_DIR)/display.c \
|
||||||
|
$(CORE_DIR)/sgb.c \
|
||||||
|
$(CORE_DIR)/gb.c \
|
||||||
|
$(CORE_DIR)/sm83_cpu.c \
|
||||||
|
$(CORE_DIR)/mbc.c \
|
||||||
|
$(CORE_DIR)/memory.c \
|
||||||
|
$(CORE_DIR)/timing.c \
|
||||||
|
$(CORE_DIR)/printer.c \
|
||||||
|
$(CORE_DIR)/joypad.c \
|
||||||
|
$(ROOT_DIR)/BizInterface.c \
|
||||||
|
$(ROOT_DIR)/blip_buf.c
|
||||||
|
|
||||||
|
LDFLAGS := -shared -Wno-attributes
|
||||||
|
CCFLAGS_DEBUG := -O0 -g
|
||||||
|
CCFLAGS_RELEASE := -O3 -flto
|
||||||
|
LDFLAGS_DEBUG :=
|
||||||
|
LDFLAGS_RELEASE := -s
|
||||||
|
|
||||||
|
_OBJS := $(addsuffix .o,$(realpath $(SRCS)))
|
||||||
|
OBJS := $(patsubst $(ROOT_DIR)%,$(OBJ_DIR)%,$(_OBJS))
|
||||||
|
DOBJS := $(patsubst $(ROOT_DIR)%,$(DOBJ_DIR)%,$(_OBJS))
|
||||||
|
|
||||||
|
$(OBJ_DIR)/%.c.o: %.c
|
||||||
|
@echo cc $<
|
||||||
|
@mkdir -p $(@D)
|
||||||
|
@$(CC) -c -o $@ $< $(CCFLAGS) $(CCFLAGS_RELEASE)
|
||||||
|
$(DOBJ_DIR)/%.c.o: %.c
|
||||||
|
@echo cc $<
|
||||||
|
@mkdir -p $(@D)
|
||||||
|
@$(CC) -c -o $@ $< $(CCFLAGS) $(CCFLAGS_DEBUG)
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := install
|
||||||
|
|
||||||
|
TARGET_RELEASE := $(OBJ_DIR)/$(TARGET)
|
||||||
|
TARGET_DEBUG := $(DOBJ_DIR)/$(TARGET)
|
||||||
|
|
||||||
|
.PHONY: release debug install install-debug
|
||||||
|
|
||||||
|
release: $(TARGET_RELEASE)
|
||||||
|
debug: $(TARGET_DEBUG)
|
||||||
|
|
||||||
|
$(TARGET_RELEASE): $(OBJS)
|
||||||
|
@echo ld $@
|
||||||
|
@$(CC) -o $@ $(LDFLAGS) $(LDFLAGS_RELEASE) $(CCFLAGS) $(CCFLAGS_RELEASE) $(OBJS)
|
||||||
|
$(TARGET_DEBUG): $(DOBJS)
|
||||||
|
@echo ld $@
|
||||||
|
@$(CC) -o $@ $(LDFLAGS) $(LDFLAGS_DEBUG) $(CCFLAGS) $(CCFLAGS_DEBUG) $(DOBJS)
|
||||||
|
|
||||||
|
install: $(TARGET_RELEASE)
|
||||||
|
@cp -f $< $(OUTPUTDLL_DIR)
|
||||||
|
@cp $(OUTPUTDLL_DIR)/$(TARGET) $(OUTPUTDLLCOPY_DIR)/$(TARGET) || true
|
||||||
|
@echo Release build of $(TARGET) installed.
|
||||||
|
|
||||||
|
install-debug: $(TARGET_DEBUG)
|
||||||
|
@cp -f $< $(OUTPUTDLL_DIR)
|
||||||
|
@cp $(OUTPUTDLL_DIR)/$(TARGET) $(OUTPUTDLLCOPY_DIR)/$(TARGET) || true
|
||||||
|
@echo Debug build of $(TARGET) installed.
|
||||||
|
|
||||||
|
.PHONY: clean clean-release clean-debug
|
||||||
|
clean:
|
||||||
|
rm -rf $(OUT_DIR)
|
||||||
|
clean-release:
|
||||||
|
rm -rf $(OUT_DIR)/release
|
||||||
|
clean-debug:
|
||||||
|
rm -rf $(OUT_DIR)/debug
|
||||||
|
|
||||||
|
-include $(OBJS:%o=%d)
|
||||||
|
-include $(DOBJS:%o=%d)
|
|
@ -1,38 +0,0 @@
|
||||||
global_cflags = ARGUMENTS.get('CFLAGS', '-I./libsameboy/Core -Wall -Wextra -O3 -std=gnu11 -fomit-frame-pointer -flto')
|
|
||||||
global_cflags += ARGUMENTS.get('CFLAGS', ' -Wno-strict-aliasing -Wno-multichar -Wno-implicit-fallthrough -Wno-sign-compare')
|
|
||||||
global_cflags += ARGUMENTS.get('CFLAGS', ' -Wno-unused-parameter -Wno-int-in-bool-context -Wno-missing-field-initializers -Wno-overflow')
|
|
||||||
global_defines = ' -D_GNU_SOURCE -D_USE_MATH_DEFINES -DNDEBUG -DGB_INTERNAL -DGB_DISABLE_DEBUGGER -DGB_DISABLE_CHEATS -DGB_DISABLE_TIMEKEEPING -DGB_DISABLE_REWIND -DGB_VERSION='
|
|
||||||
vars = Variables()
|
|
||||||
vars.Add('CC')
|
|
||||||
|
|
||||||
import os
|
|
||||||
env = Environment(ENV = os.environ,
|
|
||||||
CFLAGS = global_cflags + global_defines,
|
|
||||||
variables = vars)
|
|
||||||
|
|
||||||
sourceFiles = Split('''
|
|
||||||
libsameboy/Core/apu.c
|
|
||||||
libsameboy/Core/random.c
|
|
||||||
libsameboy/Core/camera.c
|
|
||||||
libsameboy/Core/rumble.c
|
|
||||||
libsameboy/Core/save_state.c
|
|
||||||
libsameboy/Core/display.c
|
|
||||||
libsameboy/Core/sgb.c
|
|
||||||
libsameboy/Core/gb.c
|
|
||||||
libsameboy/Core/sm83_cpu.c
|
|
||||||
libsameboy/Core/mbc.c
|
|
||||||
libsameboy/Core/memory.c
|
|
||||||
libsameboy/Core/timing.c
|
|
||||||
libsameboy/Core/printer.c
|
|
||||||
libsameboy/Core/joypad.c
|
|
||||||
''')
|
|
||||||
|
|
||||||
conf = env.Configure()
|
|
||||||
|
|
||||||
conf.Finish()
|
|
||||||
|
|
||||||
shlib = env.SharedLibrary('sameboy', sourceFiles + ['BizInterface.c'] + ['blip_buf.c'],
|
|
||||||
LINKFLAGS = env['LINKFLAGS'] + ' -s -Wno-attributes',
|
|
||||||
SHLIBPREFIX = "lib")
|
|
||||||
|
|
||||||
env.Default(shlib)
|
|
|
@ -1,3 +0,0 @@
|
||||||
scons
|
|
||||||
mv ./libsameboy.dll ../../Assets/dll/
|
|
||||||
mv ./libsameboy.so ../../Assets/dll/
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 52ab20054486330a8757641230f55c716ea525e6
|
Subproject commit 7efd26c548f3ce1f1969a53c7ce5b1ed96a42f7b
|
Loading…
Reference in New Issue