init-projects/cpp/Makefile
2023-11-25 21:18:30 +01:00

29 lines
533 B
Makefile

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