32 lines
735 B
Makefile
32 lines
735 B
Makefile
|
|
# Recursive wildcard function (properly defined)
|
|
rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
|
|
|
|
CXX = g++
|
|
CXXFLAGS = -Wall -std=c++20
|
|
|
|
# Use $(call ...) not ${call ...}
|
|
ALL_LIBS = $(call rwildcard,math/,*.cpp) $(call rwildcard,generators/,*.cpp) $(call rwildcard,randomness_tests/,*.cpp)
|
|
|
|
# Expand wildcard properly for current directory
|
|
SRCS = main.cpp $(ALL_LIBS)
|
|
|
|
TEST_SRCS = code_tests/test.cpp $(ALL_LIBS)
|
|
|
|
TARGET = splat
|
|
TEST_TARGET = splat_test
|
|
|
|
.PHONY: all main test clean
|
|
all: $(TARGET) ${TEST_TARGET}
|
|
$(TARGET): $(SRCS)
|
|
$(CXX) $(CXXFLAGS) -o $@ $^
|
|
|
|
test: $(TEST_TARGET)
|
|
|
|
$(TEST_TARGET): $(TEST_SRCS)
|
|
$(CXX) $(CXXFLAGS) -o $@ $^
|
|
|
|
clean:
|
|
rm -f $(TARGET) $(TEST_TARGET) *.o
|
|
|