-
Notifications
You must be signed in to change notification settings - Fork 65
/
Makefile
101 lines (87 loc) · 2.89 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#PACKAGE_VERSION = $(shell /bin/grep -F -- GK_V= genkernel | sed "s/.*GK_V='\([^']\+\)'/\1/")
PACKAGE_VERSION = $(shell git describe --tags |sed 's,^v,,g')
distdir = genkernel-$(PACKAGE_VERSION)
MANPAGE = genkernel.8
# Add off-Git/generated files here that need to be shipped with releases
EXTRA_DIST = $(MANPAGE) ChangeLog $(KCONF)
default: kconfig man
# First argument in the override file
# Second argument is the base file
BASE_KCONF = defaults/kernel-generic-config
ARCH_KCONF = $(wildcard arch/*/arch-config)
GENERATED_KCONF = $(subst arch-,generated-,$(ARCH_KCONF))
KCONF = $(GENERATED_KCONF)
debug:
@echo "ARCH_KCONF=$(ARCH_KCONF)"
@echo "GENERATED_KCONF=$(GENERATED_KCONF)"
kconfig: $(GENERATED_KCONF)
man: $(MANPAGE)
ChangeLog:
git log >$@
clean:
rm -f $(EXTRA_DIST)
check-git-repository:
ifneq ($(UNCLEAN),1)
git diff --quiet || { echo 'STOP, you have uncommitted changes in the working directory' ; false ; }
git diff --cached --quiet || { echo 'STOP, you have uncommitted changes in the index' ; false ; }
else
@true
endif
dist: verify-shellscripts-initramfs verify-doc check-git-repository distclean $(EXTRA_DIST)
mkdir "$(distdir)"
git ls-files -z | xargs -0 cp --no-dereference --parents --target-directory="$(distdir)" \
$(EXTRA_DIST)
tar cf "$(distdir)".tar "$(distdir)"
xz -v "$(distdir)".tar
rm -Rf "$(distdir)"
distclean: clean
rm -Rf "$(distdir)" "$(distdir)".tar "$(distdir)".tar.xz
.PHONY: clean check-git-repository dist distclean kconfig verify-doc
# Generic rules
%/generated-config: %/arch-config $(BASE_KCONF) merge.pl Makefile
if grep -sq THIS_CONFIG_IS_BROKEN $< ; then \
cat $< >$@ ; \
else \
perl merge.pl $< $(BASE_KCONF) | sort > $@ ; \
fi ;
%.8: doc/%.8.txt doc/asciidoc.conf Makefile genkernel
a2x --conf-file=doc/asciidoc.conf --attribute="genkernelversion=$(PACKAGE_VERSION)" \
--format=manpage -D . "$<"
verify-doc: doc/genkernel.8.txt
@rm -f faildoc ; \
GK_SHARE=. ./genkernel --help | \
sed 's,-->, ,g' | \
fmt -1 | \
grep -e '--' | \
tr -s '[:space:].,' ' ' | \
sed -r \
-e 's,=<[^>]+>,,g' | \
tr -s ' ' '\n' | \
sed -r \
-e 's,[[:space:]]*--(no-)?,,g' \
-e '/boot-font/s,=\(current\|<file>\|none\),,g' \
-e '/bootloader/s,=\(grub\|grub2\),,g' \
-e '/microcode/s,=\(all\|amd\|intel\),,g' \
-e '/ssh-host-keys/s,=\(create\|create-from-host\|runtime\),,g' | \
while read opt ; do \
regex="^*--(...no-...)?$$opt" ; \
if ! grep -Ee "$$regex" $< -sq ; then \
touch faildoc ; \
echo "Undocumented option: $$opt" ; \
fi ; \
done ; \
if test -e faildoc ; then \
echo "Refusing to build!" ; \
rm -f faildoc ; \
exit 1 ; \
fi ; \
rm -f faildoc
verify-shellscripts-initramfs:
# we need to check every file because a fatal error in
# an included file (SC1094) is just a warning at the moment
shellcheck \
--external-sources \
--source-path SCRIPTDIR \
--severity error \
defaults/linuxrc \
defaults/initrd.scripts