about summary refs log tree commit diff stats
path: root/c/Makefile
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-08-21 01:24:12 +0200
committerSoispha <soispha@vhack.eu>2023-08-21 01:24:12 +0200
commit29db1ce52445a809ae9e4f7db2a19ccfa9904e31 (patch)
treecc5b8144b28ba7a2382892c45c235f9a0638b2b5 /c/Makefile
parentFix(latex): Remove state full chapter files (diff)
downloadflake-templates-29db1ce52445a809ae9e4f7db2a19ccfa9904e31.tar.gz
flake-templates-29db1ce52445a809ae9e4f7db2a19ccfa9904e31.zip
Feat(c): Init
Diffstat (limited to 'c/Makefile')
-rw-r--r--c/Makefile49
1 files changed, 49 insertions, 0 deletions
diff --git a/c/Makefile b/c/Makefile
new file mode 100644
index 0000000..57fa7cf
--- /dev/null
+++ b/c/Makefile
@@ -0,0 +1,49 @@
+PREFIX    := /usr/local
+BINPREFIX := $(DESTDIR)$(PREFIX)/bin
+MANPREFIX := $(DESTDIR)$(PREFIX)/share/man/man1
+
+BIN_NAME := project_name
+
+SRC := $(wildcard src/*.c)
+OBJ := $(SRC:.c=.o)
+DEP := $(OBJ:.o=.d)
+
+LIBS :=
+
+ALL_CFLAGS  := -O3 -MMD -Wall -Wextra -Wno-unused-parameter $(CFLAGS) $(CPPFLAGS)
+ALL_LDFLAGS := $(addprefix -l,$(LIBS)) $(CFLAGS) $(LDFLAGS)
+
+
+
+$(BIN_NAME): $(OBJ)
+	$(CC) -o $@ $+ $(ALL_LDFLAGS)
+
+install: $(BIN_NAME)
+	install -d $(BINPREFIX)
+	install $^ $(BINPREFIX)
+
+.c.o:
+	$(CC) -o $@ $< -c $(ALL_CFLAGS)
+
+valgrind-out.txt: $(BIN_NAME)
+	valgrind --leak-check=full \
+         --show-leak-kinds=all \
+         --show-error-list=yes \
+         --track-origins=yes \
+         --log-file=valgrind-out.txt \
+         ./rename
+
+.PHONY : clean options install test
+options:
+	@echo "CC      = $(CC)"
+	@echo "CFLAGS  = $(ALL_CFLAGS)"
+	@echo "LDFLAGS = $(ALL_LDFLAGS)"
+	@echo "OBJ = $(OBJ)"
+	@echo "DEP = $(DEP)"
+	@echo ""
+
+clean :
+	rm $(BIN_NAME) valgrind-out.txt $(OBJ) $(DEP)
+
+test:
+	./test