forked from c-koans/c_koans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (26 loc) · 744 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
CC := gcc
SRCDIR := src
BINDIR := bin
BLDDIR := build
INCDIR := include
ALL_SRCF := $(shell find $(SRCDIR) -type f -name *.c)
ALL_OBJF := $(patsubst $(SRCDIR)/%,$(BLDDIR)/%,$(ALL_SRCF:.c=.o))
#MAINF := # use nm to find file with main and include it
#FUNCF := $(filter-out $(MAIN_FILES), $(ALL_OBJF))
INC := -I $(INCDIR)
EXEC := c_koans
STD := gnu11
CFLAGS := -std=$(STD) -Wall -Werror -Wno-unused-function -Wno-nonnull
CRITERION := -lcriterion
.PHONY: setup all clean
all: setup $(EXEC)
debug: CFLAGS += $(DFLAGS)
debug: all
setup:
@mkdir -p bin build
$(EXEC): $(ALL_OBJF)
$(CC) $(CFLAGS) $(INC) $^ -o $(BINDIR)/$@ $(CRITERION)
$(BLDDIR)/%.o: $(SRCDIR)/%.c
$(CC) $(CFLAGS) $(INC) $< -c -o $@
clean:
$(RM) -r $(BLDDIR) $(BINDIR)