]> git.ipfire.org Git - thirdparty/dracut.git/blobdiff - Makefile
debug: Add dd into debug module
[thirdparty/dracut.git] / Makefile
index c5afc1aaca9ca418d0ddf77ed1d23f860df5553a..503d069fb51ab9016b35063ad5ad6e157b73b6f3 100644 (file)
--- 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); [ -n "$$v" ] && [ $${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
 
@@ -12,8 +12,8 @@ pkglibdir ?= ${libdir}/dracut
 sysconfdir ?= ${prefix}/etc
 bindir ?= ${prefix}/bin
 mandir ?= ${prefix}/share/man
-CFLAGS ?= -O2 -g -Wall $(KMOD_CFLAGS)
-CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
+CFLAGS ?= -O2 -g -Wall
+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
 
@@ -40,7 +40,7 @@ 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.pc dracut-install skipcpio/skipcpio
 
@@ -63,6 +63,9 @@ install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h ins
 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 $< $@
 
@@ -211,7 +214,18 @@ 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 $(DESTDIR).; mv "$$rpmbuild"/*.src.rpm $(DESTDIR).;rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.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 \