Blame 0026-Makefile-use-implicit-rules-for-install-dracut-insta.patch

Harald Hoyer 12f6cc
From ab8bfca7949cf18837ead4b3aebd5f2186a6f739 Mon Sep 17 00:00:00 2001
Harald Hoyer 12f6cc
From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name>
Harald Hoyer 12f6cc
Date: Wed, 25 Jul 2012 22:08:23 +0200
Harald Hoyer 12f6cc
Subject: [PATCH] Makefile: use implicit rules for install/dracut-install
Harald Hoyer 12f6cc
Harald Hoyer 12f6cc
Don't fail on install rule if install/dracut-install is not build - just
Harald Hoyer 12f6cc
skip it.  $(strip) is not used by install rule, because it is nowhere
Harald Hoyer 12f6cc
set.
Harald Hoyer 12f6cc
---
Harald Hoyer 12f6cc
 Makefile | 30 ++++++++++++++----------------
Harald Hoyer 12f6cc
 1 file changed, 14 insertions(+), 16 deletions(-)
Harald Hoyer 12f6cc
Harald Hoyer 12f6cc
diff --git a/Makefile b/Makefile
Harald Hoyer 12f6cc
index a109ef0..d013cbc 100644
Harald Hoyer 12f6cc
--- a/Makefile
Harald Hoyer 12f6cc
+++ b/Makefile
Harald Hoyer 12f6cc
@@ -8,7 +8,8 @@ pkglibdir ?= ${libdir}/dracut
Harald Hoyer 12f6cc
 sysconfdir ?= ${prefix}/etc
Harald Hoyer 12f6cc
 bindir ?= ${prefix}/bin
Harald Hoyer 12f6cc
 mandir ?= ${prefix}/share/man
Harald Hoyer 12f6cc
-CFLAGS ?= -std=gnu99 -O2 -g -Wall
Harald Hoyer 12f6cc
+CFLAGS ?= -O2 -g -Wall
Harald Hoyer 12f6cc
+CFLAGS += -std=gnu99
Harald Hoyer 12f6cc
 
Harald Hoyer 12f6cc
 man1pages = lsinitrd.1
Harald Hoyer 12f6cc
 
Harald Hoyer 12f6cc
@@ -32,22 +33,17 @@ manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
Harald Hoyer 12f6cc
 
Harald Hoyer 12f6cc
 .PHONY: install clean archive rpm testimage test all check AUTHORS doc
Harald Hoyer 12f6cc
 
Harald Hoyer 12f6cc
-all: syncheck dracut-version.sh dracut-install
Harald Hoyer 12f6cc
+DRACUT_INSTALL_BIN = install/dracut-install
Harald Hoyer 12f6cc
 
Harald Hoyer 12f6cc
-DRACUT_INSTALL_SOURCE = \
Harald Hoyer 12f6cc
-        install/dracut-install.c \
Harald Hoyer 12f6cc
-        install/hashmap.c\
Harald Hoyer 12f6cc
-        install/log.c \
Harald Hoyer 12f6cc
-        install/util.c
Harald Hoyer 12f6cc
+DRACUT_INSTALL_OBJECTS = \
Harald Hoyer 12f6cc
+        install/dracut-install.o \
Harald Hoyer 12f6cc
+        install/hashmap.o\
Harald Hoyer 12f6cc
+        install/log.o \
Harald Hoyer 12f6cc
+        install/util.o
Harald Hoyer 12f6cc
 
Harald Hoyer 12f6cc
-DRACUT_INSTALL_HEADER = \
Harald Hoyer 12f6cc
-        install/hashmap.h \
Harald Hoyer 12f6cc
-        install/log.h \
Harald Hoyer 12f6cc
-        install/macro.h \
Harald Hoyer 12f6cc
-        install/util.h
Harald Hoyer 12f6cc
+all: syncheck dracut-version.sh $(DRACUT_INSTALL_BIN)
Harald Hoyer 12f6cc
 
Harald Hoyer 12f6cc
-dracut-install: $(DRACUT_INSTALL_SOURCE) $(DRACUT_INSTALL_HEADER)
Harald Hoyer 12f6cc
-	gcc $(CFLAGS) -o dracut-install $(DRACUT_INSTALL_SOURCE)
Harald Hoyer 12f6cc
+$(DRACUT_INSTALL_BIN): $(DRACUT_INSTALL_OBJECTS)
Harald Hoyer 12f6cc
 
Harald Hoyer 12f6cc
 indent:
Harald Hoyer 12f6cc
 	indent -i8 -nut -br -linux -l120 install/dracut-install.c
Harald Hoyer 12f6cc
@@ -99,7 +95,9 @@ install: doc dracut-version.sh
Harald Hoyer 12f6cc
 		ln -s ../dracut-shutdown.service \
Harald Hoyer 12f6cc
 		$(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \
Harald Hoyer 12f6cc
 	fi
Harald Hoyer 12f6cc
-	install $(strip) -m 0755 dracut-install $(DESTDIR)$(pkglibdir)/dracut-install
Harald Hoyer 12f6cc
+	if [ -x $(DRACUT_INSTALL_BIN) ]; then \
Harald Hoyer 12f6cc
+		install -m 0755 $(DRACUT_INSTALL_BIN) $(DESTDIR)$(pkglibdir)/dracut-install; \
Harald Hoyer 12f6cc
+	fi
Harald Hoyer 12f6cc
 
Harald Hoyer 12f6cc
 dracut-version.sh:
Harald Hoyer 12f6cc
 	@echo "DRACUT_VERSION=$(VERSION)-$(GITVERSION)" > dracut-version.sh
Harald Hoyer 12f6cc
@@ -110,7 +108,7 @@ clean:
Harald Hoyer 12f6cc
 	$(RM) */*/*~
Harald Hoyer 12f6cc
 	$(RM) test-*.img
Harald Hoyer 12f6cc
 	$(RM) dracut-*.rpm dracut-*.tar.bz2
Harald Hoyer 12f6cc
-	$(RM) dracut-install
Harald Hoyer 12f6cc
+	$(RM) $(DRACUT_INSTALL_BIN) $(DRACUT_INSTALL_OBJECTS)
Harald Hoyer 12f6cc
 	$(RM) $(manpages) dracut.html
Harald Hoyer 12f6cc
 	$(MAKE) -C test clean
Harald Hoyer 12f6cc