Initial implementation of logging library

Signed-off-by: Aidan Hahn <aidan@aidanis.online>
This commit is contained in:
Aidan Hahn 2022-02-27 20:45:41 -08:00
commit 32cea23421
No known key found for this signature in database
GPG key ID: 327711E983899316
6 changed files with 998 additions and 0 deletions

35
Makefile Normal file
View file

@ -0,0 +1,35 @@
CC ?= gcc
CFLAGS = -fPIC -Wall -Wextra -O2 -c
LDFLAGS = -shared
BUILD_DIR ?= $(shell pwd)/build
TARGET_DIR ?= $(shell pwd)/target
ifdef ALOG_HIJACK_PRINTF
CFLAGS += -DALOG_HIJACK_PRINTF
endif
ifdef ALOG_DEBUG
CFLAGS += -g
endif
OBJ = $(BUILD_DIR)/alog.o
LIB = $(TARGET_DIR)/alog.so
.PHONY: so
so: $(if $(shell stat $(LIB)), clean) $(LIB)
$(LIB): $(TARGET_DIR) $(OBJ)
$(CC) $(LDFLAGS) -o $(LIB) $(OBJ)
$(OBJ): $(BUILD_DIR)
$(CC) $(CFLAGS) alog.c -o $(OBJ)
$(BUILD_DIR):
mkdir $(BUILD_DIR)
$(TARGET_DIR):
mkdir $(TARGET_DIR)
.PHONY: clean
clean:
rm $(LIB) $(OBJ)