first commit, initial layout and some ideas I want to implement, included my linked list impl

This commit is contained in:
2026-01-13 21:46:05 -05:00
commit 583975459f
30 changed files with 487 additions and 0 deletions

48
make/rules.mk Normal file
View File

@@ -0,0 +1,48 @@
LIB := $(BUILD_DIR)/lib/libnickel.a
BIN_DIR := $(BUILD_DIR)/bin
OBJ_DIR := $(BUILD_DIR)/obj
NICKEL_SRCS := $(wildcard src/nickel/*.c)
NICKEL_OBJS := $(patsubst src/%.c,$(OBJ_DIR)/%.o,$(NICKEL_SRCS))
TEST_SRCS := $(wildcard tests/*.c)
TEST_BIN := $(BIN_DIR)/tests
TOOL_BINS := \
#$(BIN_DIR)/logscan \
#$(BIN_DIR)/dedupe
.PHONY: all clean test tools examples
all: $(LIB) tools $(TEST_BIN)
$(LIB): $(NICKEL_OBJS)
@mkdir -p $(dir $@)
$(AR) rcs $@ $^
$(RANLIB) $@
$(OBJ_DIR)/%.o: src/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
# Tests link against libnickel.a
$(TEST_BIN): $(TEST_SRCS) $(LIB)
@mkdir -p $(BIN_DIR)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TEST_SRCS) $(LIB) $(LDLIBS)
# Tools (one main.c each; expand as needed)
#$(BIN_DIR)/logscan: tools/logscan/main.c $(LIB)
# @mkdir -p $(BIN_DIR)
# $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIB) $(LDLIBS)
#$(BIN_DIR)/dedupe: tools/dedupe/main.c $(LIB)
# @mkdir -p $(BIN_DIR)
# $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIB) $(LDLIBS)
test: $(TEST_BIN)
$(TEST_BIN)
tools: $(TOOL_BINS)
clean:
rm -rf $(BUILD_DIR)