29 lines
560 B
Makefile
29 lines
560 B
Makefile
TARGET=kwh-cost
|
|
|
|
CFLAGS=--std=c2x -O3 -Wall -Werror -Wextra -pedantic
|
|
|
|
SRC_DIR=src
|
|
OBJ_DIR=obj
|
|
|
|
DESTDIR=/
|
|
|
|
all: ${TARGET}
|
|
|
|
${TARGET}: ${OBJ_DIR}/main.o
|
|
${CC} ${CFLAGS} $< -o $@
|
|
|
|
${OBJ_DIR}/main.o: ${SRC_DIR}/main.c ${SRC_DIR}/main.h
|
|
@mkdir -p ${OBJ_DIR}
|
|
${CC} ${CFLAGS} -c $< -o $@
|
|
|
|
clean:
|
|
rm -r ${OBJ_DIR}
|
|
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 -f ${DESTDIR}usr/share/licenses/${TARGET}/LICENSE
|