Allow cross-compilation.

This commit is contained in:
Philippe Pittoli 2024-03-21 13:02:02 +01:00
parent d441b3bf88
commit 3190dae731
2 changed files with 17 additions and 1 deletions

View File

@ -5,8 +5,11 @@ help:
ZIGOPTS ?=
ZIGOPTIM ?= ReleaseSafe
-include makefile.target
build:
zig build -Doptimize=$(ZIGOPTIM) $(ZIGOPTS)
zig build -Doptimize=$(ZIGOPTIM) $(ZIGOPTS) $(TARGET_OPTION)
PREFIX ?= /usr/local
LIBDIR ?= $(PREFIX)/lib

13
makefile.target Normal file
View File

@ -0,0 +1,13 @@
# This makefile include specific target options.
TARGET ?=
ifneq ($(TARGET),)
TARGET_OPTION=-Dtarget=$(TARGET)
endif
# In case the target is openbsd, and since the OpenBSD libc doesn't include a few system calls
# used in any other zig compilation mode, we are forced to compile in ReleaseSmall.
ifeq ($(TARGET),x86_64-openbsd)
ZIGOPTIM = ReleaseSmall
endif