summaryrefslogtreecommitdiff
path: root/Maakbestand
blob: 98e079831c42d33b18ca929ee65a8f013e8ab815 (plain)
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
CC := gcc
CFLAGS := -Wall -Wextra -std=c2x -O2
LDFLAGS :=

OBJDIR := obj
TARGET := drukkedoos

SOURCES := $(shell find src -type f -name '*.c')
HEADERS := $(shell find src -type f -name '*.h')
OBJECTS := $(patsubst src/%.c,obj/%.o,$(SOURCES))

PROGNAMES_X := $(patsubst src/%.c,X(%),$(wildcard src/*.c))

.PHONY: all clean

all: $(TARGET)

clean:
	rm -rf $(OBJDIR) $(TARGET)

$(TARGET): main.c $(OBJECTS)
	$(CC) -o $@ $^ $(LDFLAGS) -DPROGNAMES_XLIST="$(PROGNAMES_X)"

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