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 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 SRC_DIR=src
OBJ_DIR=obj
DESTDIR=/ DESTDIR=/
.PHONY: all ${TARGET} clean install uninstall .PHONY: clean install uninstall test
all: ${TARGET}
${TARGET}: ${SRC_DIR}/main.c ${SRC_DIR}/main.h ${TARGET}: ${SRC_DIR}/main.c ${SRC_DIR}/main.h
${CC} ${CFLAGS} ${LDFLAGS} $< -o $@ ${CC} ${CFLAGS} ${LDFLAGS} $< -o $@
@ -18,12 +18,12 @@ clean:
rm ${TARGET} rm ${TARGET}
install: install:
install -Dm755 ${TARGET} ${DESTDIR}usr/bin/${TARGET} install -Dm755 ${TARGET} ${DESTDIR}${PREFIX}/bin/${TARGET}
install -Dm644 LICENSE ${DESTDIR}usr/share/licenses/${TARGET}/LICENSE install -Dm644 LICENSE ${DESTDIR}${PREFIX}/share/licenses/${TARGET}/LICENSE
uninstall: uninstall:
rm -f ${DESTDIR}usr/bin/${TARGET} rm -f ${DESTDIR}${PREFIX}/bin/${TARGET}
rm -rf ${DESTDIR}usr/share/licenses/${TARGET} rm -rf ${DESTDIR}${PREFIX}/share/licenses/${TARGET}
test: test:
@echo -n "Does input \"3.68 120 30d\" gives 317.95? " @echo -n "Does input \"3.68 120 30d\" gives 317.95? "