File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ # Compiler and flags
2+ CXX = g++
3+ CXXFLAGS = -std=c++17 -Wall -Iinclude
4+ LDFLAGS = -pthread
5+
6+ # Directories
7+ SRCDIR = src
8+ OBJDIR = obj
9+ BINDIR = bin
10+
11+ # Find all .cpp files in the source directory
12+ SOURCES = $(wildcard $(SRCDIR ) /* .cpp)
13+ # Replace the .cpp extension with .o and put them in the obj directory
14+ OBJECTS = $(patsubst $(SRCDIR ) /% .cpp,$(OBJDIR ) /% .o,$(SOURCES ) )
15+
16+ # Name of the final executable
17+ TARGET = $(BINDIR ) /hybrid_cache
18+
19+ # Default target: build the executable
20+ all : $(TARGET )
21+
22+ # Rule to link the final executable
23+ $(TARGET ) : $(OBJECTS )
24+ @mkdir -p $(BINDIR )
25+ $(CXX ) $(OBJECTS ) -o $(TARGET ) $(LDFLAGS )
26+ @echo " Linking complete. Executable is at $( TARGET) "
27+
28+ # Rule to compile source files into object files
29+ $(OBJDIR ) /% .o : $(SRCDIR ) /% .cpp
30+ @mkdir -p $(OBJDIR )
31+ $(CXX ) $(CXXFLAGS ) -c $< -o $@
32+ @echo " Compiled $< into $@ "
33+
34+ # Clean up build files
35+ clean :
36+ @echo " Cleaning up build artifacts..."
37+ @rm -rf $(OBJDIR ) $(BINDIR )
38+
39+ # Phony targets don't represent actual files
40+ .PHONY : all clean
You can’t perform that action at this time.
0 commit comments