diff --git a/makefile b/makefile index 904070a..dd12a11 100644 --- a/makefile +++ b/makefile @@ -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 diff --git a/makefile.target b/makefile.target new file mode 100644 index 0000000..9295aec --- /dev/null +++ b/makefile.target @@ -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