-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (32 loc) · 1.11 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Source files
SRCS = src/main.cpp src/IterationScheme.cpp src/Logger.cpp src/PrimeFieldInferation.cpp src/Store.cpp tests/FieldGenerator.cpp tests/TestIteration.cpp tests/Plot.cpp tests/TestConfig.cpp
# Object files directory
OBJDIR = build
# Object files
OBJS = $(SRCS:src/%.cpp=$(OBJDIR)/%.o)
# Executable name
EXEC = $(OBJDIR)/ODESolver
# Compiler flags
NUMPY_INCLUDE = $(shell python3 -c "import numpy; print(numpy.get_include())")
PYTHON_INCLUDE = $(shell python3-config --includes)
CXXFLAGS = -Wall -Wextra -O2 $(PYTHON_INCLUDE) -I $(NUMPY_INCLUDE) -I lib/matplotlib-cpp -I lib/json/single_include
# Linker flags
PYTHON_LIBS = $(shell python3-config --ldflags)
LDFLAGS = -lpython3.10
# Default target
all: $(EXEC)
# Rule to build the executable
$(EXEC): $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS)
# Rule to build object files
$(OBJDIR)/%.o: src/%.cpp | $(OBJDIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
# Ensure the build directory exists
$(OBJDIR):
mkdir -p $(OBJDIR)
# Remove all files except .gitignore
clean_tests:
rm -rf tests/out/*.png tests/out/*.txt
# Clean up build files
clean:
rm -rf $(OBJDIR)