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

@ -1,8 +1,9 @@
ALOG_TEST_SRCS = $(shell find tests -iname "*.c" -exec basename {} \;)
ALOG_TEST_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
ALOG_TEST_SRCS = $(shell find $(ALOG_TEST_DIR) -iname "*.c" -exec basename {} \;)
ALOG_TESTS = $(ALOG_TEST_SRCS:.c=)
$(ALOG_TESTS): $(ALOG_LIB)
$(CC) $(CFLAGS) -g -o $(BUILD_DIR)/$@.o -c tests/$@.c
$(CC) $(CFLAGS) -g -o $(BUILD_DIR)/$@.o -c $(ALOG_TEST_DIR)$@.c
$(CC) -o $(TARGET_DIR)/$@ $(BUILD_DIR)/$@.o $(ALOG_LIB) -lpthread
chmod +x $(TARGET_DIR)/$@