-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
49 lines (39 loc) · 814 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
38
39
40
41
42
43
44
45
46
47
48
49
# Append to existing options (if OBJS is already defined)
# vv
OBJS += src/main.c
# Set if unset
# vv
BIN ?= bin/out
CC ?= gcc
CCLD ?= $(CC)
CFLAGS = -Isrc/include -Isrc/extern/include -Wall -Wpedantic -Wshadow -Wextra -lcurl
LDFLAGS += -Isrc/include -Isrc/extern/include -Wall -Wpedantic -Wshadow -Wextra -lcurl
VFLAGS = --leak-check=full -s --track-origins=yes
#############
# First thing executed when running `make`
all: $(BIN)
#############
# Build all object files
.SUFFIXES: .c .o
.c.o:
$(CC) -o $@ $< $(CFLAGS)
# Link final file
$(BIN): $(OBJS)
$(CCLD) $(LDFLAGS) -o $(BIN) $(OBJS)
debug: CFLAGS += -g
debug: LDFLAGS += -g
debug: $(BIN)
clean:
./clean.sh
remake:
make clean
make debug
run:
make remake
$(BIN)
gdb:
make remake
gdb $(BIN)
vg:
make remake
valgrind $(VFLAGS) $(BIN)