-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (46 loc) · 1.17 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
##
# Totui
#
# @file
# @version 1.0
# Source files
SRCS = $(wildcard src/*.c)
# Object files
OBJS = $(addprefix build/,$(notdir $(SRCS:.c=.o)))
# Flags to use for development
CFLAGS = -Wall -g3 -O1 -std=c11 -Wextra -Wunused -flto=auto
# Linker flags
LDFLAGS = -lncursesw -lformw -lmenuw -ldialog -lm
# Memory sanitization flags
MEMFLAGS = -fsanitize=address -fno-omit-frame-pointer
# Specify your compiler
CC = clang
# Default target
all: build/totui
# Default builds
build/totui: $(OBJS)
$(CC) $(OBJS) $(CFLAGS) $(LDFLAGS) -o $@
build/%.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
# Debug build
debug: CFLAGS += $(MEMFLAGS)
debug: build/totui_debug
build/totui_debug: $(OBJS)
$(CC) $(OBJS) $(CFLAGS) $(LDFLAGS) -o $@
# Cleans build directory
clean:
rm -f build/*.o build/totui build/totui_debug
# Install target
install: build/totui
mv ./build/totui ../totui
# Run the program
run: build/totui
./build/totui
# Clean debug build
clean_debug:
rm -f build/*_debug
# Bear target for generating compilation database (for development use only)
bear_build: clean
bear -- make all
# PHONY targets to prevent conflicts with filenames
.PHONY: all clean install run clean_debug bear_build