aboutsummaryrefslogtreecommitdiff
path: root/.boilerplates/c/makefile
diff options
context:
space:
mode:
authorMarvin Borner2020-06-10 16:29:48 +0200
committerMarvin Borner2020-06-10 16:29:48 +0200
commit52fcc57f84bf1c5fbcae1de466ec770c0831a1b7 (patch)
tree5a0cb9f2dfdcdb740a09187c4ea141bb973464f4 /.boilerplates/c/makefile
parent2a15a328c424eca5ede8280501c19145ea68efd0 (diff)
Added awesome c boilerplate
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