-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (38 loc) · 1.49 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
BINARY ?= qemu-system-x86_64
PREFIX ?= /usr/local
ETCDIR ?= /etc
MANPREFIX ?= $(PREFIX)/share/man
VERSION = $(shell head -n 1 README.md | cut -d- -f 2)
all: qemuconf
qemuconf: qemuconf.c
$(CC) $(LDFLAGS) $(CFLAGS) -DVERSION=\"$(VERSION)\" -DBINARY=\"$(BINARY)\" -o $@ $<
clean:
rm -f qemuconf [email protected] qemu.runit
qemuconf.1: README.md
pandoc -f markdown_github -t man $< | \
sed "1s/\.SH/.TH/" > $@
sed "s#PREFIX#$(PREFIX)#g;s#ETCDIR#$(ETCDIR)#" $< > $@
qemu.runit: qemu.runit.in
sed "s#PREFIX#$(PREFIX)#g;s#ETCDIR#$(ETCDIR)#" $< > $@
install: qemuconf
mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(MANPREFIX)/man1 \
$(ETCDIR)/qemu.d
cp -f qemuconf $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/qemuconf
cp -f qemuconf.1 $(DESTDIR)$(MANPREFIX)/man1/
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/qemuconf.1
install-systemd: [email protected] install
mkdir -p $(DESTDIR)$(PREFIX)/lib/systemd/system
cp -f $< $(DESTDIR)$(PREFIX)/lib/systemd/system
chmod 644 $(DESTDIR)$(PREFIX)/lib/systemd/system/$<
install-runit: qemu.runit install
mkdir -p $(DESTDIR)$(ETCDIR)/sv/qemu-generic
cp -f $< $(DESTDIR)$(ETCDIR)/sv/qemu-generic/run
chmod 755 $(DESTDIR)$(ETCDIR)/sv/qemu-generic/run
uninstall:
rm -rf $(DESTDIR)$(MANPREFIX)/man1/qemuconf.1 $(DESTDIR)$(PREFIX)/sv/qemu-generic \
$(DESTDIR)$(PREFIX)/lib/systemd/system/[email protected] $(DESTDIR)$(PREFIX)/bin/qemuconf
test: qemuconf
@test/test.sh
.PHONY: clean install install-systemd install-runit uninstall test