portable makefiles

Signed-off-by: Aidan Hahn <aidan@aidanis.online>
This commit is contained in:
Aidan Hahn 2022-03-07 00:43:37 -08:00 committed by Aidan Hahn
parent 08d387cae9
commit ca1e2e3453
No known key found for this signature in database
GPG key ID: 327711E983899316
2 changed files with 7 additions and 5 deletions

View file

@ -12,11 +12,12 @@ ifdef ALOG_DEBUG
CFLAGS += -g
endif
ALOG_SRC = alog.c
ALOG_TOP_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
ALOG_SRC = $(ALOG_TOP_DIR)alog.c
ALOG_OBJ = $(BUILD_DIR)/alog.o
ALOG_LIB = $(TARGET_DIR)/alog.so
include tests/tests.mk
include $(dir $(lastword $(MAKEFILE_LIST)))tests/tests.mk
.PHONY: so
alog-so: $(if $(shell stat $(ALOG_LIB)), clean) $(ALOG_LIB)
@ -25,7 +26,7 @@ $(ALOG_LIB): $(TARGET_DIR) $(ALOG_OBJ)
$(CC) $(LDFLAGS) -o $(ALOG_LIB) $(ALOG_OBJ)
$(ALOG_OBJ): $(BUILD_DIR)
$(CC) $(CFLAGS) -fPIC -c alog.c -o $(ALOG_OBJ)
$(CC) $(CFLAGS) -fPIC -c $(ALOG_SRC) -o $(ALOG_OBJ)
$(BUILD_DIR):
mkdir $(BUILD_DIR)