post-scarcity/Makefile
Simon Brooke 222368bf64 Stage one clean up of test files. Some unit tests are still creating temporary files in
the project root directory, which is still to be fixed; and *I think* known-failing
tests which I don't intend to fix immediately should be marked in some way.
2026-02-14 14:04:41 +00:00

52 lines
1.2 KiB
Makefile

TARGET ?= target/psse
SRC_DIRS ?= ./src
SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s)
HDRS := $(shell find $(SRC_DIRS) -name *.h)
OBJS := $(addsuffix .o,$(basename $(SRCS)))
DEPS := $(OBJS:.o=.d)
TESTS := $(shell find unit-tests -name *.sh)
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
TMP_DIR ?= ./tmp
INDENT_FLAGS := -nbad -bap -nbc -br -brf -brs -c33 -cd33 -ncdb -ce -ci4 -cli4 \
-d0 -di1 -nfc1 -i4 -ip0 -l75 -lp -npcs \
-npsl -nsc -nsob -nss -nut -prs -l79 -ts2
CPPFLAGS ?= $(INC_FLAGS) -MMD -MP -g -DDEBUG
LDFLAGS := -lm -lcurl
DEBUGFLAGS := -g3
all: $(TARGET)
Debug: $(TARGET)
$(TARGET): $(OBJS) Makefile
$(CC) $(DEBUGFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(LDFLAGS) $(LOADLIBES) $(LDLIBS)
doc: $(SRCS) Makefile Doxyfile
doxygen
format: $(SRCS) $(HDRS) Makefile
ifeq ($(shell uname -s), Darwin)
gindent $(INDENT_FLAGS) $(SRCS) $(HDRS)
else
indent $(INDENT_FLAGS) $(SRCS) $(HDRS)
endif
test: $(TESTS) Makefile $(TARGET)
bash ./unit-tests.sh
.PHONY: clean
clean:
$(RM) $(TARGET) $(OBJS) $(DEPS) $(SRC_DIRS)/*~ $(SRC_DIRS)/*/*~ $(TMP_DIR)/* *~ core
repl:
$(TARGET) -p 2> psse.log
-include $(DEPS)