forked from FilipeTerra/Gerenciamento_Biblioteca
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (28 loc) · 856 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
CC := g++
SRCDIR := src
TSTDIR := tests
OBJDIR := build
BINDIR := bin
MAIN := program/main.cpp
TESTER := program/tester.cpp
SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(OBJDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
TSTSOURCES := $(shell find $(TSTDIR) -type f -name *.$(SRCEXT))
# -g debug, --coverage cobertura
CFLAGS := -g --coverage -Wall -O3 -std=c++20
INC := -I include/ -I third_party/
$(OBJDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@mkdir -p $(@D)
$(CC) $(CFLAGS) $(INC) -c -o $@ $<
main: $(OBJECTS)
@mkdir -p $(BINDIR)
$(CC) $(CFLAGS) $(INC) $(MAIN) $^ -o $(BINDIR)/main
tests: $(OBJECTS)
@mkdir -p $(BINDIR)
$(CC) $(CFLAGS) $(INC) $(TESTER) $(TSTSOURCES) $^ -o $(BINDIR)/tester
$(BINDIR)/tester
all: main
clean:
$(RM) -r $(OBJDIR)/* $(BINDIR)/* coverage/* *.gcda *.gcno
.PHONY: clean