-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (30 loc) · 887 Bytes
/
Makefile
File metadata and controls
43 lines (30 loc) · 887 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
INC_DIR = include
SRC_DIR = src
SOURCES = $(sort $(shell find $(SRC_DIR) -name '*.c'))
OBJECTS = $(SOURCES:.c=.o)
DEPS = $(OBJECTS:.o=.d)
TARGET = a.out
CC = gcc
CFLAGS = -std=c99 -march=native -Wall -Wextra -Wpedantic \
-Wformat=2 -Wshadow -Wwrite-strings -Wstrict-prototypes \
-Wold-style-definition -Wredundant-decls -Wnested-externs \
-Wmissing-include-dirs $(addprefix -D, $(OPTIONS))
CPPFLAGS =
.PHONY: all check clean debug docs release
debug: CFLAGS += -O0 -ggdb3 -DDEBUG
debug: all
release: CFLAGS += -O3 -DNDEBUG
release: all
all: $(TARGET)
export OBJECTS
check: $(OBJECTS)
$(MAKE) -C tests MEMCHECK=$(MEMCHECK)
clean:
rm -f $(OBJECTS) $(DEPS) $(TARGET)
docs:
$(MAKE) html -C doc
$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^
-include $(DEPS)
%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -MMD -o $@ -c $<