forked from paul-maxime/ftrace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
207 lines (178 loc) · 4.24 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
##
## Makefile for in ./
##
## Made by Jean Fauquenot
## Login <[email protected]>
##
## Started on Sat Jul 5 19:14:34 2014 Jean Fauquenot
## Last update Sun Jul 6 20:12:47 2014 paul-maxime leduc
##
# All the default variables used in this Makefile are commented with their
# definition and their default value.
# Read the Make manual at gnu.org for more informations.
# https://www.gnu.org/software/make/manual/
# VARIABLES
NAME = ftrace
# CC
# Program for compiling C programs; default ‘cc’.
CC = gcc
INCLUDE = -I ./src/include
DEBUG = 0
BUILD = build
SRC = \
main.c
# VPATH
# https://www.gnu.org/software/make/manual/make.html#Directory-Search
VPATH = src
INCLUDE += -I ./src/
SRC += \
merror.c \
syscalls.c
VPATH += src/utils/
INCLUDE += -I ./src/utils/
SRC += \
stack_empty.c \
stack_new.c \
stack_init.c \
stack_delete.c \
stack_destroy.c \
stack_pop.c \
stack_push.c \
stack_size.c \
stack_top.c \
stack_clear.c
VPATH += src/utils/t_stack/
SRC += \
list_new.c \
list_init.c \
list_delete.c \
list_destroy.c \
list_assign.c \
list_back.c \
list_begin.c \
list_clear.c \
list_empty.c \
list_end.c \
list_front.c \
list_insert.c \
list_pop_back.c \
list_pop_front.c \
list_push_back.c \
list_push_front.c \
list_remove.c \
list_size.c
VPATH += src/utils/t_list/
SRC += \
ftrace_new.c \
ftrace_init.c \
ftrace_delete.c \
ftrace_destroy.c \
ftrace_parser.c \
ftrace_start.c \
ftrace_trace.c \
ftrace_signal.c \
ftrace_break_signal.c \
ftrace_break.c \
ftrace_syscall.c \
ftrace_attach.c \
ftrace_call.c \
ftrace_call_inlist.c \
ftrace_call_exist.c \
ftrace_ktree_link.c \
ftrace_getlib_name.c
VPATH += src/t_ftrace/
SRC += \
call_finder_init.c \
call_finder_destroy.c \
call_finder_step.c
VPATH += src/t_call_finder/
SRC += \
memory_map_init.c \
memory_map_destroy.c \
memory_map_addressat.c
VPATH += src/t_memory_map/
SRC += \
symbol_finder_init.c \
symbol_finder_initgotsymbols.c \
symbol_finder_findsymbol.c \
symbol_finder_cache_init.c
VPATH += src/t_symbol_finder/
SRC += \
ktree_new.c \
ktree_init.c \
ktree_delete.c \
ktree_destroy.c \
ktree_clean.c \
ktree_add.c \
ktree_elem_new.c \
ktree_elem_init.c
VPATH += src/t_ktree/
SRC += \
trace.c \
function_definer.c \
graph.c \
dump_graph.c
VPATH += src/t_graph/
SRC += \
unmangle.c \
unmangle_handleprefix.c
VPATH += src/t_mangling/
# CFLAGS
# Extra flags to give to the C compiler.
CFLAGS += -Wall -Wextra
#CFLAGS += -ansi -pedantic
# IFEQ
# https://www.gnu.org/software/make/manual/make.html#index-ifeq_002c-expansion-110
# FILTER
# https://www.gnu.org/software/make/manual/make.html#index-filter-587
ifeq ($(DEBUG), $(filter $(DEBUG), 1 yes YES))
CFLAGS += -ggdb3 -D DEBUG
endif
CFLAGS += $(INCLUDE)
# CPPFLAGS
# Extra flags to give to the C preprocessor and programs that use it (the C and
# Fortran compilers).
CPPFLAGS =
# LDFLAGS
# Extra flags to give to compilers when they are supposed to invoke the linker,
# ‘ld’, such as -L.
# Libraries (-lfoo) should be added to the LDLIBS variable instead.
# e.g.: -L /usr/lib
LDFLAGS =
# LDLIBS
# Library flags or names given to compilers when they are supposed to invoke
# the linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative
# to LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
# variable.
# e.g.: -lphtread
LDLIBS = -lelf
OBJ = $(patsubst %.c, $(BUILD)/%.o, $(SRC))
MKDIR = mkdir -p
RMDIR = -rmdir
# RM
# Command to remove a file; default ‘rm -f’.
RM = rm -f
# RULES
all : $(BUILD) $(NAME)
$(BUILD) :
$(MKDIR) $(BUILD)
# See:
# Automatic Variables:
# https://www.gnu.org/software/make/manual/make.html#Automatic-Variables
# Implicit Rules
# https://www.gnu.org/software/make/manual/make.html#Using-Implicit
.SUFFIXES : .c .o
$(BUILD)/%.o : %.c
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
$(NAME) : $(OBJ)
$(CC) $(OBJ) -o $(NAME) $(LDFLAGS) $(LDLIBS)
clean :
$(RM) $(OBJ)
ifeq ($(wildcard $(BUILD)), $(BUILD))
$(RMDIR) $(BUILD)
endif
fclean : clean
$(RM) $(NAME)
mrproper : fclean
re : fclean all
.PHONY : all clean fclean mrproper re