-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile
45 lines (33 loc) · 803 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
ODIR=./build/objs
BDIR=./build/bin
IDIR=./src
SDIR=./src
CC=gcc
LINK=gcc
DFLAGS=-g -O0 -fsanitize=address,leak,undefined
RFLAGS=-O3
CFLAGS=-I$(IDIR) -I$(IDIR)/regex/src -Wall $(DFLAGS)
_SRC=$(wildcard $(SDIR)/regex/src/*.c) $(wildcard $(SDIR)/*.c) $(wildcard $(SDIR)/*/*.c)
OBJ=$(patsubst $(SDIR)/%.c,$(ODIR)/%.o,$(_SRC))
DEPS=$(wildcard $(IDIR)/regex/src/*.h) $(wildcard $(IDIR)/*.h)
_BIN=parsed
BIN=$(patsubst %,$(BDIR)/%,$(_BIN))
.PHONY: all
all: $(BIN)
$(BDIR)/$(_BIN): $(OBJ)
mkdir -p `dirname $@`
$(LINK) $(CFLAGS) -o $@ $^ $(LIBS)
$(ODIR)/%.o: $(SDIR)/%.c $(DEPS)
mkdir -p `dirname $@`
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: new
new: clean all
.PHONY: clean
clean:
rm -fr $(ODIR)/*
.PHONY: cleanall
cleanall:
rm -fr $(ODIR)/* $(BDIR)/*
.PHONY: check
check: all
./build/bin/test