-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
58 lines (41 loc) · 1.14 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
CC ?= cc
LIBNOTIFY_LIBS = `pkg-config --libs libarchive libcurl`
LIBNOTIFY_INCS = `pkg-config --cflags libarchive libcurl`
LIBS += $(LIBNOTIFY_LIBS)
INCS += $(LIBNOTIFY_INCS)
CFLAGS += -std=c99
CFLAGS += -pedantic
CFLAGS += -Wall
CFLAGS += -Wextra
CFLAGS += -Wcast-align
CFLAGS += -Wstrict-prototypes
CFLAGS += -Wundef
CFLAGS += $(INCS)
LDFLAGS += $(LIBS)
PREFIX ?= /usr/local
PROJECT = tldr
INSTALL ?= install
STRIP ?= strip
all:
$(CC) $(CFLAGS) -O3 $(PROJECT).c $(LDFLAGS) -o $(PROJECT)
debug:
$(CC) $(CFLAGS) -g $(PROJECT).c $(LDFLAGS) -o $(PROJECT)
gdb: debug
gdb ./$(PROJECT)
memcheck: debug
valgrind --leak-check=yes ./$(PROJECT)
memcheck_v: debug
valgrind --leak-check=yes -v ./$(PROJECT)
memcheck_full: debug
valgrind --leak-check=full --show-leak-kinds=all ./$(PROJECT)
clean:
rm -f ./$(PROJECT)
strip:
$(STRIP) ./$(PROJECT)
install:
mkdir -p "$(DESTDIR)$(PREFIX)/bin"
$(INSTALL) ./$(PROJECT) "$(DESTDIR)$(PREFIX)/bin/$(PROJECT)"
uninstall:
rm -f "$(DESTDIR)$(PREFIX)/bin/$(PROJECT)"
rmdir --ignore-fail-on-non-empty "$(DESTDIR)$(PREFIX)/bin"
.PHONY: all debug gdb memcheck memcheck_v memcheck_full clean strip install uninstall