add-fen-loader #5

Merged
Josh merged 8 commits from add-fen-loader into main 2025-08-16 16:51:53 +00:00
Showing only changes of commit 4d2cccd385 - Show all commits

View File

@@ -11,27 +11,31 @@ SRC := $(wildcard $(SRCDIR)/*.c)
OBJ := $(patsubst $(SRCDIR)/%.c,$(BUILDDIR)/%.o,$(SRC))
LIB := $(BUILDDIR)/$(LIBNAME).so
.PHONY: all clean clean-pycache test
.PHONY: all clean test
all: $(LIB)
$(BUILDDIR):
@mkdir -p $(BUILDDIR)
# compile each .c into build/*.o
$(BUILDDIR)/%.o: $(SRCDIR)/%.c | $(BUILDDIR)
$(CC) $(CFLAGS) -I$(INCDIR) -c $< -o $@
# link shared library
$(LIB): $(OBJ)
$(CC) $(LDFLAGS) -o $@ $^
clean:
@echo "Cleaning Python caches..."
@echo "Cleaning build and Python caches..."
@rm -rf $(BUILDDIR)
@find . -type d -name "__pycache__" -exec rm -rf {} +
@find . -type d -name ".pytest_cache" -exec rm -rf {} +
@find . -type f \( -name "*.pyc" -o -name "*.pyo" \) -delete
# run Python unit tests
test: all
python3 -m unittest -v && $(MAKE) clean
# Always rebuild, and always clean afterward (even if tests fail)
test:
@$(MAKE) clean
@$(MAKE) all
@python3 -m unittest -v; \
status=$$?; \
$(MAKE) clean; \
exit $$status