This repository was archived by the owner on Apr 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
92 lines (65 loc) · 1.69 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#
# Fluid
# Version: 1.5.7
#
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE file at LICENSE.md
#
#
# CONFIGURATIONS
#
OUTNAME := a.out
OBJDIR := .cache
OUTDIR := .
SRCDIR := .
HDRDIR := .
#
# DO NOT EDIT FORWARD
#
# Compilation settings
CC := g++
WARNINGS := -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align \
-Wwrite-strings -Wmissing-declarations -Wredundant-decls \
-Winline -Wno-long-long -Wuninitialized -Wconversion -Wfatal-errors
CFLAGS ?= -std=c++14 $(WARNINGS)
# Options
ifeq ($(VERBOSE), 1)
SILENCER :=
else
SILENCER := @
endif
ifeq ($(DEBUG_BUILD), 1)
CFLAGS +=-DDEBUG_BUILD -fsanitize=address -g
endif
# Compilation command
all: init $(OUTNAME)
# Automated compilator
# Compilator files
ifeq ($(TEST_BUILD), 1)
SRCS := $(shell find ./$(SRCDIR) -name "*.cpp" -type f | cut -sd / -f 3- | tr '\n' ' ')
else
SRCS := $(shell find ./$(SRCDIR) ! -name '*.test.cpp' -name "*.cpp" -type f | cut -sd / -f 3- | tr '\n' ' ')
endif
OBJS := $(patsubst %, $(OBJDIR)/%, $(SRCS:cpp=o))
DEPS :=$(patsubst %.cpp, %.d, $(SRCS))
# Compilation output configurations
CFLAGS += -MMD -MP
$(OUTNAME): $(OBJS)
$(SILENCER)mkdir -p $(OUTDIR)
$(SILENCER)$(CC) $(CFLAGS) -o $(OUTDIR)/$(OUTNAME) $^
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(SILENCER)mkdir -p $(OBJDIR)
$(SILENCER)$(CC) $(CFLAGS) -c -o $@ $<
# Helpers command
init:
$(SILENCER)mkdir -p $(SRCDIR)
$(SILENCER)mkdir -p $(OBJDIR)
$(SILENCER)mkdir -p $(HDRDIR)
clean:
$(SILENCER)find . -name "*.o" -type f -delete
fclean: clean
$(SILENCER)$(RM) -r ./$(OBJDIR)
$(SILENCER)$(RM) -r ./$(OUTDIR)/$(OUTNAME)
re: fclean all
.PHONY: re fclean clean init all
-include $(DEPS)