2024-09-09 06:05:47 +00:00
|
|
|
.POSIX:
|
|
|
|
|
2024-09-10 05:00:06 +00:00
|
|
|
# DIRECTORIES
|
2024-09-09 06:05:47 +00:00
|
|
|
SRC_DIR = src
|
|
|
|
OBJ_DIR = obj
|
2024-09-10 05:00:06 +00:00
|
|
|
X_STRING_DIR = $(SRC_DIR)/xlibc/x_string
|
|
|
|
SQLITE_DIR = $(SRC_DIR)/sqlite3
|
2024-09-09 06:05:47 +00:00
|
|
|
|
2024-09-10 05:00:06 +00:00
|
|
|
# Sources
|
2024-09-09 06:05:47 +00:00
|
|
|
SRC = $(wildcard $(SRC_DIR)/*.c)
|
2024-09-10 05:00:06 +00:00
|
|
|
X_STRING_SRC = $(wildcard $(X_STRING_DIR)/src/*.c)
|
|
|
|
SQLITE_SRC = $(wildcard $(SQLITE_DIR)/src/*.c)
|
2024-09-09 06:05:47 +00:00
|
|
|
|
2024-09-10 05:00:06 +00:00
|
|
|
# Headers
|
|
|
|
HEADERS = $(wildcard $(SRC_DIR)/*.h)
|
|
|
|
X_STRING_HEADERS = $(wildcard $(X_STRING_DIR)/src/*.h)
|
|
|
|
SQLITE_HEADERS = $(wildcard $(SQLITE_DIR)/src/*.h)
|
2024-09-09 06:05:47 +00:00
|
|
|
|
2024-09-10 05:00:06 +00:00
|
|
|
# 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)
|
2024-09-09 06:05:47 +00:00
|
|
|
|
|
|
|
|
2024-09-10 05:00:06 +00:00
|
|
|
SQLITE_DB_SCHEMA = $(SRC_DIR)/dodo.schema
|
|
|
|
INC_DIRS=-I./$(X_STRING_DIR)/src/ -I./$(SQLITE_DIR)/src/
|
2024-09-09 06:05:47 +00:00
|
|
|
|
|
|
|
HOME_DIR = $$HOME
|
|
|
|
CONFIG_DIR = /.config/dodo
|
|
|
|
DB_FILE = $(CONFIG_DIR)/dodo.db
|
|
|
|
DFLAGS = -DDB_PATH=\"$(DB_FILE)\"
|
|
|
|
|
|
|
|
|
|
|
|
all: dodo
|
|
|
|
|
2024-09-10 05:00:06 +00:00
|
|
|
$(OBJ): $(X_STRING_OBJ) $(SQLITE_OBJ) $(HEADERS)
|
|
|
|
$(CC) -c -o $(OBJ_DIR)/$(@F) $(INC_DIRS) $(DFLAGS) $(SRC_DIR)/$(@F:.o=.c)
|
2024-09-09 06:05:47 +00:00
|
|
|
|
2024-09-10 05:00:06 +00:00
|
|
|
$(X_STRING_OBJ): $(X_STRING_HEADERS)
|
2024-09-09 06:05:47 +00:00
|
|
|
$(CC) -c -o $(OBJ_DIR)/$(@F) $(X_STRING_SRC)
|
|
|
|
|
2024-09-10 05:00:06 +00:00
|
|
|
$(SQLITE_OBJ): $(SQLITE_HEADERS)
|
2024-09-09 06:05:47 +00:00
|
|
|
$(CC) -c -o $(OBJ_DIR)/$(@F) $(SQLITE_SRC)
|
|
|
|
|
2024-09-10 05:00:06 +00:00
|
|
|
dodo: $(OBJ)
|
2024-09-09 06:05:47 +00:00
|
|
|
$(CC) -o $@ $(ALL_OBJS)
|
|
|
|
|
|
|
|
install:
|
|
|
|
mkdir -p $(HOME_DIR)$(CONFIG_DIR)
|
2024-09-09 16:58:24 +00:00
|
|
|
sqlite3 $(HOME_DIR)$(DB_FILE) < $(SQLITE_DB_SCHEMA)
|
2024-09-09 06:05:47 +00:00
|
|
|
|
|
|
|
uninstall:
|
|
|
|
rm -rf $(HOME_DIR)$(CONFIG_DIR)
|
|
|
|
|
|
|
|
clean_all:
|
2024-09-09 16:58:24 +00:00
|
|
|
rm -f dodo $(ALL_OBJS)
|
2024-09-09 06:05:47 +00:00
|
|
|
|
|
|
|
clean:
|
2024-09-09 16:58:24 +00:00
|
|
|
rm -f dodo $(OBJ) $(X_STRING_OBJ)
|
2024-09-09 06:05:47 +00:00
|
|
|
|
|
|
|
.PHONY: all clean_all clean install uninstall
|