ladybird/Ports/SDL2-GNUBoy/patches/0001-Rewrite-the-makefile-for-serenity.patch

91 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Sun, 15 May 2022 17:39:49 +0430
Subject: [PATCH] Rewrite the makefile for serenity
Co-Authored-By: Gunnar Beutner <gbeutner@serenityos.org>
---
makefile | 68 ++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 49 insertions(+), 19 deletions(-)
diff --git a/makefile b/makefile
index 8730b6c..bc1fefb 100644
--- a/makefile
+++ b/makefile
@@ -1,25 +1,55 @@
-.PHONY: all
-.PHONY: clean
+prefix = ${DESTDIR}/usr/local
+exec_prefix = ${prefix}
+bindir = ${exec_prefix}/bin
-.PHONY: linux
-linux:
- make -f makefile.linux
- rm -f sys/*/*.o src/*.o lib/*/*.o
+LD = $(CC)
+AS = $(CC)
+INSTALL = /usr/bin/install -c
-.PHONY: windows
-windows:
- make -f makefile.windows
- rm -f sys/*/*.o src/*.o lib/*/*.o
+CFLAGS = -std=c99 -Wall -O3 -I./include
+LDFLAGS = $(CFLAGS) -s -lSDL2
+ASFLAGS = $(CFLAGS)
-.PHONY: mingw
-mingw:
- make -f makefile.mingw
- rm -f sys/*/*.o src/*.o lib/*/*.o
+TARGETS = sdl2gnuboy
-.PHONY: osx
-osx:
- make -f makefile.osx
- rm -f sys/*/*.o src/*.o lib/*/*.o
+SYS_DEFS = -DIS_LITTLE_ENDIAN -DIS_LINUX -DSOUND
+SYS_OBJS = sys/nix/nix.o
+SYS_INCS = -I./sys/nix
+
+SDL_OBJS = sys/sdl2/sdl-video.o sys/sdl2/sdl-audio.o sys/sdl2/sdl-input.o
+SDL_LIBS = -lSDL2 -lpthread
+SDL_CFLAGS = -D_GNU_SOURCE=1 -D_REENTRANT `sdl2-config --cflags --libs`
+
+
+all: $(TARGETS)
+
+XZ_OBJS = lib/xz/xz_crc32.o lib/xz/xz_crc64.o lib/xz/xz_dec_lzma2.o lib/xz/xz_dec_stream.o lib/xz/xz_dec_bcj.o
+
+OBJS = ./src/lcd.o ./src/refresh.o ./src/lcdc.o ./src/palette.o ./src/cpu.o ./src/mem.o ./src/rtc.o ./src/hw.o ./src/sound.o \
+ ./src/events.o ./src/keytable.o \
+ ./src/loader.o ./src/save.o ./src/debug.o ./src/emu.o ./src/main.o \
+ ./src/rccmds.o ./src/rckeys.o ./src/rcvars.o ./src/rcfile.o ./src/exports.o \
+ ./src/split.o ./src/path.o ./lib/gz/inflate.o $(XZ_OBJS)
+
+INCS = -I.
+
+MYCC = $(CC) $(CFLAGS) $(INCS) $(SYS_INCS) $(SYS_DEFS)
+MYAS = $(AS) $(ASFLAGS) $(INCS) $(SYS_INCS) $(SYS_DEFS)
+
+main.o: Version
+
+.c.o:
+ $(MYCC) -c $< -o $@
+
+.s.o:
+ $(MYAS) -c $< -o $@
+
+sdl2gnuboy: $(OBJS) $(SYS_OBJS) $(SDL_OBJS)
+ $(LD) $(LDFLAGS) $(OBJS) $(SYS_OBJS) $(SDL_OBJS) -o $@ $(SDL_LIBS)
+
+install: all
+ $(INSTALL) -d $(bindir)
+ $(INSTALL) -m 755 $(TARGETS) $(bindir)
clean:
- rm -f *gnuboy sdl2gnuboy.exe mac-sdl2gnuboy gmon.out *.o sys/*.o lib/*/*.o sys/*/*.o src/*.o
\ No newline at end of file
+ rm -f *gnuboy sdl2gnuboy.exe gmon.out *.o sys/*.o sys/*/*.o $(OBJS)