Makefile (878B)
1 PROJECT = bulkrename 2 3 CC = g++ 4 CXXFLAGS ?= -std=c++17 5 LDFLAGS += -lstdc++fs 6 7 OBJDIR = obj 8 SRCDIR = src 9 TARGET = bin/$(PROJECT) 10 11 DEPS = $(OBJ_FILES:%.o=%.d) 12 13 H_FILES := $(shell find $(SRCDIR) -name '*.hh') 14 SRC_FILES := $(shell find $(SRCDIR) -name '*.cc') 15 OBJ_FILES := $(patsubst src/%.cc,obj/%.o,${SRC_FILES}) 16 17 all: build 18 19 install: 20 install $(TARGET) /usr/bin/$(PROJECT) 21 22 bin: 23 @[ -d bin ] || mkdir bin 24 25 obj: 26 @[ -d obj ] || mkdir obj 27 28 notify-build: 29 @echo building 30 31 notify-link: 32 @echo 33 @echo linking 34 35 build: notify-build bin obj ${OBJ_FILES} notify-link 36 ${CC} ${CXXFLAGS} ${OBJ_FILES} ${LDFLAGS} -o ${TARGET} 37 38 -include $(DEPS) 39 40 obj/%.o: obj 41 42 obj/%.o: src/%.cc 43 ${CC} ${CXXFLAGS} -MMD -c $< -o $@ 44 45 .PHONY: tags 46 tags: 47 @echo 48 @echo generating tags 49 @ctags -R --exclude=.git --c++-kinds=+p --fields=+iaS --extras=+q . 50 51 .PHONY: clean 52 clean: 53 @echo cleaning 54 @rm -rf ./bin ./obj