-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (29 loc) · 882 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
CC := gcc
CFLAGS := -Wall -O0 -fcf-protection=none -ggdb -fcompare-debug-second \
-std=gnu17 -Wno-strict-prototypes -Wno-format -Wno-attributes
LIBS = -lm
CEXT := c
OBJEXT := o
DEPEXT := d
HEXT := .h
SRCDIR := src
INCDIR := include
OBJDIR := build
TARGET := ucc
SOURCES := $(wildcard $(SRCDIR)/*.$(CEXT))
HEADERS := $(wildcard $(INCDIR)/*.$(HEXT))
OBJECTS := $(patsubst $(SRCDIR)/%.$(CEXT),$(OBJDIR)/%.$(OBJEXT),$(SOURCES))
DEPENDS := $(patsubst $(SRCDIR)/%.$(CEXT),$(OBJDIR)/%.$(DEPEXT),$(SOURCES))
.PHONY: all clean
all: $(OBJDIR) $(TARGET)
clean:
rm -rf $(OBJDIR) $(TARGET)
db:
.venv/bin/compiledb make -B
$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) $(COPTS) -I$(INCDIR) $^ -o $@ $(LIBS)
$(OBJDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(CEXT) Makefile
$(CC) $(CFLAGS) $(COPTS) -I$(INCDIR) -MMD -MP -c $< -o $@ $(LIBS)
$(OBJDIR):
mkdir -p $@
-include $(DEPENDS)