1 | CC := gcc |
2 | |
3 | TEST_SOCKET := /tmp/qemu-shim-test.socket |
4 | |
5 | ANALYZE := -fanalyzer |
6 | |
7 | bin/qemu-shim: bin |
8 | ${CC} main.c -pedantic -std=c11 -Wall -o $@ |
9 | |
10 | test: clean bin/qemu-shim bin/fake-qemu |
11 | TEST_SOCKET=${TEST_SOCKET} ./test.sh |
12 | |
13 | clean: |
14 | rm -r bin 2>/dev/null || true |
15 | |
16 | install: 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 | |
21 | uninstall: |
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 | |
28 | bin/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 | |
34 | analyze: bin |
35 | ${CC} main.c ${ANALYZE} -pedantic -std=c11 -Wall -o /dev/null |
36 | |
37 | bin: |
38 | mkdir -p bin |