aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2019-12-04 03:03:18 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2019-12-04 03:03:18 +0100
commit7463c213100854d106bcdd1289370f0116ed356c (patch)
treef1d9fc780c8c21bb33a86d63e298752e0580d2c0
parentRemoved some Makefile (diff)
downloadlowbat-gnu-7463c213100854d106bcdd1289370f0116ed356c.tar.gz
lowbat-gnu-7463c213100854d106bcdd1289370f0116ed356c.tar.bz2
lowbat-gnu-7463c213100854d106bcdd1289370f0116ed356c.tar.xz
lowbat-gnu-7463c213100854d106bcdd1289370f0116ed356c.tar.zst
lowbat-gnu-7463c213100854d106bcdd1289370f0116ed356c.zip
Added back some Makefile utils
-rw-r--r--Makefile62
1 files changed, 62 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index c8f611c..c2bf741 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,65 @@
+.POSIX:
+
+default: all
+
+SHELL := /bin/sh
+
+SRCS_DIR = src/
+INCS_DIR = inc/
+OBJS_DIR = obj/
+TRGT_DIR = bin/
+
+SRCS = ${SRCS_DIR}main.cpp
+SRCS += ${SRCS_DIR}jo_exec.cpp
+SRCS += ${SRCS_DIR}jo_notify.cpp
+
+INCS = jo_lowbat.hpp
+
+OBJS = $(patsubst ${SRCS_DIR}%.cpp,${OBJS_DIR}%.o,${SRCS})
+
+CC = g++
+
+DEBUG = -g3
+FSANITIZE = -fsanitize=address
+
+OPTIMIZE = -O3
+
+CFLAGS = -Wall
+CFLAGS += -Wextra
+CFLAGS += -Werror
+CFLAGS += ${OPTIMIZE}
+
+NAME = lowbat
+
+MKDIR = mkdir -p
+RM = rm -rf
+
+OS = $(shell uname -s)
+ifeq ($(OS), Darwin)
+ PREFIX = /usr/local
+else
+ PREFIX = /usr
+endif
+MANPREFIX = $(PREFIX)/share/man
+
+
+${OBJS_DIR}%.o: ${SRCS_DIR}%.cpp ${INCS_DIR}${INCS}
+ @${MKDIR} ${OBJS_DIR}
+ ${CC} ${CFLAGS} -I${INCS_DIR} -c -o $@ $<
+
+${NAME}: ${OBJS}
+ @${MKDIR} ${TRGT_DIR}
+ ${CC} ${CFLAGS} -o ${TRGT_DIR}${NAME} ${OBJS}
+
+all: ${NAME}
+
+clean:
+ ${RM} ${OBJS_DIR}
+
+fclean: clean
+ ${RM} ${TRGT_DIR}
+
+re: fclean all
install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin