X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=Makefile;h=503d069fb51ab9016b35063ad5ad6e157b73b6f3;hb=42e004feb9ce333d3b1b624bea7d2389da2c87a6;hp=916b50e6fa10ccba50f6c4761c5994de83a9cfda;hpb=28eae10b7007c6a2b64876244e976eb4788e95b1;p=thirdparty%2Fdracut.git diff --git a/Makefile b/Makefile index 916b50e6f..503d069fb 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ -include dracut-version.sh -VERSION = $(shell [ -d .git ] && git describe --abbrev=0 --tags 2>/dev/null || echo $(DRACUT_VERSION)) -GITVERSION = $(shell [ -d .git ] && { v=$$(git describe --tags 2>/dev/null); [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } ) +VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags --always 2>/dev/null || echo $(DRACUT_VERSION)) +GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags --always 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } ) -include Makefile.inc @@ -13,8 +13,9 @@ sysconfdir ?= ${prefix}/etc bindir ?= ${prefix}/bin mandir ?= ${prefix}/share/man CFLAGS ?= -O2 -g -Wall -CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 +CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 $(KMOD_CFLAGS) bashcompletiondir ?= ${datadir}/bash-completion/completions +pkgconfigdatadir ?= $(datadir)/pkgconfig man1pages = lsinitrd.1 @@ -39,9 +40,9 @@ man8pages = dracut.8 \ manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages) -.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh +.PHONY: install clean archive rpm srpm testimage test all check AUTHORS doc dracut-version.sh -all: dracut-version.sh dracut-install skipcpio/skipcpio +all: dracut-version.sh dracut.pc dracut-install skipcpio/skipcpio DRACUT_INSTALL_OBJECTS = \ install/dracut-install.o \ @@ -60,6 +61,10 @@ install/util.o: install/util.c install/util.h install/macro.h install/log.h install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h install/dracut-install: $(DRACUT_INSTALL_OBJECTS) + $(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(KMOD_LIBS) + +logtee: logtee.c + $(CC) $(LDFLAGS) -o $@ $< dracut-install: install/dracut-install ln -fs $< $@ @@ -81,22 +86,34 @@ all: doc endif %: %.xml - xsltproc -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< + @rm -f -- "$@" + xsltproc -o "$@" -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< %.xml: %.asc - asciidoc -d manpage -b docbook -o $@ $< + @rm -f -- "$@" + asciidoc -d manpage -b docbook -o "$@" $< dracut.8: dracut.usage.asc dracut.8.asc dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc + @rm -f -- dracut.xml asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc + @rm -f -- dracut.html xsltproc -o dracut.html --xinclude -nonet \ --stringparam custom.css.source dracut.css \ --stringparam generate.css.header 1 \ http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml - rm -f -- dracut.xml + @rm -f -- dracut.xml + +dracut.pc: Makefile.inc Makefile + @echo "Name: dracut" > dracut.pc + @echo "Description: dracut" >> dracut.pc + @echo "Version: $(VERSION)$(GITVERSION)" >> dracut.pc + @echo "dracutdir=$(pkglibdir)" >> dracut.pc + @echo "dracutmodulesdir=$(pkglibdir)/modules.d" >> dracut.pc + @echo "dracutconfdir=$(pkglibdir)/dracut.conf.d" >> dracut.pc -install: dracut-version.sh +install: all mkdir -p $(DESTDIR)$(pkglibdir) mkdir -p $(DESTDIR)$(bindir) mkdir -p $(DESTDIR)$(sysconfdir) @@ -109,6 +126,7 @@ install: dracut-version.sh install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d mkdir -p $(DESTDIR)$(pkglibdir)/dracut.conf.d + install -m 0755 dracut-init.sh $(DESTDIR)$(pkglibdir)/dracut-init.sh install -m 0755 dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions.sh install -m 0755 dracut-version.sh $(DESTDIR)$(pkglibdir)/dracut-version.sh ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions @@ -155,8 +173,11 @@ endif mkdir -p $(DESTDIR)${bashcompletiondir} install -m 0644 dracut-bash-completion.sh $(DESTDIR)${bashcompletiondir}/dracut install -m 0644 lsinitrd-bash-completion.sh $(DESTDIR)${bashcompletiondir}/lsinitrd + mkdir -p $(DESTDIR)${pkgconfigdatadir} + install -m 0644 dracut.pc $(DESTDIR)${pkgconfigdatadir}/dracut.pc dracut-version.sh: + @rm -f dracut-version.sh @echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh clean: @@ -193,14 +214,26 @@ rpm: dracut-$(VERSION).tar.xz syncheck rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \ --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \ --define "_rpmdir $$PWD" -ba dracut.spec; ) && \ - ( mv "$$rpmbuild"/$$(arch)/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr -- "$$rpmbuild"; ls *.rpm ) + ( mv "$$rpmbuild"/{,$$(arch)/}*.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm ) + +srpm: dracut-$(VERSION).tar.xz syncheck + rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \ + cp dracut-$(VERSION).tar.xz "$$rpmbuild"; \ + LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \ + (cd "$$rpmbuild"; \ + [ -f $$src/lgpl-2.1.txt ] && cp $$src/lgpl-2.1.txt . || wget https://www.gnu.org/licenses/lgpl-2.1.txt; \ + rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \ + --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \ + --define "_rpmdir $$PWD" -bs dracut.spec; ) && \ + ( mv "$$rpmbuild"/*.src.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm ) syncheck: @ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \ [ "$${i##*/}" = "module-setup.sh" ] && continue; \ read line < "$$i"; [ "$${line#*bash*}" != "$$line" ] && continue; \ [ $$V ] && echo "posix syntax check: $$i"; bash --posix -n "$$i" ; ret=$$(($$ret+$$?)); \ - [ $$V ] && echo "checking for [[: $$i"; if grep -Fq '[[ ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains [["; fi \ + [ $$V ] && echo "checking for [[: $$i"; if grep -Fq '[[ ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains [["; fi; \ + [ $$V ] && echo "checking for echo -n: $$i"; if grep -Fq 'echo -n ' "$$i" ; then ret=$$(($$ret+1)); echo "$$i contains echo -n"; fi \ done;exit $$ret @ret=0;for i in *.sh mkinitrd-dracut.sh modules.d/*/*.sh \ modules.d/*/module-setup.sh; do \ @@ -212,7 +245,7 @@ check: all syncheck rpm @$(MAKE) -C test check testimage: all - ./dracut.sh -l -a debug -f test-$(shell uname -r).img $(shell uname -r) + ./dracut.sh -N -l -a debug -f test-$(shell uname -r).img $(shell uname -r) @echo wrote test-$(shell uname -r).img debugtestimage: all @@ -233,8 +266,12 @@ hostimage: all ./dracut.sh -H -l -f test-$(shell uname -r).img $(shell uname -r) @echo wrote test-$(shell uname -r).img +efi: all + ./dracut.sh --uefi -H -l -f linux-$(shell uname -r).efi $(shell uname -r) + @echo wrote linux-$(shell uname -r).efi + AUTHORS: - git shortlog --numbered --summary -e |while read a rest; do echo $$rest;done > AUTHORS + git shortlog --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo $$rest;done > AUTHORS dracut.html.sign: dracut-$(VERSION).tar.xz dracut.html gpg-sign-all dracut-$(VERSION).tar.xz dracut.html