kwh-cost/Makefile

27 lines
649 B
Makefile
Raw Permalink Normal View History

TARGET=kwh-cost
2021-12-23 23:58:23 +04:00
DESTDIR:=
PREFIX:=/usr/local
CFLAGS=--std=c99 -O3 -Wall -Werror -Wextra -pedantic
2021-12-23 23:58:23 +04:00
.PHONY: clean install uninstall test
2021-12-23 23:58:23 +04:00
${TARGET}: main.c
${CC} ${CFLAGS} ${LDFLAGS} $< -o $@
2021-12-23 23:58:23 +04:00
clean:
rm ${TARGET}
install:
install -Dm755 ${TARGET} ${DESTDIR}${PREFIX}/bin/${TARGET}
install -Dm644 LICENSE ${DESTDIR}${PREFIX}/share/licenses/${TARGET}/LICENSE
2021-12-23 23:58:23 +04:00
uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/${TARGET}
rm -rf ${DESTDIR}${PREFIX}/share/licenses/${TARGET}
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"; }