Added PREFIX in Makefile.Fixed .PHONY. Standard c2x was changed to c99.

This commit is contained in:
Alexander Andreev 2023-09-17 22:46:12 +04:00
parent b0f1b367d2
commit f4ce191ae7
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

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