46 lines
		
	
	
	
		
			980 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
	
		
			980 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
CXX = g++
 | 
						|
CXXFLAGS = -Wall -Wextra -Wpedantic -Wshadow -Wnon-virtual-dtor \
 | 
						|
-Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wconversion \
 | 
						|
-Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -std=c++17
 | 
						|
 | 
						|
ifeq ($(RELEASE),)
 | 
						|
    CFLAGS += -g -O0
 | 
						|
    BUILD_TYPE = Debug
 | 
						|
else
 | 
						|
    CXXFLAGS += -O3
 | 
						|
	CXXFLAGS += -Werror
 | 
						|
    BUILD_TYPE = Release
 | 
						|
endif
 | 
						|
 | 
						|
SRC = $(wildcard *.cc)
 | 
						|
HDR = $(wildcard *.h)
 | 
						|
OBJ = $(SRC:.cc=.o)
 | 
						|
 | 
						|
all: main.elf
 | 
						|
 | 
						|
main.elf: $(OBJ)
 | 
						|
	@echo "Building & linking $@"
 | 
						|
	@$(CXX) $(CXXFLAGS) $^ -o $@
 | 
						|
 | 
						|
words.txt:
 | 
						|
	cat /usr/share/dict/words > words.txt
 | 
						|
 | 
						|
%.o:%.cc
 | 
						|
	@echo "Building $@"
 | 
						|
	@$(CXX) -c $(CXXFLAGS) $< -o $@
 | 
						|
 | 
						|
lint: clang-tidy cppcheck clang-format
 | 
						|
 | 
						|
clang-tidy:
 | 
						|
	clang-tidy $(SRC) -- $(CXXFLAGS)
 | 
						|
 | 
						|
cppcheck:
 | 
						|
	cppcheck --enable=all --language=c++ --std=c++17 --suppress=missingIncludeSystem -I/usr/include $(SRC) $(HDR)
 | 
						|
 | 
						|
format:
 | 
						|
	clang-format -i $(SRC) $(HDR)
 | 
						|
 | 
						|
clean:
 | 
						|
	rm -f *.o *.elf words.txt
 | 
						|
 | 
						|
.PHONY: clean all lint clang-tidy cppcheck format
 |