-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
44 lines (34 loc) · 748 Bytes
/
Copy pathmakefile
File metadata and controls
44 lines (34 loc) · 748 Bytes
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
EXE = fr
SRC = main.c
OBJ = $(SRC:.c=.o)
CPPFLAGS =
WARNFLAGS = -Wall -Wextra -Werror -pedantic
CFLAGS = -std=c99 $(WARNFLAGS) -pthread
LDFLAGS =
LDLIBS = -lgit2
ifdef DEBUG
CFLAGS += -g -O0 -fsanitize=address -fsanitize=undefined \
-fno-omit-frame-pointer -fno-optimize-sibling-calls
LDFLAGS += -fsanitize=address -fsanitize=undefined
else
CFLAGS += -O2
endif
.PHONY: all
all: $(EXE)
$(EXE): $(OBJ)
$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
.PHONY: run
run: $(EXE)
./$(EXE)
.PHONY: debug
debug:
$(MAKE) DEBUG=1 $(EXE)
.PHONY: clean
clean:
$(RM) $(EXE) $(OBJ)
.PHONY: install
install: $(EXE)
install -d $(DESTDIR)$(PREFIX)/bin
install -m 755 $(EXE) $(DESTDIR)$(PREFIX)/bin/