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 -Wformat
-Werror
=format-security
-Wp
,-D_FORTIFY_SOURCE
=2
17 bashcompletiondir ?
= ${datadir}/bash-completion
/completions
18 pkgconfigdatadir ?
= $(datadir)/pkgconfig
20 man1pages
= lsinitrd
.1
22 man5pages
= dracut.conf
.5
24 man7pages
= dracut.cmdline
.7 \
28 man8pages
= dracut
.8 \
32 modules.d
/98dracut-systemd
/dracut-cmdline.service
.8 \
33 modules.d
/98dracut-systemd
/dracut-initqueue.service
.8 \
34 modules.d
/98dracut-systemd
/dracut-mount.service
.8 \
35 modules.d
/98dracut-systemd
/dracut-shutdown.service
.8 \
36 modules.d
/98dracut-systemd
/dracut-pre-mount.service
.8 \
37 modules.d
/98dracut-systemd
/dracut-pre-pivot.service
.8 \
38 modules.d
/98dracut-systemd
/dracut-pre-trigger.service
.8 \
39 modules.d
/98dracut-systemd
/dracut-pre-udev.service
.8
41 manpages
= $(man1pages
) $(man5pages
) $(man7pages
) $(man8pages
)
43 .PHONY
: install clean archive rpm testimage
test all check AUTHORS doc dracut-version.sh
45 all: dracut-version.sh dracut.
pc dracut-install skipcpio
/skipcpio
47 DRACUT_INSTALL_OBJECTS
= \
48 install/dracut-install.o \
54 # deps generated with gcc -MM
55 install/dracut-install.o
: install/dracut-install.c
install/log.h
install/macro.h \
56 install/hashmap.h
install/util.h
57 install/hashmap.o
: install/hashmap.c
install/util.h
install/macro.h
install/log.h \
59 install/log.o
: install/log.c
install/log.h
install/macro.h
install/util.h
60 install/util.o
: install/util.c
install/util.h
install/macro.h
install/log.h
61 install/strv.o
: install/strv.c
install/strv.h
install/util.h
install/macro.h
install/log.h
63 install/dracut-install
: $(DRACUT_INSTALL_OBJECTS
)
65 dracut-install
: install/dracut-install
71 skipcpio
/skipcpio.o
: skipcpio
/skipcpio.c
72 skipcpio
/skipcpio
: skipcpio
/skipcpio.o
75 indent
-i8
-nut
-br
-linux
-l120
install/dracut-install.c
76 indent
-i8
-nut
-br
-linux
-l120 skipcpio
/skipcpio.c
78 doc
: $(manpages
) dracut.html
80 ifneq ($(enable_documentation
),no
)
85 xsltproc
-o
$@
-nonet http
://docbook.sourceforge.net
/release
/xsl
/current
/manpages
/docbook.xsl
$<
88 asciidoc
-d manpage
-b docbook
-o
$@
$<
90 dracut
.8: dracut.usage.asc dracut
.8.asc
92 dracut.html
: dracut.asc
$(manpages
) dracut.css dracut.usage.asc
93 asciidoc
-a numbered
-d book
-b docbook
-o dracut.xml dracut.asc
94 xsltproc
-o dracut.html
--xinclude
-nonet \
95 --stringparam custom.css.source dracut.css \
96 --stringparam generate.css.header
1 \
97 http
://docbook.sourceforge.net
/release
/xsl
/current
/xhtml
/docbook.xsl dracut.xml
100 dracut.
pc: Makefile.inc Makefile
101 @echo
"Name: dracut" > dracut.
pc
102 @echo
"Description: dracut" >> dracut.
pc
103 @echo
"Version: $(VERSION)$(GITVERSION)" >> dracut.
pc
104 @echo
"dracutdir=$(pkglibdir)" >> dracut.
pc
105 @echo
"dracutmodulesdir=$(pkglibdir)/modules.d" >> dracut.
pc
106 @echo
"dracutconfdir=$(pkglibdir)/dracut.conf.d" >> dracut.
pc
109 mkdir
-p
$(DESTDIR
)$(pkglibdir
)
110 mkdir
-p
$(DESTDIR
)$(bindir)
111 mkdir
-p
$(DESTDIR
)$(sysconfdir
)
112 mkdir
-p
$(DESTDIR
)$(pkglibdir
)/modules.d
113 mkdir
-p
$(DESTDIR
)$(mandir)/man1
$(DESTDIR
)$(mandir)/man5
$(DESTDIR
)$(mandir)/man7
$(DESTDIR
)$(mandir)/man8
114 install -m
0755 dracut.sh
$(DESTDIR
)$(bindir)/dracut
115 install -m
0755 dracut-catimages.sh
$(DESTDIR
)$(bindir)/dracut-catimages
116 install -m
0755 mkinitrd-dracut.sh
$(DESTDIR
)$(bindir)/mkinitrd
117 install -m
0755 lsinitrd.sh
$(DESTDIR
)$(bindir)/lsinitrd
118 install -m
0644 dracut.conf
$(DESTDIR
)$(sysconfdir
)/dracut.conf
119 mkdir
-p
$(DESTDIR
)$(sysconfdir
)/dracut.conf.d
120 mkdir
-p
$(DESTDIR
)$(pkglibdir
)/dracut.conf.d
121 install -m
0755 dracut-functions.sh
$(DESTDIR
)$(pkglibdir
)/dracut-functions.sh
122 install -m
0755 dracut-version.sh
$(DESTDIR
)$(pkglibdir
)/dracut-version.sh
123 ln
-fs dracut-functions.sh
$(DESTDIR
)$(pkglibdir
)/dracut-functions
124 install -m
0755 dracut-logger.sh
$(DESTDIR
)$(pkglibdir
)/dracut-logger.sh
125 install -m
0755 dracut-initramfs-restore.sh
$(DESTDIR
)$(pkglibdir
)/dracut-initramfs-restore
126 cp
-arx modules.d
$(DESTDIR
)$(pkglibdir
)
127 ifneq ($(enable_documentation
),no
)
128 for i in
$(man1pages
); do
install -m
0644 $$i $(DESTDIR
)$(mandir)/man1
/$${i
##*/}; done
129 for i in
$(man5pages
); do
install -m
0644 $$i $(DESTDIR
)$(mandir)/man5
/$${i
##*/}; done
130 for i in
$(man7pages
); do
install -m
0644 $$i $(DESTDIR
)$(mandir)/man7
/$${i
##*/}; done
131 for i in
$(man8pages
); do
install -m
0644 $$i $(DESTDIR
)$(mandir)/man8
/$${i
##*/}; done
132 ln
-fs dracut.cmdline
.7 $(DESTDIR
)$(mandir)/man7
/dracut.kernel
.7
134 if
[ -n
"$(systemdsystemunitdir)" ]; then \
135 mkdir
-p
$(DESTDIR
)$(systemdsystemunitdir
); \
136 ln
-srf
$(DESTDIR
)$(pkglibdir
)/modules.d
/98dracut-systemd
/dracut-shutdown.service
$(DESTDIR
)$(systemdsystemunitdir
)/dracut-shutdown.service
; \
137 mkdir
-p
$(DESTDIR
)$(systemdsystemunitdir
)/sysinit.target.wants
; \
138 ln
-s ..
/dracut-shutdown.service \
139 $(DESTDIR
)$(systemdsystemunitdir
)/sysinit.target.wants
/dracut-shutdown.service
; \
140 mkdir
-p
$(DESTDIR
)$(systemdsystemunitdir
)/initrd.target.wants
; \
142 dracut-cmdline.service \
143 dracut-initqueue.service \
144 dracut-mount.service \
145 dracut-pre-mount.service \
146 dracut-pre-pivot.service \
147 dracut-pre-trigger.service \
148 dracut-pre-udev.service \
150 ln
-srf
$(DESTDIR
)$(pkglibdir
)/modules.d
/98dracut-systemd
/$$i $(DESTDIR
)$(systemdsystemunitdir
); \
152 $(DESTDIR
)$(systemdsystemunitdir
)/initrd.target.wants
/$$i; \
155 if
[ -f
install/dracut-install
]; then \
156 install -m
0755 install/dracut-install
$(DESTDIR
)$(pkglibdir
)/dracut-install
; \
158 if
[ -f skipcpio
/skipcpio
]; then \
159 install -m
0755 skipcpio
/skipcpio
$(DESTDIR
)$(pkglibdir
)/skipcpio
; \
161 mkdir
-p
$(DESTDIR
)${prefix}/lib
/kernel
/install.d
162 install -m
0755 50-dracut.
install $(DESTDIR
)${prefix}/lib
/kernel
/install.d
/50-dracut.
install
163 install -m
0755 51-dracut-rescue.
install $(DESTDIR
)${prefix}/lib
/kernel
/install.d
/51-dracut-rescue.
install
164 mkdir
-p
$(DESTDIR
)${bashcompletiondir}
165 install -m
0644 dracut-bash-completion.sh
$(DESTDIR
)${bashcompletiondir}/dracut
166 install -m
0644 lsinitrd-bash-completion.sh
$(DESTDIR
)${bashcompletiondir}/lsinitrd
167 mkdir
-p
$(DESTDIR
)${pkgconfigdatadir}
168 install -m
0644 dracut.
pc $(DESTDIR
)${pkgconfigdatadir}/dracut.
pc
171 @echo
"DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
177 $(RM
) $(manpages
:%=%.xml
) dracut.xml
179 $(RM
) dracut-
*.rpm dracut-
*.
tar.bz2 dracut-
*.
tar.xz
180 $(RM
) dracut-version.sh
181 $(RM
) dracut-install
install/dracut-install
$(DRACUT_INSTALL_OBJECTS
)
182 $(RM
) skipcpio
/skipcpio
$(SKIPCPIO_OBJECTS
)
183 $(RM
) $(manpages
) dracut.html
184 $(MAKE
) -C
test clean
186 dist: dracut-
$(VERSION
).
tar.xz
188 dracut-
$(VERSION
).
tar.xz
: doc syncheck
189 @echo
"DRACUT_VERSION=$(VERSION)" > dracut-version.sh
190 git archive
--format
=tar $(VERSION
) --prefix=dracut-
$(VERSION
)/ > dracut-
$(VERSION
).
tar
191 mkdir
-p dracut-
$(VERSION
)
192 for i in
$(manpages
) dracut.html dracut-version.sh
; do
[ "$${i%/*}" != "$$i" ] && mkdir
-p
"dracut-$(VERSION)/$${i%/*}"; cp
"$$i" "dracut-$(VERSION)/$$i"; done
193 tar --owner
=root
--group
=root
-rf dracut-
$(VERSION
).
tar $$(find dracut-
$(VERSION
) -type f
)
194 rm -fr
-- dracut-
$(VERSION
).
tar.xz dracut-
$(VERSION
)
195 xz
-9 dracut-
$(VERSION
).
tar
196 rm -f
-- dracut-
$(VERSION
).
tar
198 rpm
: dracut-
$(VERSION
).
tar.xz syncheck
199 rpmbuild
=$$(mktemp
-d
-t rpmbuild-dracut.XXXXXX
); src
=$$(pwd
); \
200 cp dracut-
$(VERSION
).
tar.xz
"$$rpmbuild"; \
201 LC_MESSAGES
=C
$$src/git2spec.pl
$(VERSION
) "$$rpmbuild" < dracut.spec
> $$rpmbuild/dracut.spec
; \
203 wget https
://www.gnu.org
/licenses
/lgpl-2.1.txt
; \
204 rpmbuild
--define "_topdir $$PWD" --define "_sourcedir $$PWD" \
205 --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
206 --define "_rpmdir $$PWD" -ba dracut.spec
; ) && \
207 ( mv
"$$rpmbuild"/$$(arch
)/*.rpm .
; mv
"$$rpmbuild"/*.src.rpm .
;rm -fr
-- "$$rpmbuild"; ls
*.rpm
)
210 @ret
=0;for i in dracut-initramfs-restore.sh modules.d
/*/*.sh
; do \
211 [ "$${i##*/}" = "module-setup.sh" ] && continue
; \
212 read line
< "$$i"; [ "$${line#*bash*}" != "$$line" ] && continue
; \
213 [ $$V ] && echo
"posix syntax check: $$i"; bash
--posix
-n
"$$i" ; ret
=$$(($$ret+$$?
)); \
214 [ $$V ] && echo
"checking for [[: $$i"; if grep
-Fq
'[[ ' "$$i" ; then ret
=$$(($$ret+1)); echo
"$$i contains [["; fi \
216 @ret
=0;for i in
*.sh mkinitrd-dracut.sh modules.d
/*/*.sh \
217 modules.d
/*/module-setup.sh
; do \
218 [ $$V ] && echo
"bash syntax check: $$i"; bash
-n
"$$i" ; ret
=$$(($$ret+$$?
)); \
221 check: all syncheck rpm
222 @
[ "$$EUID" == "0" ] ||
{ echo
"'check' must be run as root! Please use 'sudo'."; exit
1; }
223 @
$(MAKE
) -C
test check
226 .
/dracut.sh
-N
-l
-a debug
-f test-
$(shell uname
-r
).img
$(shell uname
-r
)
227 @echo wrote test-
$(shell uname
-r
).img
230 .
/dracut.sh
--debug
-l
-a debug
-f test-
$(shell uname
-r
).img
$(shell uname
-r
)
231 @echo wrote test-
$(shell uname
-r
).img
234 .
/dracut.sh
-l
-a debug
--kernel-only
-f test-kernel-
$(shell uname
-r
).img
$(shell uname
-r
)
235 @echo wrote test-
$(shell uname
-r
).img
236 .
/dracut.sh
-l
-a debug
--no-kernel
-f test-dracut.img
$(shell uname
-r
)
237 @echo wrote test-dracut.img
240 .
/dracut.sh
--debug
-H
-l
-f test-
$(shell uname
-r
).img
$(shell uname
-r
)
241 @echo wrote test-
$(shell uname
-r
).img
244 .
/dracut.sh
-H
-l
-f test-
$(shell uname
-r
).img
$(shell uname
-r
)
245 @echo wrote test-
$(shell uname
-r
).img
248 git shortlog
--numbered
--summary
-e |while read a rest ||
[ -n
"$$rest" ]; do echo
$$rest;done
> AUTHORS
250 dracut.html.sign
: dracut-
$(VERSION
).
tar.xz dracut.html
251 gpg-sign-all dracut-
$(VERSION
).
tar.xz dracut.html
253 upload
: dracut.html.sign
254 kup put dracut-
$(VERSION
).
tar.xz dracut-
$(VERSION
).
tar.sign
/pub
/linux
/utils
/boot
/dracut
/
255 kup put dracut.html dracut.html.sign
/pub
/linux
/utils
/boot
/dracut
/