blob: 025f1564180997d79c0f69dce60d3a4dcc3b6ee2 (
plain) (
tree)
|
|
# 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>.
ifeq "$(arch)" ""
arch := $(shell ../getarch.sh)
ifeq "$(arch)" "unknown"
$(error Unable to detect architecture!)
endif
$(info Detected architecture $(arch) !)
endif
ifeq "$(stdc)" ""
stdc := c99
endif
ifeq "$(stdcxx)" ""
stdcxx := c++14
endif
OBJ_BS_TRAP := source/any/bs/trap.o
OBJ_MATH_ABS := source/any/math/abs.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_STR_FMT := source/any/str/fmt.o
OBJ_STR_FMTLEN := source/any/str/fmtlen.o
OBJ_STR_STREQ := source/any/str/streq.o
OBJ_STR_STRLEN := source/any/str/strlen.o
OBJ_STR_UTF8DEC := source/any/str/utf8dec.o
OBJ_STR_UTF8DECLEN := source/any/str/utf8declen.o
OBJ_STR_UTF8ENC := source/any/str/utf8enc.o
OBJ_STR_UTF8ENCLEN := source/any/str/utf8enclen.o
OBJ_STR_WIN1252DEC := source/any/str/win1252dec.o
OBJ_STR_WIN1252ENC := source/any/str/win1252enc.o
OBJ_SYS_SYSCALL := source/any/sys/syscall.o
ifeq "$(arch)" "amd64"
OBJ_BS_TRAP := source/$(arch)/bs/trap.o
OBJ_MEM_CP := source/$(arch)/mem/cp.o
OBJ_MEM_FILL := source/$(arch)/mem/fill.o
OBJ_SYS_SYSCALL := source/$(arch)/sys/syscall.o
else ifeq "$(arch)" "arm"
OBJ_SYS_SYSCALL := source/$(arch)/sys/syscall.o
else ifeq "$(arch)" "arm64"
OBJ_MEM_CP := source/$(arch)/mem/cp.o
OBJ_SYS_SYSCALL := source/$(arch)/sys/syscall.o
else ifeq "$(arch)" "ia32"
OBJ_SYS_SYSCALL := source/$(arch)/sys/syscall.o
endif
OBJS := \
$(OBJ_BS_TRAP) \
$(OBJ_MATH_ABS) \
$(OBJ_MATH_DIVMOD) \
$(OBJ_MEM_CP) \
$(OBJ_MEM_EQ) \
$(OBJ_MEM_FILL) \
$(OBJ_MEM_SRCH) \
$(OBJ_STR_FMT) \
$(OBJ_STR_FMTLEN) \
$(OBJ_STR_STREQ) \
$(OBJ_STR_STRLEN) \
$(OBJ_STR_UTF8DEC) \
$(OBJ_STR_UTF8DECLEN) \
$(OBJ_STR_UTF8ENC) \
$(OBJ_STR_UTF8ENCLEN) \
$(OBJ_STR_WIN1252DEC) \
$(OBJ_STR_WIN1252ENC)
ifneq "$(nosyscall)" "true"
OBJS := \
$(OBJS) \
$(OBJ_SYS_SYSCALL)
endif
LIB := libzap.a
HDRS := \
include/zap/bs.h \
include/zap/math.h \
include/zap/mem.h
CFLAGS := \
-Iinclude \
-Oz \
-Wall \
-Wextra \
-Wpedantic \
-ffreestanding \
-fshort-enums \
-g \
-nostdlib \
-pipe \
-std=$(stdc)
CXXFLAGS := \
-Iinclude \
-Oz \
-Wall \
-Wextra \
-Wpedantic \
-ffreestanding \
-fno-exceptions \
-fshort-enums \
-g \
-nostdlib \
-pipe \
-std=$(stdcxx)
.PHONY: clean install purge
$(LIB): $(OBJS)
$(AR) r $(@) $(^)
install: $(LIB)
mkdir -pm755 "$(HDRDIR)/zap/bs.d"
mkdir -pm755 "$(HDRDIR)/zap/sys.d"
mkdir -pm755 "$(LIBDIR)"
install -m644 "include/zap/"*".h" "$(HDRDIR)/zap"
install -m644 "include/zap/"*".hh" "$(HDRDIR)/zap"
install -m644 "include/zap/bs.d/"*".h" "$(HDRDIR)/zap/bs.d"
install -m644 "include/zap/sys.d/"*".h" "$(HDRDIR)/zap/sys.d"
install -m755 "$(LIB)" "$(LIBDIR)"
clean:
$(RM) $(OBJS)
purge: clean
$(RM) $(LIB)
|