30 lines
493 B
Makefile
30 lines
493 B
Makefile
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
|