Modified test name and Makefile to build test

This commit is contained in:
xavi 2024-09-09 22:15:07 -07:00
parent 65464112a6
commit f12cb11f23
2 changed files with 10 additions and 2 deletions

View File

@ -1,6 +1,7 @@
.POSIX:
# DIRECTORIES
TEST_DIR = tests
SRC_DIR = src
OBJ_DIR = obj
X_STRING_DIR = $(SRC_DIR)/xlibc/x_string
@ -10,17 +11,20 @@ SQLITE_DIR = $(SRC_DIR)/sqlite3
SRC = $(wildcard $(SRC_DIR)/*.c)
X_STRING_SRC = $(wildcard $(X_STRING_DIR)/src/*.c)
SQLITE_SRC = $(wildcard $(SQLITE_DIR)/src/*.c)
TEST_SRC = $(wildcard $(TEST_DIR)/*.c)
# Headers
HEADERS = $(wildcard $(SRC_DIR)/*.h)
X_STRING_HEADERS = $(wildcard $(X_STRING_DIR)/src/*.h)
SQLITE_HEADERS = $(wildcard $(SQLITE_DIR)/src/*.h)
TEST_HEADERS = $(wildcard $(TEST_DIR)/*.h)
# Objects
OBJ = $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(SRC))
X_STRING_OBJ = $(patsubst $(X_STRING_DIR)/src/%.c, $(OBJ_DIR)/%.o, $(X_STRING_SRC))
SQLITE_OBJ = $(patsubst $(SQLITE_DIR)/src/%.c, $(OBJ_DIR)/%.o, $(SQLITE_SRC))
ALL_OBJS = $(wildcard $(OBJ_DIR)/*.o)
TEST_OBJ = $(patsubst $(TEST_DIR)/%.c, $(OBJ_DIR)/%.o, $(TEST_SRC))
SQLITE_DB_SCHEMA = $(SRC_DIR)/dodo.schema
@ -46,6 +50,10 @@ $(SQLITE_OBJ): $(SQLITE_HEADERS)
dodo: $(OBJ)
$(CC) -o $@ $(ALL_OBJS)
test: $(OBJ)
$(CC) -o $@ $(TEST_SRC) obj/dodo.o $(X_STRING_OBJ) $(SQLITE_OBJ)
install:
mkdir -p $(HOME_DIR)$(CONFIG_DIR)
sqlite3 $(HOME_DIR)$(DB_FILE) < $(SQLITE_DB_SCHEMA)
@ -54,9 +62,9 @@ uninstall:
rm -rf $(HOME_DIR)$(CONFIG_DIR)
clean_all:
rm -f dodo $(ALL_OBJS)
rm -f dodo test $(ALL_OBJS)
clean:
rm -f dodo $(OBJ) $(X_STRING_OBJ)
rm -f dodo test $(OBJ) $(X_STRING_OBJ)
.PHONY: all clean_all clean install uninstall