ahenk-go/Makefile

52 lines
2 KiB
Makefile
Raw Normal View History

2023-08-23 22:54:49 +03:00
REPO_NAME=ahenk-go
REPO_LINK=https://git.aliberksandikci.com.tr/liderahenk/${REPO_NAME}
2023-08-21 16:45:11 +03:00
2023-08-23 22:54:49 +03:00
DAEMON_NAME=ahenk-go
OLD_DAEMON_NAME=ahenkd-go
PYTHON_DAEMON_NAME=ahenkd
2023-08-21 16:45:11 +03:00
2023-08-23 22:54:49 +03:00
DATA_DIR=/etc/ahenk-go/
LIB_DIR=/usr/share/ahenk-go/
PLUGIN_DIR=${LIB_DIR}/plugins/
TEMP_DIR=$(mktemp -d)
MAIN_DIR=${TEMP_DIR}/${REPO_NAME}/
2023-08-21 16:45:11 +03:00
info:
@echo "Made by Aliberk Sandıı - 2023"
@echo "preclean: for cleaning old files, configurations"
@echo "TODO test: Test go files"
2023-08-23 22:54:49 +03:00
@echo "install: Build and install ahenk-go to DESTDIR"
@echo "uninstall: Uninstall ahenk-go from DESTDIR"
2023-08-21 16:45:11 +03:00
preclean:
sudo rm -rf /usr/bin/$(DAEMON_NAME)
sudo rm -rf /usr/bin/${OLD_DAEMON_NAME}
sudo rm -rf /usr/bin/${PYTHON_DAEMON_NAME}
@# TODO systemd control for both three process for docker
@# REVIEW are both killall and systemctl commands running?
@pgrep -x ${DAEMON_NAME} && (sudo killall "${DAEMON_NAME}" || sudo systemctl disable "${DAEMON_NAME}" || sudo systemctl stop "${DAEMON_NAME}") || echo "no ${DAEMON_NAME} found"
@pgrep -x ${OLD_DAEMON_NAME} && (sudo killall "${OLD_DAEMON_NAME}" || sudo systemctl disable "${OLD_DAEMON_NAME}" || sudo systemctl stop "${OLD_DAEMON_NAME}") || echo "no ${OLD_DAEMON_NAME} found"
@# TODO
@# echo -e "Do you want to remove python implementation of ahenk if installed in system?"
2023-08-23 22:54:49 +03:00
@# read -rp "(Y/N) " input
2023-08-21 16:45:11 +03:00
@pgrep -x ${PYTHON_DAEMON_NAME} && (sudo killall "${PYTHON_DAEMON_NAME}" || sudo systemctl disable "${PYTHON_DAEMON_NAME}" || sudo systemctl stop "${PYTHON_DAEMON_NAME}") || echo "no ${PYTHON_DAEMON_NAME} found"
sudo systemctl daemon-reload
2023-08-23 22:54:49 +03:00
sudo rm -rf ${DATA_DIR}
2023-08-21 16:45:11 +03:00
@echo -e "PRE-CLENING DONE\n"
test:
2023-08-23 22:54:49 +03:00
@echo -e "Testing go files not implemented yet!"
2023-08-21 16:45:11 +03:00
install:
2023-08-23 22:54:49 +03:00
sudo go build -o ${DESTDIR}/usr/bin/${REPO_NAME} ./cmd/ahenk-go/
@sudo mkdir -p "${DESTDIR}/${LIB_DIR}"
@sudo mkdir -p "${DESTDIR}/${PLUGIN_DIR}"
2023-08-21 16:45:11 +03:00
2023-08-23 22:54:49 +03:00
sudo go build -buildmode=plugin -o ${DESTDIR}/${PLUGIN_DIR}/resources.so ./plugins/resources
@sudo mkdir -p "${DESTDIR}/${DATA_DIR}"
2023-08-21 16:45:11 +03:00
2023-08-23 22:54:49 +03:00
uninstall:
@sudo rm -rf ${DESTDIR}/usr/bin/${REPO_NAME}