-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (40 loc) · 860 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
OBJ=$(patsubst src%, build%, $(patsubst %.cpp, %.o, $(SRC)))
SRC=$(shell find src -name '*.cpp')
HEAD=$(shell find src -name '*.h')
BIN=TinyLISP
LD=g++
LDFLAGS=
CXX=g++
CXXFLAGS=-std=c++17 -Wall -pedantic -Wno-long-long -c
## Default compile objects
.PHONY: all
all: $(OBJ)
## Run options
.PHONY: run help library letrec
run: $(BIN)
./$(BIN)
help: $(BIN)
./$(BIN) --help
library: $(BIN)
./$(BIN) -f lib/lib.tl
letrec: $(BIN)
./$(BIN) -f lib/letrec.tl
## Compile
$(BIN): $(OBJ)
$(LD) $^ -o $@ $(LDFLAGS)
## META
.PHONY: doc clear clean echo
# Documentation
doc:
doxygen
# Clean
clear: clean
clean:
rm -frd $(OBJ) $(BIN) Makefile.d doc
# Objects rule
$(OBJ): build/%.o: src/%.cpp
$(CXX) $(CXXFLAGS) $< -o $@
# Makefile dependencies
Makefile.d: $(SRC) $(HEAD)
$(CXX) -MM $(SRC) | sed -E 's/(^.*\.o:)/build\/\1/' > Makefile.d
-include Makefile.d