Calculates cost of electricity.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
684 B

TARGET=kwh-cost
CFLAGS=--std=c2x -O3 -Wall -Werror -Wextra -pedantic
SRC_DIR=src
OBJ_DIR=obj
DESTDIR=/
.PHONY: all ${TARGET} clean install uninstall
all: ${TARGET}
${TARGET}: ${SRC_DIR}/main.c ${SRC_DIR}/main.h
${CC} ${CFLAGS} ${LDFLAGS} $< -o $@
clean:
rm ${TARGET}
install:
install -Dm755 ${TARGET} ${DESTDIR}usr/bin/${TARGET}
install -Dm644 LICENSE ${DESTDIR}usr/share/licenses/${TARGET}/LICENSE
uninstall:
rm -f ${DESTDIR}usr/bin/${TARGET}
rm -rf ${DESTDIR}usr/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"; }