-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (29 loc) · 1.03 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
TARGET = btp
CC = gcc
INCLUDES = -Iinclude/
CFLAGS = -liw -lexplain -DLOG_USE_COLOR -g3 $(INCLUDES)
CFLAGS += -Werror -Wl,--fatal-warnings
CFLAGS += -pipe -fPIE -fdiagnostics-color -Wpedantic
CFLAGS += -Wall -Werror-implicit-function-declaration
CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare -Wswitch-enum
CFLAGS += -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Werror=format-security
CFLAGS += -Wunused-parameter -Wuninitialized -Wformat-security -Wstrict-overflow=2
SOURCEDIR = src
BUILDDIR = build
INCLUDEDIR = include
SOURCES = $(wildcard $(SOURCEDIR)/*.c)
OBJECTS = $(patsubst $(SOURCEDIR)/%.c,$(BUILDDIR)/%.o,$(SOURCES))
HEADERS = $(wildcard $(INCLUDEDIR)/*.h)
.PHONY: default all clean
default: $(TARGET)
all: default
$(OBJECTS): $(BUILDDIR)/%.o: $(SOURCEDIR)/%.c
@mkdir -p $(BUILDDIR)
$(CC) $(CFLAGS) -c $< -o $@
.PRECIOUS: $(TARGET) $(OBJECTS)
$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) -o $@
clean:
-rm -rf $(BUILDDIR)
-rm -f $(TARGET)