-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
82 lines (58 loc) · 2.09 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
# nom de l'executable :
PROJET = $(PGM)
# Adresse des sources, des objets et des includes :
SRCDIR = $(CURDIR)/src/
OBJDIR = $(CURDIR)/obj/
BINDIR = $(CURDIR)/
INCLUDES =\
-I`pkg-config --cflags vte-2.91` \
-I$(SRCDIR)
INCLIB =\
`pkg-config vte-2.91 --libs`
#`/usr/lib/x86_64-linux-gnu/libdl.so`
OBJ = $(OBJDIR)$(PROJET).o
RESULT = $(BINDIR)$(PROJET)
# choix du compilateur :
CXX = g++
# options compilations : voir vte-dev -Wextra -Wno-unused-parameter use juste for debug only for you -Os -s
# -------------------------------------------------------------------
# production
# -------------------------------------------------------------------
ifeq ($(PROD), true)
CPPFLAGS= -std=c++17 \
-Wall -fexceptions -pedantic-errors -Wno-parentheses -Waddress \
-Wsign-compare -fpermissive -fstack-clash-protection -fstack-protector-all \
`pkg-config --cflags vte-2.91`
# -no-pie because it's the master program of the project so the caller `pkg-config gmodule-2.0 --libs`
LDFLAGS = -lX11 -no-pie `pkg-config --libs vte-2.91`
OPTIMIZE = -fexpensive-optimizations -Os -s
# -------------------------------------------------------------------
# debug -fno-omit-frame-pointer
# -------------------------------------------------------------------
else
CPPFLAGS= -std=c++17 -ggdb -g3 \
-Wall -fexceptions -pedantic-errors -Wno-parentheses -Waddress \
-Wsign-compare -fpermissive \
`pkg-config --cflags vte-2.91`
LDFLAGS = -lX11 -no-pie `pkg-config --libs vte-2.91`
OPTIMIZE =
endif
# -------------------------------------------------------------------
# compilation
# -------------------------------------------------------------------
# compilation obj : ex #@echo "$(OBJCPP)"
#
# debug -v prod [ on enleve les symboles -s & compression ...]
# regle edition de liens
all: $(OBJ)
$(CXX) $(OBJ) -o $(RESULT) $(OPTIMIZE) $(LDFLAGS) $(INCLIB)
ifeq ($(PROD), true)
rm -rf $(OBJDIR)$(PROJET).o
endif
# regle de compilation des sources objet
$(OBJDIR)%.o: $(SRCDIR)%.cpp
$(CXX) $(CPPFLAGS) $(INCLUDES) -o $@ -c $<
# pour effacer tous les objets :
clean:
rm -rf $(OBJDIR)*.o
rm -rf $(RESULT)