aboutsummaryrefslogtreecommitdiff
path: root/.boilerplates/c/makefile
diff options
context:
space:
mode:
Diffstat (limited to '.boilerplates/c/makefile')
-rw-r--r--.boilerplates/c/makefile24
1 files changed, 24 insertions, 0 deletions
diff --git a/.boilerplates/c/makefile b/.boilerplates/c/makefile
new file mode 100644
index 0000000..b3f9b64
--- /dev/null
+++ b/.boilerplates/c/makefile
@@ -0,0 +1,24 @@
+TARGET=out/name
+CC=gcc
+CFLAGS=-Iinc -Wall -Wextra -g
+
+SRC=$(wildcard src/*.c)
+OBJ=$(patsubst src/%.c,out/%.o,$(SRC))
+MAKEFLAGS+=--silent
+
+all: $(TARGET)
+
+$(TARGET): $(OBJ)
+ $(CC) $(CFLAGS) -o $@ $^
+
+out/%.o: src/%.c
+ @mkdir -p "$(@D)"
+ $(CC) $(CFLAGS) -MD -o $@ -c $<
+
+
+clean:
+ rm -rf out/ $(TARGET)
+
+-include $(OBJECTS:.o=.d)
+
+.PHONY: all clean run