build: auto detect prefix

This commit is contained in:
Zephyr Lykos 2024-04-01 03:23:51 +08:00
parent 063da61931
commit 5fe8517623
No known key found for this signature in database
GPG Key ID: D3E9D31E2F77F04D
2 changed files with 15 additions and 3 deletions

View File

@ -1,7 +1,15 @@
CC = x86_64-w64-mingw32-gcc
RC = x86_64-w64-mingw32-windres
TARGET = x86_64-w64-mingw32
CFLAGS = -Wall -Wpedantic -DNDEBUG -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/ddk -O0 -std=c23
CC = $(TARGET)-gcc
RC = $(TARGET)-windres
ifdef prefix
PREFIX = $(prefix)
else
PREFIX = /usr/$(TARGET)
endif
CFLAGS = -Wall -Wpedantic -DNDEBUG -I$(PREFIX)/include/ddk -O0 -std=c23
LDFLAGS = -Wl,--subsystem,native \
-Wl,--image-base,0x10000 \
-Wl,--file-alignment,0x1000 \

View File

@ -12,6 +12,10 @@ This project uses the MinGW toolchain to build.
```sh
make
# With custom sysroot (e.g. Fedora MinGW)
mingw64-make # on Fedora
make PREFIX=/path/to/sys-root/prefix # on other systems
# Update third party dependencies (requires peru)
make third_party