|
| 1 | +# Application Updater plugin for REHex |
| 2 | +# Copyright (C) 2025 Daniel Collins <[email protected]> |
| 3 | +# |
| 4 | +# This program is free software; you can redistribute it and/or modify it |
| 5 | +# under the terms of the GNU General Public License version 2 as published by |
| 6 | +# the Free Software Foundation. |
| 7 | +# |
| 8 | +# This program is distributed in the hope that it will be useful, but WITHOUT |
| 9 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 10 | +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 11 | +# more details. |
| 12 | +# |
| 13 | +# You should have received a copy of the GNU General Public License along with |
| 14 | +# this program; if not, write to the Free Software Foundation, Inc., 51 |
| 15 | +# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 16 | + |
| 17 | +INSTALL_FILES := \ |
| 18 | + json.lua \ |
| 19 | + updater.lua |
| 20 | + |
| 21 | +prefix ?= /usr/local |
| 22 | +exec_prefix ?= $(prefix) |
| 23 | +bindir ?= $(exec_prefix)/bin |
| 24 | +datarootdir ?= $(prefix)/share |
| 25 | +libdir ?= $(exec_prefix)/lib |
| 26 | + |
| 27 | +LUA ?= lua |
| 28 | + |
| 29 | +PLUGIN_NAME := updater |
| 30 | +PLUGINS_INST_DIR ?= $(DESTDIR)$(libdir)/rehex |
| 31 | + |
| 32 | +ifeq ($(BUSTED),) |
| 33 | + # LuaRocks under MinGW doesn't install busted under a bin/ directory - it sticks it |
| 34 | + # elsewhere and puts a .bat that runs it under the right Lua environment for Reasons. |
| 35 | + |
| 36 | + BUSTED := $(shell busted --version > /dev/null 2>&1 && echo busted --lua=$(LUA)) |
| 37 | + ifeq ($(BUSTED),) |
| 38 | + BUSTED := $(shell busted.bat --version > /dev/null 2>&1 && echo busted.bat --lua=$(LUA)) |
| 39 | + endif |
| 40 | + |
| 41 | + ifeq ($(BUSTED),) |
| 42 | + X := $(error Neither busted or busted.bat found in PATH) |
| 43 | + endif |
| 44 | +endif |
| 45 | + |
| 46 | +.PHONY: all |
| 47 | +all: |
| 48 | + |
| 49 | +.PHONY: check |
| 50 | +check: |
| 51 | + $(BUSTED) . |
| 52 | + |
| 53 | +.PHONY: install |
| 54 | +install: |
| 55 | + for f in $(INSTALL_FILES); \ |
| 56 | + do \ |
| 57 | + mkdir -p $(PLUGINS_INST_DIR)/$(PLUGIN_NAME)/`dirname $${f}`; \ |
| 58 | + install -m 0644 $${f} $(PLUGINS_INST_DIR)/$(PLUGIN_NAME)/$${f}; \ |
| 59 | + done |
| 60 | + |
| 61 | +.PHONY: uninstall |
| 62 | +uninstall: |
| 63 | + rm -f $(addprefix $(PLUGINS_INST_DIR)/$(PLUGIN_NAME)/,$(INSTALL_FILES)) |
| 64 | + rm -df $(PLUGINS_INST_DIR)/$(PLUGIN_NAME)/ |
0 commit comments