[PATCH 2/2] Makefile: use implicit rules for install/dracut-install

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Don't fail on install rule if install/dracut-install is not build - just
skip it.  $(strip) is not used by install rule, because it is nowhere
set.
---
 Makefile |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile
index a109ef0..d013cbc 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,8 @@ pkglibdir ?= ${libdir}/dracut
 sysconfdir ?= ${prefix}/etc
 bindir ?= ${prefix}/bin
 mandir ?= ${prefix}/share/man
-CFLAGS ?= -std=gnu99 -O2 -g -Wall
+CFLAGS ?= -O2 -g -Wall
+CFLAGS += -std=gnu99
 
 man1pages = lsinitrd.1
 
@@ -32,22 +33,17 @@ manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
 
 .PHONY: install clean archive rpm testimage test all check AUTHORS doc
 
-all: syncheck dracut-version.sh dracut-install
+DRACUT_INSTALL_BIN = install/dracut-install
 
-DRACUT_INSTALL_SOURCE = \
-        install/dracut-install.c \
-        install/hashmap.c\
-        install/log.c \
-        install/util.c
+DRACUT_INSTALL_OBJECTS = \
+        install/dracut-install.o \
+        install/hashmap.o\
+        install/log.o \
+        install/util.o
 
-DRACUT_INSTALL_HEADER = \
-        install/hashmap.h \
-        install/log.h \
-        install/macro.h \
-        install/util.h
+all: syncheck dracut-version.sh $(DRACUT_INSTALL_BIN)
 
-dracut-install: $(DRACUT_INSTALL_SOURCE) $(DRACUT_INSTALL_HEADER)
-	gcc $(CFLAGS) -o dracut-install $(DRACUT_INSTALL_SOURCE)
+$(DRACUT_INSTALL_BIN): $(DRACUT_INSTALL_OBJECTS)
 
 indent:
 	indent -i8 -nut -br -linux -l120 install/dracut-install.c
@@ -99,7 +95,9 @@ install: doc dracut-version.sh
 		ln -s ../dracut-shutdown.service \
 		$(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \
 	fi
-	install $(strip) -m 0755 dracut-install $(DESTDIR)$(pkglibdir)/dracut-install
+	if [ -x $(DRACUT_INSTALL_BIN) ]; then \
+		install -m 0755 $(DRACUT_INSTALL_BIN) $(DESTDIR)$(pkglibdir)/dracut-install; \
+	fi
 
 dracut-version.sh:
 	@echo "DRACUT_VERSION=$(VERSION)-$(GITVERSION)" > dracut-version.sh
@@ -110,7 +108,7 @@ clean:
 	$(RM) */*/*~
 	$(RM) test-*.img
 	$(RM) dracut-*.rpm dracut-*.tar.bz2
-	$(RM) dracut-install
+	$(RM) $(DRACUT_INSTALL_BIN) $(DRACUT_INSTALL_OBJECTS)
 	$(RM) $(manpages) dracut.html
 	$(MAKE) -C test clean
 
-- 
1.7.8.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux