EEPROM-Sim/Makefile
2024-01-17 15:10:59 +01:00

39 lines
767 B
Makefile

CXX = g++
CXXFLAGS = -std=c++20 -O3 -MMD -MP -Wall -Wpedantic
LDFLAGS = -lbcm2835
IFLAGS = -Iargparse/include
SRCDIR = src
BUILD_DIR = build
EXEC = eeprom-sim
SRC = $(wildcard $(SRCDIR)/*.cpp) $(wildcard $(SRCDIR)/*/*.cpp)
# OBJECTS = $(SRC:%.cpp=$(OBJECT_DIR)/%.o)
OBJECTS = $(patsubst $(SRCDIR)/%,$(BUILD_DIR)/%,$(patsubst %.cpp,%.o,$(SRC)))
DEPENDS = ${OBJECTS:.o=.d}
CXXFLAGS += $(IFLAGS)
.PHONY = default clean
default: $(EXEC)
print:
@echo $(SRC)
@echo $(OBJECTS)
-include $(DEPENDS)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(EXEC): $(OBJECTS)
$(CXX) $(OBJECTS) -o $@ $(CXXFLAGS) $(LDFLAGS)
$(BUILD_DIR)/%.o: $(SRCDIR)/%.cpp | $(BUILD_DIR)
$(CXX) -c $(CXXFLAGS) $(LDFLAGS) $< -o $@
clean:
-rm -r $(BUILD_DIR)
-rm $(EXEC)