summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--Makefile21
-rw-r--r--main.c5
-rw-r--r--src/waar.c1
4 files changed, 19 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index 1cd4d4c..6ab0ef1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
-bin/
+drukkedoos
+obj/
.ccls-cache/
diff --git a/Makefile b/Makefile
index dfa689e..e760b65 100644
--- a/Makefile
+++ b/Makefile
@@ -2,19 +2,22 @@ CC := gcc
CFLAGS := -Wall -Wextra -std=c11 -O2
LDFLAGS :=
-BINDIR := bin
+OBJDIR := obj
+TARGET := drukkedoos
-SOURCES := $(wildcard src/*.c)
-HEADERS := $(wildcard src/*.h)
-TARGETS := $(patsubst src/%.c,$(BINDIR)/%,$(SOURCES))
+SOURCES := $(shell find src -type f -name '*.c')
+HEADERS := $(shell find src -type f -name '*.h')
+OBJECTS := $(patsubst src/%.c,obj/%.o,$(SOURCES))
.PHONY: all clean
-all: $(TARGETS)
+all: $(TARGET)
clean:
- find $(BINDIR) -maxdepth 1 -type f -delete
+ rm -rf $(OBJDIR) $(TARGET)
-$(TARGETS): bin/%: src/%.c $(HEADERS)
- @mkdir -p $(dir $@)
- $(CC) $(CFLAGS) -o $@ $<
+$(TARGET): main.c $(OBJECTS)
+ $(CC) -o $@ $^ $(LDFLAGS)
+
+$(OBJECTS): obj/%.o: src/%.c $(HEADERS)
+ $(CC) $(CFLAGS) -c -o $@ $<
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..b5e3883
--- /dev/null
+++ b/main.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+
+int main(int argc, char **argv) {
+ fprintf(stderr, "Drukkedoos moet nog geïmplementeerd worden\n");
+}
diff --git a/src/waar.c b/src/waar.c
deleted file mode 100644
index 237c8ce..0000000
--- a/src/waar.c
+++ /dev/null
@@ -1 +0,0 @@
-int main() {}