1 -include dracut-version.sh
3 VERSION
= $(shell [ -d .git
] && git describe
--abbrev
=0 --tags 2>/dev
/null || echo
$(DRACUT_VERSION
))
4 GITVERSION
= $(shell [ -d .git
] && { v
=$$(git describe
--tags 2>/dev
/null
); [ $${v\
#*-} != $$v ] && echo -$${v\#*-}; } )
9 libdir ?
= ${prefix}/lib
10 datadir ?
= ${prefix}/share
11 pkglibdir ?
= ${libdir}/dracut
12 sysconfdir ?
= ${prefix}/etc
13 bindir ?
= ${prefix}/bin
14 mandir ?
= ${prefix}/share
/man
15 CFLAGS ?
= -O2
-g
-Wall
16 CFLAGS
+= -std
=gnu99
-D_FILE_OFFSET_BITS
=64
17 bashcompletiondir ?
= ${datadir}/bash-completion
/completions
19 man1pages
= lsinitrd
.1
21 man5pages
= dracut.conf
.5
23 man7pages
= dracut.cmdline
.7 \
27 man8pages
= dracut
.8 \
31 modules.d
/98systemd
/dracut-cmdline.service
.8 \
32 modules.d
/98systemd
/dracut-initqueue.service
.8 \
33 modules.d
/98systemd
/dracut-mount.service
.8 \
34 modules.d
/98systemd
/dracut-shutdown.service
.8 \
35 modules.d
/98systemd
/dracut-pre-mount.service
.8 \
36 modules.d
/98systemd
/dracut-pre-pivot.service
.8 \
37 modules.d
/98systemd
/dracut-pre-trigger.service
.8 \
38 modules.d
/98systemd
/dracut-pre-udev.service
.8
40 manpages
= $(man1pages
) $(man5pages
) $(man7pages
) $(man8pages
)
42 .PHONY
: install clean archive rpm testimage
test all check AUTHORS doc dracut-version.sh
44 all: dracut-version.sh dracut-install skipcpio
/skipcpio
46 DRACUT_INSTALL_OBJECTS
= \
47 install/dracut-install.o \
53 # deps generated with gcc -MM
54 install/dracut-install.o
: install/dracut-install.c
install/log.h
install/macro.h \
55 install/hashmap.h
install/util.h
56 install/hashmap.o
: install/hashmap.c
install/util.h
install/macro.h
install/log.h \
58 install/log.o
: install/log.c
install/log.h
install/macro.h
install/util.h
59 install/util.o
: install/util.c
install/util.h
install/macro.h
install/log.h
60 install/strv.o
: install/strv.c
install/strv.h
install/util.h
install/macro.h
install/log.h
62 install/dracut-install
: $(DRACUT_INSTALL_OBJECTS
)
64 dracut-install
: install/dracut-install
70 skipcpio
/skipcpio.o
: skipcpio
/skipcpio.c
71 skipcpio
/skipcpio
: skipcpio
/skipcpio.o
74 indent
-i8
-nut
-br
-linux
-l120
install/dracut-install.c
75 indent
-i8
-nut
-br
-linux
-l120 skipcpio
/skipcpio.c
77 doc
: $(manpages
) dracut.html
79 ifneq ($(enable_documentation
),no
)
84 xsltproc
-o
$@
-nonet http
://docbook.sourceforge.net
/release
/xsl
/current
/manpages
/docbook.xsl
$<
87 asciidoc
-d manpage
-b docbook
-o
$@
$<
89 dracut
.8: dracut.usage.asc dracut
.8.asc
91 dracut.html
: dracut.asc
$(manpages
) dracut.css dracut.usage.asc
92 asciidoc
-a numbered
-d book
-b docbook
-o dracut.xml dracut.asc
93 xsltproc
-o dracut.html
--xinclude
-nonet \
94 --stringparam custom.css.source dracut.css \
95 --stringparam generate.css.header
1 \
96 http
://docbook.sourceforge.net
/release
/xsl
/current
/xhtml
/docbook.xsl dracut.xml
99 install: dracut-version.sh
100 mkdir
-p
$(DESTDIR
)$(pkglibdir
)
101 mkdir
-p
$(DESTDIR
)$(bindir)
102 mkdir
-p
$(DESTDIR
)$(sysconfdir
)
103 mkdir
-p
$(DESTDIR
)$(pkglibdir
)/modules.d
104 mkdir
-p
$(DESTDIR
)$(mandir)/man1
$(DESTDIR
)$(mandir)/man5
$(DESTDIR
)$(mandir)/man7
$(DESTDIR
)$(mandir)/man8
105 install -m
0755 dracut.sh
$(DESTDIR
)$(bindir)/dracut
106 install -m
0755 dracut-catimages.sh
$(DESTDIR
)$(bindir)/dracut-catimages
107 install -m
0755 mkinitrd-dracut.sh
$(DESTDIR
)$(bindir)/mkinitrd
108 install -m
0755 lsinitrd.sh
$(DESTDIR
)$(bindir)/lsinitrd
109 install -m
0644 dracut.conf
$(DESTDIR
)$(sysconfdir
)/dracut.conf
110 mkdir
-p
$(DESTDIR
)$(sysconfdir
)/dracut.conf.d
111 mkdir
-p
$(DESTDIR
)$(pkglibdir
)/dracut.conf.d
112 install -m
0755 dracut-functions.sh
$(DESTDIR
)$(pkglibdir
)/dracut-functions.sh
113 install -m
0755 dracut-version.sh
$(DESTDIR
)$(pkglibdir
)/dracut-version.sh
114 ln
-fs dracut-functions.sh
$(DESTDIR
)$(pkglibdir
)/dracut-functions
115 install -m
0755 dracut-logger.sh
$(DESTDIR
)$(pkglibdir
)/dracut-logger.sh
116 install -m
0755 dracut-initramfs-restore.sh
$(DESTDIR
)$(pkglibdir
)/dracut-initramfs-restore
117 cp
-arx modules.d
$(DESTDIR
)$(pkglibdir
)
118 ifneq ($(enable_documentation
),no
)
119 for i in
$(man1pages
); do
install -m
0644 $$i $(DESTDIR
)$(mandir)/man1
/$${i
##*/}; done
120 for i in
$(man5pages
); do
install -m
0644 $$i $(DESTDIR
)$(mandir)/man5
/$${i
##*/}; done
121 for i in
$(man7pages
); do
install -m
0644 $$i $(DESTDIR
)$(mandir)/man7
/$${i
##*/}; done
122 for i in
$(man8pages
); do
install -m
0644 $$i $(DESTDIR
)$(mandir)/man8
/$${i
##*/}; done
123 ln
-fs dracut.cmdline
.7 $(DESTDIR
)$(mandir)/man7
/dracut.kernel
.7
125 if
[ -n
"$(systemdsystemunitdir)" ]; then \
126 mkdir
-p
$(DESTDIR
)$(systemdsystemunitdir
); \
127 ln
-srf
$(DESTDIR
)$(pkglibdir
)/modules.d
/98systemd
/dracut-shutdown.service
$(DESTDIR
)$(systemdsystemunitdir
)/dracut-shutdown.service
; \
128 mkdir
-p
$(DESTDIR
)$(systemdsystemunitdir
)/shutdown.target.wants
; \
129 ln
-s ..
/dracut-shutdown.service \
130 $(DESTDIR
)$(systemdsystemunitdir
)/shutdown.target.wants
/dracut-shutdown.service
; \
131 mkdir
-p
$(DESTDIR
)$(systemdsystemunitdir
)/initrd.target.wants
; \
133 dracut-cmdline.service \
134 dracut-initqueue.service \
135 dracut-mount.service \
136 dracut-pre-mount.service \
137 dracut-pre-pivot.service \
138 dracut-pre-trigger.service \
139 dracut-pre-udev.service \
141 ln
-srf
$(DESTDIR
)$(pkglibdir
)/modules.d
/98systemd
/$$i $(DESTDIR
)$(systemdsystemunitdir
); \
143 $(DESTDIR
)$(systemdsystemunitdir
)/initrd.target.wants
/$$i; \
146 if
[ -f
install/dracut-install
]; then \
147 install -m
0755 install/dracut-install
$(DESTDIR
)$(pkglibdir
)/dracut-install
; \
149 if
[ -f skipcpio
/skipcpio
]; then \
150 install -m
0755 skipcpio
/skipcpio
$(DESTDIR
)$(pkglibdir
)/skipcpio
; \
152 mkdir
-p
$(DESTDIR
)${prefix}/lib
/kernel
/install.d
153 install -m
0755 50-dracut.
install $(DESTDIR
)${prefix}/lib
/kernel
/install.d
/50-dracut.
install
154 install -m
0755 51-dracut-rescue.
install $(DESTDIR
)${prefix}/lib
/kernel
/install.d
/51-dracut-rescue.
install
155 mkdir
-p
$(DESTDIR
)${bashcompletiondir}
156 install -m
0644 dracut-bash-completion.sh
$(DESTDIR
)${bashcompletiondir}/dracut
157 install -m
0644 lsinitrd-bash-completion.sh
$(DESTDIR
)${bashcompletiondir}/lsinitrd
160 @echo
"DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
166 $(RM
) $(manpages
:%=%.xml
) dracut.xml
168 $(RM
) dracut-
*.rpm dracut-
*.
tar.bz2 dracut-
*.
tar.xz
169 $(RM
) dracut-version.sh
170 $(RM
) dracut-install
install/dracut-install
$(DRACUT_INSTALL_OBJECTS
)
171 $(RM
) skipcpio
/skipcpio
$(SKIPCPIO_OBJECTS
)
172 $(RM
) $(manpages
) dracut.html
173 $(MAKE
) -C
test clean
175 dist: dracut-
$(VERSION
).
tar.xz
177 dracut-
$(VERSION
).
tar.xz
: doc syncheck
178 @echo
"DRACUT_VERSION=$(VERSION)" > dracut-version.sh
179 git archive
--format
=tar $(VERSION
) --prefix=dracut-
$(VERSION
)/ > dracut-
$(VERSION
).
tar
180 mkdir
-p dracut-
$(VERSION
)
181 for i in
$(manpages
) dracut.html dracut-version.sh
; do
[ "$${i%/*}" != "$$i" ] && mkdir
-p
"dracut-$(VERSION)/$${i%/*}"; cp
"$$i" "dracut-$(VERSION)/$$i"; done
182 tar --owner
=root
--group
=root
-rf dracut-
$(VERSION
).
tar $$(find dracut-
$(VERSION
) -type f
)
183 rm -fr
-- dracut-
$(VERSION
).
tar.xz dracut-
$(VERSION
)
184 xz
-9 dracut-
$(VERSION
).
tar
185 rm -f
-- dracut-
$(VERSION
).
tar
187 rpm
: dracut-
$(VERSION
).
tar.xz syncheck
188 rpmbuild
=$$(mktemp
-d
-t rpmbuild-dracut.XXXXXX
); src
=$$(pwd
); \
189 cp dracut-
$(VERSION
).
tar.xz
"$$rpmbuild"; \
190 LC_MESSAGES
=C
$$src/git2spec.pl
$(VERSION
) "$$rpmbuild" < dracut.spec
> $$rpmbuild/dracut.spec
; \
191 (cd
"$$rpmbuild"; rpmbuild
--define "_topdir $$PWD" --define "_sourcedir $$PWD" \
192 --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
193 --define "_rpmdir $$PWD" -ba dracut.spec
; ) && \
194 ( mv
"$$rpmbuild"/$$(arch
)/*.rpm .
; mv
"$$rpmbuild"/*.src.rpm .
;rm -fr
-- "$$rpmbuild"; ls
*.rpm
)
197 @ret
=0;for i in dracut-initramfs-restore.sh modules.d
/*/*.sh
; do \
198 [ "$${i##*/}" = "module-setup.sh" ] && continue
; \
199 read line
< "$$i"; [ "$${line#*bash*}" != "$$line" ] && continue
; \
200 [ $$V ] && echo
"posix syntax check: $$i"; bash
--posix
-n
"$$i" ; ret
=$$(($$ret+$$?
)); \
201 [ $$V ] && echo
"checking for [[: $$i"; if grep
-Fq
'[[ ' "$$i" ; then ret
=$$(($$ret+1)); echo
"$$i contains [["; fi \
203 @ret
=0;for i in
*.sh mkinitrd-dracut.sh modules.d
/*/*.sh \
204 modules.d
/*/module-setup.sh
; do \
205 [ $$V ] && echo
"bash syntax check: $$i"; bash
-n
"$$i" ; ret
=$$(($$ret+$$?
)); \
208 check: all syncheck rpm
209 @
[ "$$EUID" == "0" ] ||
{ echo
"'check' must be run as root! Please use 'sudo'."; exit
1; }
210 @
$(MAKE
) -C
test check
213 .
/dracut.sh
-l
-a debug
-f test-
$(shell uname
-r
).img
$(shell uname
-r
)
214 @echo wrote test-
$(shell uname
-r
).img
217 .
/dracut.sh
--debug
-l
-a debug
-f test-
$(shell uname
-r
).img
$(shell uname
-r
)
218 @echo wrote test-
$(shell uname
-r
).img
221 .
/dracut.sh
-l
-a debug
--kernel-only
-f test-kernel-
$(shell uname
-r
).img
$(shell uname
-r
)
222 @echo wrote test-
$(shell uname
-r
).img
223 .
/dracut.sh
-l
-a debug
--no-kernel
-f test-dracut.img
$(shell uname
-r
)
224 @echo wrote test-dracut.img
227 .
/dracut.sh
--debug
-H
-l
-f test-
$(shell uname
-r
).img
$(shell uname
-r
)
228 @echo wrote test-
$(shell uname
-r
).img
231 .
/dracut.sh
-H
-l
-f test-
$(shell uname
-r
).img
$(shell uname
-r
)
232 @echo wrote test-
$(shell uname
-r
).img
235 git shortlog
--numbered
--summary
-e |while read a rest
; do echo
$$rest;done
> AUTHORS
237 dracut.html.sign
: dracut-
$(VERSION
).
tar.xz dracut.html
238 gpg-sign-all dracut-
$(VERSION
).
tar.xz dracut.html
240 upload
: dracut.html.sign
241 kup put dracut-
$(VERSION
).
tar.xz dracut-
$(VERSION
).
tar.sign
/pub
/linux
/utils
/boot
/dracut
/
242 kup put dracut.html dracut.html.sign
/pub
/linux
/utils
/boot
/dracut
/