qemush/Makefile

42 lines
1.1 KiB
Makefile
Raw Normal View History

2024-03-27 12:54:28 +01:00
# SRC = source
# DST = destination
# *D = folder containing *
2023-12-10 17:36:13 +01:00
2024-03-27 12:54:28 +01:00
NAME := qemush
2023-12-10 17:36:13 +01:00
QEMU_USER := qemu
2024-03-27 12:54:28 +01:00
SRC_BIN := bin/$(NAME)
DST_BIN := /usr/local/$(SRC_BIN)
2023-12-10 17:36:13 +01:00
2024-03-27 12:54:28 +01:00
SRC_HOME := $(QEMU_USER)
DST_HOME := $(shell echo ~$(QEMU_USER))
2023-12-10 17:36:13 +01:00
2024-03-27 12:54:28 +01:00
SRC_BIND := $(SRC_HOME)/bin
SRC_LAUNCHERSD := $(SRC_HOME)/launchers
DST_BIND := $(DST_HOME)/bin
DST_LAUNCHERSD := $(DST_HOME)/launchers
2023-12-10 17:36:13 +01:00
2024-03-27 12:54:28 +01:00
MODULES_NAMES := $(notdir $(wildcard $(SRC_BIND)/*))
LAUNCHERS_NAMES := $(notdir $(wildcard $(SRC_LAUNCHERSD)/*))
2023-12-10 17:36:13 +01:00
2024-03-27 12:54:28 +01:00
DST_MODULES := $(addprefix $(DST_BIND)/,$(MODULES_NAMES))
DST_LAUNCHERS := $(addprefix $(DST_LAUNCHERSD)/,$(LAUNCHERS_NAMES))
QEMUSH_DIRS := $(addprefix $(DST_HOME)/,bin launchers disks sockets/monitors sockets/spice)
2024-03-09 23:53:14 +01:00
.PHONY: install
2024-03-27 12:54:28 +01:00
install: $(QEMUSH_DIRS) $(DST_MODULES) $(DST_BIN) $(DST_LAUNCHERS)
$(QEMUSH_DIRS):
sudo -u $(QEMU_USER) mkdir -m 750 -p -- $@
2023-12-10 17:36:13 +01:00
2024-03-27 12:54:28 +01:00
$(DST_BIN): $(SRC_BIN)
sudo install -m 755 -- $^ $@
2023-12-10 17:36:13 +01:00
2024-03-27 12:54:28 +01:00
$(DST_MODULES): $(DST_HOME)%: $(SRC_HOME)%
sudo -u $(QEMU_USER) install -m 740 -- $^ $@
2023-12-13 13:00:20 +01:00
2024-03-27 12:54:28 +01:00
$(LAUNCHERS): $(DST_LAUNCHERSD)%: $(SRC_LAUNCHERSD)%
sudo -u $(QEMU_USER) install -m 740 -- $^ $@