Makefile -rw-r--r-- 998 B
1CC := gcc
2
3TEST_SOCKET := /tmp/qemu-shim-test.socket
4
5ANALYZE := -fanalyzer
6
7bin/qemu-shim: bin
8 ${CC} main.c -pedantic -std=c11 -Wall -o $@
9
10test: clean bin/qemu-shim bin/fake-qemu
11 TEST_SOCKET=${TEST_SOCKET} ./test.sh
12
13clean:
14 rm -r bin 2>/dev/null || true
15
16install: bin/qemu-shim
17 install -m 0755 bin/qemu-shim /usr/bin
18 install -m 0644 contrib/qemu-shim@.service /usr/lib/systemd/user
19 install -m 0644 contrib/qemu-shim@.service /usr/lib/systemd/system
20
21uninstall:
22 [[ -f /usr/bin/qemu-shim ]] && rm -v /usr/bin/qemu-shim || true
23 [[ -f /usr/lib/systemd/user/qemu-shim@.service ]] && \
24 rm -v /usr/lib/systemd/user/qemu-shim@.service || true
25 [[ -f /usr/lib/systemd/system/qemu-shim@.service ]] && \
26 rm -v /usr/lib/systemd/system/qemu-shim@.service || true
27
28bin/fake-qemu: bin
29 echo "#!/bin/sh" > $@
30 echo "socat -v unix-listen:${TEST_SOCKET} /dev/null" >> $@
31 echo "exit 0" >> $@
32 chmod +x $@
33
34analyze: bin
35 ${CC} main.c ${ANALYZE} -pedantic -std=c11 -Wall -o /dev/null
36
37bin:
38 mkdir -p bin