diff options
Diffstat (limited to 'zap/GNUmakefile')
-rw-r--r-- | zap/GNUmakefile | 133 |
1 files changed, 67 insertions, 66 deletions
diff --git a/zap/GNUmakefile b/zap/GNUmakefile index 940e993..7567c76 100644 --- a/zap/GNUmakefile +++ b/zap/GNUmakefile @@ -1,78 +1,79 @@ -# Copyright 2022 Gabriel Jensen. +# Copyright 2022-2023 Gabriel Jensen. # This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. -# If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. +# If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. -ifneq "$(arch)" "amd64" -$(error invalid architecture) +ifeq "$(arch)" "" +arch := $(shell ../getarch.sh) +ifeq "$(arch)" "unknown" +$(error Unable to detect architecture!) +endif +$(info Detected architecture $(arch) !) endif -# TOOLS - -#CC = clang -#CC = gcc - -# TOOL FLAGS - -ASFLAGS := \ - -g \ - -march=native - -CFLAGS := \ - -Ofast \ - -Wall \ - -Wextra \ - -Wpedantic \ - -fPIC \ - -ffreestanding \ - -gdwarf-2 \ - -march=native \ - -std=c90 - -CPPFLAGS := \ - -Iinclude \ - -Iinclude-private \ - -# ARTEFACTS - -OBJS = \ - source/$(arch)/mem/memcnt.o \ - source/$(arch)/mem/memcp.o \ - source/$(arch)/mem/memeq.o \ - source/$(arch)/mem/memfill.o \ - source/$(arch)/mem/memfnd.o \ - source/$(arch)/mem/memfor.o \ - source/$(arch)/mem/memgen.o \ - source/$(arch)/mem/streq.o \ - source/$(arch)/mem/strfill.o \ - source/$(arch)/mem/strfnd.o \ - source/$(arch)/mem/strcp.o \ - source/$(arch)/mem/strlen.o \ - source/$(arch)/mem/utf20len.o \ - source/$(arch)/mem/utf8dec.o \ - source/$(arch)/mem/utf8declen.o \ - source/$(arch)/mem/utf8enc.o \ - source/$(arch)/mem/utf8enclen.o \ - source/$(arch)/mem/win1252dec.o \ - source/$(arch)/mem/win1252enc.o \ - source/$(arch)/mth/abs.o - -LIB = libzap.a - -# OPTIONS - -# TARGETS +OBJ_BS_TRAP := source/any/bs/trap.o +OBJ_MATH_ABS := source/any/math/abs.o +OBJ_MATH_DIV0 := source/any/math/div0.o +OBJ_MATH_DIVMOD := source/any/math/divmod.o +OBJ_MEM_CP := source/any/mem/cp.o +OBJ_MEM_EQ := source/any/mem/eq.o +OBJ_MEM_FILL := source/any/mem/fill.o +OBJ_MEM_SRCH := source/any/mem/srch.o +OBJ_MEM_UTF8DEC := source/any/mem/utf8dec.o +OBJ_MEM_UTF8DECLEN := source/any/mem/utf8declen.o +OBJ_MEM_UTF8ENC := source/any/mem/utf8enc.o +OBJ_MEM_UTF8ENCLEN := source/any/mem/utf8enclen.o +OBJ_MEM_WIN1252DEC := source/any/mem/win1252dec.o +OBJ_MEM_WIN1252ENC := source/any/mem/win1252enc.o + +OBJS := \ + $(OBJ_BS_TRAP) \ + $(OBJ_MATH_ABS) \ + $(OBJ_MATH_DIV0) \ + $(OBJ_MATH_DIVMOD) \ + $(OBJ_MEM_CP) \ + $(OBJ_MEM_EQ) \ + $(OBJ_MEM_FILL) \ + $(OBJ_MEM_SRCH) \ + $(OBJ_MEM_UTF8DEC) \ + $(OBJ_MEM_UTF8DECLEN) \ + $(OBJ_MEM_UTF8ENC) \ + $(OBJ_MEM_UTF8ENCLEN) \ + $(OBJ_MEM_WIN1252DEC) \ + $(OBJ_MEM_WIN1252ENC) + +LIB := libzap.a + +HDRS := \ + include/zap/bs.h \ + include/zap/math.h \ + include/zap/mem.h + +CFLAGS := \ + -Iinclude \ + -Oz \ + -Wall \ + -Wextra \ + -Wpadded \ + -Wpedantic \ + -ffreestanding \ + -fno-strict-aliasing \ + -fshort-enums \ + -nostdlib \ + -pipe \ + -std=c99 + +ifeq "$(signaldiv0)" "true" +$(info signaldiv0 has been enabled! Remember to link with csys!) +CFLAGS := \ + $(CFLAGS) \ + -Dzap_priv_signaldiv0 +endif -.PHONY: clean install purge +.PHONY: clean purge $(LIB): $(OBJS) $(AR) r $(@) $(^) -install: $(LIB) - mkdir -pm755 "$(HDRDIR)/zap" - mkdir -pm755 "$(LIBDIR)" - install -m644 "include/zap/"*".h" "$(HDRDIR)/zap" - install -m755 "$(LIB)" "$(LIBDIR)" - clean: $(RM) $(OBJS) |