2022-06-19 19:36:27 +02:00
|
|
|
OUT = TAL
|
2022-08-15 15:57:15 +02:00
|
|
|
CC := x86_64-w64-mingw32-gcc
|
2022-06-19 19:36:27 +02:00
|
|
|
TARGET := x86_64-pc-windows-gnu
|
|
|
|
SDL_TARGET := x86_64-w64-mingw32
|
2022-08-18 16:34:43 +02:00
|
|
|
SRC = src/dllmain.c src/helpers.c src/poll.c src/boilerplate.c tomlc99/toml.c minhook/src/buffer.c minhook/src/hook.c minhook/src/trampoline.c minhook/src/hde/hde32.c minhook/src/hde/hde64.c
|
|
|
|
OBJ = ${addprefix ${TARGET}/,${SRC:.c=.o}}
|
2022-08-15 15:57:15 +02:00
|
|
|
CFLAGS = -std=c99 -Iminhook/include -ISDL/${SDL_TARGET}/include -ISDL/include -Itomlc99 -Wall -Ofast -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=_WIN32_WINNT_WIN7
|
2022-06-19 19:36:27 +02:00
|
|
|
LDFLAGS := -shared -static -static-libgcc -s
|
2022-08-15 15:57:15 +02:00
|
|
|
LIBS := SDL/${SDL_TARGET}/build/.libs/libSDL2.a SDL/${SDL_TARGET}/build/.libs/libSDL2main.a -lmingw32 -luuid -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lsetupapi -lversion -pthread
|
2022-06-19 19:36:27 +02:00
|
|
|
DEPS = SDL
|
|
|
|
|
|
|
|
all: options ${OUT}
|
|
|
|
|
|
|
|
.PHONY: dirs
|
|
|
|
dirs:
|
|
|
|
@mkdir -p ${TARGET}/src
|
|
|
|
@mkdir -p ${TARGET}/minhook/src/hde
|
|
|
|
@mkdir -p ${TARGET}/tomlc99
|
|
|
|
|
|
|
|
.PHONY: options
|
|
|
|
options:
|
|
|
|
@echo "CFLAGS = ${CFLAGS}"
|
|
|
|
@echo "LDFLAGS = ${LDFLAGS}"
|
|
|
|
@echo "CC = ${CC}"
|
|
|
|
|
|
|
|
${TARGET}/%.o: %.c
|
|
|
|
@echo BUILD $@
|
|
|
|
@${CC} -c ${CFLAGS} $< -o $@
|
2022-08-15 15:57:15 +02:00
|
|
|
|
2022-06-22 02:47:25 +02:00
|
|
|
.PHONY: SDL
|
|
|
|
SDL:
|
|
|
|
@mkdir -p SDL/${SDL_TARGET}
|
2022-08-15 16:28:18 +02:00
|
|
|
@cd SDL/${SDL_TARGET} && ../configure --build=x86_64-linux-gnu --host=${SDL_TARGET} --disable-sdl2-config --disable-shared --enable-assertions=release --enable-directx --enable-haptic
|
2022-06-22 02:47:25 +02:00
|
|
|
@make -s -C SDL/${SDL_TARGET}
|
|
|
|
|
2022-06-19 19:36:27 +02:00
|
|
|
.PHONY: ${OUT}
|
|
|
|
${OUT}: dirs ${DEPS} ${OBJ}
|
|
|
|
@echo LINK $@
|
2022-08-18 16:34:43 +02:00
|
|
|
@${CC} ${CFLAGS} -o ${TARGET}/$@.dll ${OBJ} ${LDFLAGS} ${LIBS}
|
2022-06-19 19:36:27 +02:00
|
|
|
|
|
|
|
.PHONY: fmt
|
|
|
|
fmt:
|
|
|
|
@cd src && clang-format -i *.h *.c -style=file
|
2022-06-24 05:40:39 +02:00
|
|
|
@cd patches/8.18 && clang-format -i *.c -style=file
|
2022-09-15 22:38:53 +02:00
|
|
|
@cd patches/amauth && clang-format -i *.c -style=file
|
2022-06-19 19:36:27 +02:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf ${TARGET}
|
|
|
|
|
2022-06-22 02:47:25 +02:00
|
|
|
.PHONY: patches
|
|
|
|
patches:
|
|
|
|
make -C patches/8.18
|
2022-09-15 22:38:53 +02:00
|
|
|
make -C patches/amauth
|
2022-06-22 02:47:25 +02:00
|
|
|
|
2022-06-22 02:49:31 +02:00
|
|
|
.PHONY: dist-no-7z
|
2022-06-22 02:55:43 +02:00
|
|
|
dist-no-7z: options ${OUT} patches
|
2022-06-22 02:47:25 +02:00
|
|
|
mkdir -p out/plugins
|
|
|
|
cp ${TARGET}/${OUT}.dll out/
|
2022-06-22 03:36:55 +02:00
|
|
|
mv out/${OUT}.dll out/bnusio.dll
|
2022-06-22 02:47:25 +02:00
|
|
|
cp ${TARGET}/patches.*.dll out/plugins
|
2022-08-18 16:09:45 +02:00
|
|
|
cp -r dist/* out/
|
2022-06-22 02:49:31 +02:00
|
|
|
|
|
|
|
.PHONY: dist
|
|
|
|
dist: dist-no-7z
|
2022-06-22 02:47:25 +02:00
|
|
|
cd out && 7z a -t7z ../${OUT}.7z .
|
|
|
|
rm -rf out
|