-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (32 loc) · 837 Bytes
/
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
CC = gcc
cc-option = $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null 1>&2 2>/dev/null; then echo $(1); fi)
CFLAGS += -Wall -Werror \
$(call cc-option,-fanalyzer)
CFLAGS_STATIC += -static $(CFLAGS)
LDLIBS += $(shell pkg-config --libs --static blkid)
SHELLCHECK_OPTS := $(shell shellcheck --help)
scripts = \
vm-run \
vm-run-stub \
vm-initrd \
vm-init \
vm-create-image \
vm-resize \
filetrigger \
createimage \
bash_completion \
kvm-ok
all: initrd-init fakesudo
initrd-init: initrd-init.c
$(CC) $(CFLAGS_STATIC) $^ $(LDLIBS) -o $@
fakesudo: fakesudo.c
$(CC) $(CFLAGS) $^ -o $@
clean:
-rm -f initrd-init fakesudo *.o
check: shellcheck
shellcheck: $(scripts)
$(foreach f,$^,bash -n $(f);)
ifneq ($(findstring --severity=,$(SHELLCHECK_OPTS)),)
shellcheck --severity=error $^
endif
.PHONY: clean check shellcheck