From ab8bfca7949cf18837ead4b3aebd5f2186a6f739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= Date: Wed, 25 Jul 2012 22:08:23 +0200 Subject: [PATCH] Makefile: use implicit rules for install/dracut-install 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 file 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