av/cmd/vidforward/Makefile

45 lines
1.1 KiB
Makefile
Raw Normal View History

# NB: The default (soft) install does not override existing installation files.
USER := $(shell whoami)
PATH := /usr/local/go/bin:$(PATH)
BIN_NAME := vidforward
BIN_DIR := /src/bitbucket.org/ausocean/av/cmd/$(BIN_NAME)
2023-02-08 08:49:05 +03:00
RUN_SCRIPT_DIR := $(BIN_DIR)/run.sh
.SILENT:soft_copy_files
.SILENT:hard_copy_files
.SILENT:clean
rebuild:
2023-05-29 08:49:05 +03:00
go build -tags debug
install: as_root soft_copy_files rebuild
@echo "Install complete"
2023-02-08 08:49:05 +03:00
install_hard: as_root hard_copy_files rebuild
@echo "Hard install complete"
as_root:
ifneq ($(USER),root)
$(error Must run as superuser!)
endif
soft_copy_files:
if [ -f /etc/systemd/system/$(BIN_NAME).service ] ; then \
echo "/etc/systemd/system/$(BIN_NAME).service left unmodified" ; \
else \
bash create_service.sh $(RUN_SCRIPT_DIR) $(BIN_DIR); \
fi
systemctl enable $(BIN_NAME).service
hard_copy_files:
if [ -f /etc/systemd/system/$(BIN_NAME).service ] ; then \
echo "/etc/systemd/system/$(BIN_NAME).service overwritten" ; \
fi
bash create_service.sh $(RUN_SCRIPT_DIR) $(BIN_DIR)
systemctl enable $(BIN_NAME).service
clean: as_root
rm -rf /var/log/vidforward
rm -rf /etc/systemd/system/$(BIN_NAME).service
@echo "Clean complete"