aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJoe <bousset.rudy@gmail.com>2019-12-03 20:40:22 +0100
committerJoe <bousset.rudy@gmail.com>2019-12-03 20:40:22 +0100
commit103970e14215254f60e1eddc93f2a2342c7eb344 (patch)
tree1347ae7f3eafbc468ef619adaf749cdeae244186 /Makefile
parentcpp mode (diff)
downloadlowbat-gnu-103970e14215254f60e1eddc93f2a2342c7eb344.tar.gz
lowbat-gnu-103970e14215254f60e1eddc93f2a2342c7eb344.tar.bz2
lowbat-gnu-103970e14215254f60e1eddc93f2a2342c7eb344.tar.xz
lowbat-gnu-103970e14215254f60e1eddc93f2a2342c7eb344.tar.zst
lowbat-gnu-103970e14215254f60e1eddc93f2a2342c7eb344.zip
Makefile update
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files changed, 16 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index eec2142..36f2566 100644
--- a/Makefile
+++ b/Makefile
@@ -2,10 +2,11 @@
default: all
-SHELL
+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
@@ -25,7 +26,11 @@ FSANITIZE = -fsanitize=address
OPTIMIZE = -O2
-TARGET = lowbat
+CFLAGS += ${OPTIMIZE}
+
+NAME = ${TRGT_DIR}lowbat
+
+MKDIR = mkdir -p
OS = $(shell uname -s)
ifeq ($(OS), Darwin)
@@ -35,7 +40,15 @@ else
endif
MANPREFIX = $(PREFIX)/share/man
-install:
+${OBJS_DIR}%.o: ${SRCS_DIR}%.cpp ${INCS_DIR}${INCS}
+ @${MKDIR} ${OBJS_DIR}
+
+${NAME}: ${OBJS}
+ ${CC} ${CFLAGS} -o ${TARGET} ${OBJS}
+
+all:
+ @${MAKE} -j5 ${NAME}
+install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f bin/lowbat $(DESTDIR)$(PREFIX)/bin/
chmod 755 $(DESTDIR)$(PREFIX)/bin/lowbat