From 5edcbf9fa0017eb38110ae8b7ded7886e9267363 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Thu, 23 Dec 2021 23:58:23 +0400 Subject: [PATCH] Makefile --- Makefile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..61080a9 --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +TARGET=kwh-calc + +CC=cc +CFLAGS=--std=c2x -O3 -Wall -Werror -Wextra -pedantic + +SRC_DIR=src +OBJ_DIR=obj + +all: ${TARGET} + +${TARGET}: ${OBJ_DIR}/main.o + ${CC} ${CFLAGS} $< -o $@ + +${OBJ_DIR}/main.o: ${SRC_DIR}/main.c ${SRC_DIR}/main.h + @mkdir -p ${OBJ_DIR} + ${CC} ${CFLAGS} -c $< -o $@ + +clean: + rm -r ${OBJ_DIR} + rm ${TARGET} + +install: + install -m 755 ${TARGET} /usr/local/bin/${TARGET} + +uninstall: + rm -f /usr/local/bin/${TARGET} \ No newline at end of file