codebreakparty/Makefile

30 lines
493 B
Makefile
Raw Permalink Normal View History

2020-02-02 19:23:00 +00:00
CXXFLAGS += -std=c++17 -pedantic -Wall
LDFLAGS=-lm -lstdc++
SRC=test.cpp
OBJ=$(SRC:%=%.o)
JSON=$(OBJ:%=%.json)
HDR=markov.hpp
BIN=test
all: $(BIN) compile_commands.json
$(BIN): $(OBJ)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJ) -o $@
$(OBJ): %.o: % $(HDR)
$(CXX) $(CXXFLAGS) -c $< -o $@
$(JSON): %.o.json: % Makefile
clang $(CXXFLAGS) -c $< -o /dev/null -MJ $@
compile_commands.json: $(JSON)
sed -e '1s/^/[\n/' -e 's/,$$/\n]/' $^ > $@
clean:
rm -f $(BIN) $(OBJ) $(JSON)
.PHONY: clean