-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (53 loc) · 1.4 KB
/
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Binário e arquivo zip/tar
BIN := dijkstra
DISTFILE := TPDijkstra_Marzo_Tulio
# Diretórios de código fonte
SRCDIRS := .
# Diretórios de documentação
DOCDIRS := .
# Compilador
CXX = g++
# Compactador
ZIP = zip
# Conversor odt -> pdf
ODT2PDF = unoconv
# Arquivos fonte
SRCSCXX := $(foreach SRCDIR,$(SRCDIRS),$(wildcard $(SRCDIR)/*.cc))
SRCSH := $(foreach SRCDIR,$(SRCDIRS),$(wildcard $(SRCDIR)/*.h))
SRCDOCS := $(foreach DOCDIR,$(DOCDIRS),$(wildcard $(DOCDIR)/*.odt))
# Arquivos de objeto
OBJECTS := $(SRCSCXX:%.cc=%.o)
DEPENDENCIES := $(OBJECTS:%.o=%.d)
DOCS := $(SRCDOCS:%.odt=%.pdf)
# Variáveis para compilação
CXXFLAGS := -O2 -s -Wall -Wextra -MMD
CPPFLAGS := -D'BINNAME="$(BIN)"'
INCFLAGS :=
LDFLAGS := -Wl,-rpath,/usr/local/lib
LIBS :=
# Alvos
all: $(BIN)
docs: $(DOCS)
time: CPPFLAGS += -DLOGTIME
time: clean $(BIN)
zip: docs
rm -f $(DISTFILE).zip
zip -9 $(DISTFILE).zip Makefile $(SRCSCXX) $(SRCSH) $(DOCS)
count:
wc *.c *.cc *.C *.cpp *.h *.hpp
clean:
rm -f *.o *~ $(BIN) *.d *.zip
distclean: clean
rm -f *.pdf
.PHONY: all count clean distclean time zip tar docs
# Regras de construção
.SUFFIXES:
.SUFFIXES: .c .cc .C .cpp .o
$(BIN): $(OBJECTS) $(OBJECTS)
$(CXX) -o $(BIN) $(OBJECTS) $(LDFLAGS) $(LIBS)
%.o: %.cc
$(CXX) -o $@ -c $(CXXFLAGS) $(CPPFLAGS) $< $(INCFLAGS)
%.pdf: %.odt
$(ODT2PDF) -f pdf $<
# Dependências
-include $(DEPENDENCIES)