-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (36 loc) · 978 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
# miyabot Makefile
#
CC = clang
CXX = clang++
CFLAGS = -fdiagnostics-show-location=every-line \
-std=c11 -Wall -Werror -pedantic \
-Wfatal-errors -g -iquote include/ \
$(shell python3-config --cflags)
LD = $(CC)
LDFLAGS = $(shell python3-config --ldflags)
STRIP = strip --strip-unneeded
RM = rm
CTAGS = ctags -R
# project directories
SRCDIR = src
INCDIR = include
OBJDIR = build
BINDIR = bin
# files, deduced by make every time it is run
SRCS = ${wildcard $(SRCDIR)/*.c}
HDRS = ${wildcard $(INCDIR)/*.h}
OBJS = ${patsubst src/%.c,build/%.o,$(SRCS)}
EXE = $(BINDIR)/miyabot
build/%.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
all: $(EXE)
run: $(EXE)
$(EXE)
$(EXE): $(OBJS)
$(LD) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
$(CTAGS) $(SRCS) $(HDRS)
# all object files in OBJDIR are purged along with executable
clean:
$(RM) -f $(EXE) ${wildcard $(OBJDIR)/*.o}
dist: $(EXE)
$(STRIP) $(EXE)