From 499dec4ac145f38dfc5ef1815e4cf2b99ec54812 Mon Sep 17 00:00:00 2001 From: Apaczer <94932128+Apaczer@users.noreply.github.com> Date: Tue, 3 Sep 2024 20:57:34 +0200 Subject: [PATCH] Makefile: refactor/neutralize --- Makefile | 66 +++++++++++++++++++++++++++------ README.md | 11 ++++++ readme.txt => readme-dingux.txt | 0 readme_miyoo.txt | 6 --- readmeagain.md | 3 -- 5 files changed, 65 insertions(+), 21 deletions(-) create mode 100644 README.md rename readme.txt => readme-dingux.txt (100%) delete mode 100644 readme_miyoo.txt delete mode 100644 readmeagain.md diff --git a/Makefile b/Makefile index 4331990..fb5eede 100644 --- a/Makefile +++ b/Makefile @@ -81,9 +81,9 @@ alldir = burn \ generated \ sdl-dingux #cpu/nec -incdir = $(foreach dir,$(alldir),-I$(srcdir)$(dir)) -I$(objdir)generated -I$(srcdir) -I/opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/include -I/opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/include/SDL +incdir = $(foreach dir,$(alldir),-I$(srcdir)$(dir)) -I$(objdir)generated -I$(srcdir) -lib = -lstdc++ -lSDL -lSDL_image -lz +lib = -lstdc++ ifdef USE_LIBAO lib += -lao @@ -254,19 +254,61 @@ alldep = $(foreach file,$(autobj:.o=.c), \ HOSTCC = gcc HOSTCXX = g++ -CC = /opt/miyoo/bin/arm-miyoo-linux-uclibcgnueabi-gcc -CXX = /opt/miyoo/bin/arm-miyoo-linux-uclibcgnueabi-g++ -LD = $(CXX) -AS = /opt/miyoo/bin/arm-miyoo-linux-uclibcgnueabi-as - HOSTCFLAGS = $(incdir) -CFLAGS = -O2 -march=armv5te -mtune=arm926ej-s -pipe -fno-builtin -fno-common \ - -fomit-frame-pointer -fexpensive-optimizations -Wno-write-strings -DLSB_FIRST -CXXFLAGS = -O2 -march=armv5te -mtune=arm926ej-s -pipe -fno-builtin -fno-common \ - -fomit-frame-pointer -fexpensive-optimizations -Wno-write-strings -DLSB_FIRST +CHAINPREFIX ?= /opt/miyoo +CROSS_COMPILE ?= $(CHAINPREFIX)/usr/bin/arm-linux- +CC = $(CROSS_COMPILE)gcc +CXX = $(CROSS_COMPILE)g++ +# `ld` fail with gcc platform cflags, use cc instead +LD = $(CC) +AS = $(CROSS_COMPILE)as + +PKG_CONFIG ?= $(CHAINPREFIX)/usr/bin/pkg-config +PKGS = sdl SDL_image zlib +PKGS_CFLAGS = $(shell $(PKG_CONFIG) --cflags $(PKGS)) +PKGS_LIBS = $(shell $(PKG_CONFIG) --libs $(PKGS)) +# use custom -O2 flags (imported from GCC 9.5) to be less agressive +O2_OPT = -falign-functions -falign-jumps \ + -falign-labels -falign-loops \ + -fcaller-saves \ + -fcode-hoisting \ + -fcrossjumping \ + -fcse-follow-jumps -fcse-skip-blocks \ + -fdelete-null-pointer-checks \ + -fdevirtualize -fdevirtualize-speculatively \ + -fexpensive-optimizations \ + -fgcse -fgcse-lm \ + -fhoist-adjacent-loads \ + -finline-small-functions \ + -findirect-inlining \ + -fipa-bit-cp -fipa-cp -fipa-icf \ + -fipa-ra -fipa-sra -fipa-vrp \ + -fisolate-erroneous-paths-dereference \ + -flra-remat \ + -foptimize-sibling-calls \ + -foptimize-strlen \ + -fpartial-inlining \ + -fpeephole2 \ + -freorder-blocks-algorithm=stc \ + -freorder-functions \ + -frerun-cse-after-loop \ + -fschedule-insns -fschedule-insns2 \ + -fsched-interblock -fsched-spec \ + -fstore-merging \ + -fstrict-aliasing \ + -fthread-jumps \ + -ftree-builtin-call-dce \ + -ftree-pre \ + -ftree-switch-conversion -ftree-tail-merge \ + -ftree-vrp +CFLAGS = $(O2_OPT) -march=armv5te -mtune=arm926ej-s -pipe -fno-builtin -fno-common \ + -fomit-frame-pointer -Wno-write-strings -DLSB_FIRST CFLAGS += -D__cdecl="" -D__fastcall="" -CXXFLAGS += -D__cdecl="" -D__fastcall="" +CFLAGS += $(PKGS_CFLAGS) +CXXFLAGS = $(CFLAGS) + +lib += $(PKGS_LIBS) ifdef USE_LIBAO CFLAGS += -DUSE_LIBAO diff --git a/README.md b/README.md new file mode 100644 index 0000000..50f7c8b --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +## FBA - Final Burn Alpha SDL for MiyooCFW + +### Cross-Compile build (MiyooCFW): +``` +make -j$(nproc) +``` + +### Native build (linux): +``` +no instructions yet +``` diff --git a/readme.txt b/readme-dingux.txt similarity index 100% rename from readme.txt rename to readme-dingux.txt diff --git a/readme_miyoo.txt b/readme_miyoo.txt deleted file mode 100644 index 71bcc40..0000000 --- a/readme_miyoo.txt +++ /dev/null @@ -1,6 +0,0 @@ -This source requires the old miyoo toolchain (uclibcgnueabi) to successfully build and run: -https://github.com/steward-fu/miyoo/releases/download/v1.0/toolchain.7z - -To build, edit "Makefile" to point CC, CXX, AS, and the directory paths in "incdir" to your installation of the Miyoo toolchain, then go into the source main directory, and run "make". - -You may also need to give the Perl scripts in "src/scripts" executive permissions. If they can't execute/run, the build will fail. diff --git a/readmeagain.md b/readmeagain.md deleted file mode 100644 index 4ce83f5..0000000 --- a/readmeagain.md +++ /dev/null @@ -1,3 +0,0 @@ -## 说明 - -这个是miyoo用的fba-a320模拟器源码,z80和C68用的drz80和cylone汇编代码替换。部分游戏满帧,但是恐龙世纪等部分游戏没声音。 \ No newline at end of file