init-projects/cpp/Makefile
2024-04-20 14:56:15 +02:00

29 lines
528 B
Makefile

CXX = g++
RM = rm
SOURCES = $(wildcard src/*.cpp)
OBJECTS = $(patsubst %.cpp,%.o,$(notdir $(SOURCES)))
CXXFLAGS = -std=c++17 -pedantic
EXE = example
EXE_EXT = out
%.o: src/%.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS)
release: CXXFLAGS += -O3
release: compilation
debug: CXXFLAGS += -Wall -Wextra -Wshadow -Wnon-virtual-dtor -g
debug: CXXFLAGS += -Wold-style-cast -Wsign-conversion
debug: compilation
compilation: $(OBJECTS)
$(CXX) -o $(EXE).$(EXE_EXT) $(OBJECTS)
all:
release
clean:
$(RM) $(OBJECTS) $(EXE).$(EXE_EXT)