# SRC = source # DST = destination # *D = folder containing * NAME := qemush QEMU_USER := qemu SRC_BIN := bin/$(NAME) DST_BIN := /usr/local/$(SRC_BIN) SRC_HOME := $(QEMU_USER) DST_HOME := $(shell echo ~$(QEMU_USER)) SRC_BIND := $(SRC_HOME)/bin SRC_LAUNCHERSD := $(SRC_HOME)/launchers DST_BIND := $(DST_HOME)/bin DST_LAUNCHERSD := $(DST_HOME)/launchers MODULES_NAMES := $(notdir $(wildcard $(SRC_BIND)/*)) LAUNCHERS_NAMES := $(notdir $(wildcard $(SRC_LAUNCHERSD)/*)) 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) .PHONY: install install: $(QEMUSH_DIRS) $(DST_MODULES) $(DST_BIN) $(DST_LAUNCHERS) $(QEMUSH_DIRS): sudo -u $(QEMU_USER) mkdir -p -- $@ sudo -u $(QEMU_USER) chmod -- 750 $@ $(DST_BIN): $(SRC_BIN) sudo install -m 755 -- $^ $@ $(DST_MODULES): $(DST_HOME)%: $(SRC_HOME)% sudo -u $(QEMU_USER) install -m 740 -- $^ $@ $(LAUNCHERS): $(DST_LAUNCHERSD)%: $(SRC_LAUNCHERSD)% sudo -u $(QEMU_USER) install -m 740 -- $^ $@