kwh-cost/Makefile

30 lines
691 B
Makefile
Raw Normal View History

TARGET=kwh-cost
2021-12-23 23:58:23 +04:00
CFLAGS=--std=c2x -O3 -Wall -Werror -Wextra -pedantic
SRC_DIR=src
OBJ_DIR=obj
DESTDIR=/
.PHONY: all ${TARGET} clean install uninstall
2021-12-23 23:58:23 +04:00
all: ${TARGET}
2021-12-23 23:58:23 +04:00
${TARGET}: ${SRC_DIR}/main.c ${SRC_DIR}/main.h
${CC} ${CFLAGS} ${LDFLAGS} $< -o $@
2021-12-23 23:58:23 +04:00
clean:
rm ${TARGET}
install:
2021-12-24 00:12:51 +04:00
install -Dm755 ${TARGET} ${DESTDIR}usr/bin/${TARGET}
install -Dm644 LICENSE ${DESTDIR}usr/share/licenses/${TARGET}/LICENSE
2021-12-23 23:58:23 +04:00
uninstall:
rm -f ${DESTDIR}usr/bin/${TARGET}
rm -f ${DESTDIR}usr/share/licenses/${TARGET}/LICENSE
test:
@echo -n "Does input \"3.68 120 30d\" gives 317.95? "
@test "${shell ./kwh-cost 3.68 120 30d}" = "317.95" && { echo -e "\e[32mYES\e[0m"; } || { echo -e "\e[31mNO\e[0m"; }