Ajout : Makefile
This commit is contained in:
parent
1662776d6b
commit
57bbb0642b
1 changed files with 45 additions and 0 deletions
45
Makefile
Normal file
45
Makefile
Normal file
|
@ -0,0 +1,45 @@
|
|||
NAME := qemush
|
||||
|
||||
# qemu Unix user
|
||||
QEMU_USER := qemu
|
||||
# sudo as qemu
|
||||
SUDO_QEMU := sudo -u $(QEMU_USER)
|
||||
|
||||
QEMUSH := /usr/local/bin/$(NAME)
|
||||
SRC_QEMUSH := bin/$(NAME)
|
||||
|
||||
# This repo's equivalent of effective qemu Unix user home
|
||||
SRC_QEMU_HOME := qemu
|
||||
SRC_QEMU_BIN := $(SRC_QEMU_HOME)/bin
|
||||
# Actual qemu Unix user home
|
||||
QEMU_HOME := $(shell echo ~$(QEMU_USER))
|
||||
QEMU_BIN := $(QEMU_HOME)/bin
|
||||
|
||||
# Names of all qemush modules
|
||||
SRC_MODULES_NAMES := $(notdir $(wildcard $(SRC_QEMU_BIN)/*))
|
||||
# Target location of modules
|
||||
MODULES := $(addprefix $(QEMU_BIN)/,$(SRC_MODULES_NAMES))
|
||||
# Mode to apply
|
||||
BINS_MODE := 740
|
||||
|
||||
# Compiler options
|
||||
CC := cc
|
||||
CC_OPTIONS = -O3
|
||||
# C sources file format
|
||||
SRC_FMT := c
|
||||
# Names of C programs to compile
|
||||
SRC_C_SOURCES_NAMES := $(notdir $(basename $(wildcard $(SRCD)/*.$(SRC_FMT))))
|
||||
# Location of C binaries
|
||||
C_BINARIES := $(addprefix $(QEMU_BIN)/,$(SRC_C_SOURCES_NAMES))
|
||||
|
||||
all: $(QEMUSH) $(MODULES) $(C_BINARIES)
|
||||
|
||||
$(QEMUSH): $(SRC_QEMUSH)
|
||||
sudo install -m 755 $^ $@
|
||||
|
||||
$(MODULES): $(QEMU_HOME)%: $(SRC_QEMU_HOME)%
|
||||
$(SUDO_QEMU) install -m $(BINS_MODE) $^ $@
|
||||
|
||||
$(C_BINARIES): $(QEMU_BIN)%: $(SRCD)/%.$(SRC_FMT)
|
||||
$(SUDO_QEMU) $(QEMU_USER) $(CC) $(CC_OPTIONS) -o $@ $^
|
||||
$(SUDO_QEMU) chmod $(BINS_MODE) $@
|
Loading…
Reference in a new issue