summaryrefslogtreecommitdiff
path: root/Makefile
blob: dfa689ed193ee51942f3a92e8cfeab1f4cf88541 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
CC := gcc
CFLAGS := -Wall -Wextra -std=c11 -O2
LDFLAGS :=

BINDIR := bin

SOURCES := $(wildcard src/*.c)
HEADERS := $(wildcard src/*.h)
TARGETS := $(patsubst src/%.c,$(BINDIR)/%,$(SOURCES))

.PHONY: all clean

all: $(TARGETS)

clean:
	find $(BINDIR) -maxdepth 1 -type f -delete

$(TARGETS): bin/%: src/%.c $(HEADERS)
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) -o $@ $<