linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Clark Williams <williams@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	lkml <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
	Carsten Emde <C.Emde@osadl.org>,
	rt-users <linux-rt-users@vger.kernel.org>,
	John Kacur <jkacur@redhat.com>
Subject: [PATCH 5/5] rt-tests: Automatically generate dependencies.
Date: Wed, 27 Jan 2010 21:24:28 +0100	[thread overview]
Message-ID: <1264623868-23595-6-git-send-email-jkacur@redhat.com> (raw)
In-Reply-To: <1264623868-23595-1-git-send-email-jkacur@redhat.com>

Automatically generate dependencies. This will tell the make file that
cyclictest is dependent on rt_numa.h for example, and that if a change
is made there, then cyclictest needs to be remade.

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 Makefile |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 6156c03..4be0838 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,10 @@
 VERSION_STRING = 0.63
 
-TARGETS	= cyclictest signaltest pi_stress \
-	  rt-migrate-test ptsematest sigwaittest svsematest \
-	  sendme pip
+sources = cyclictest.c signaltest.c pi_stress.c rt-migrate-test.c	\
+	  ptsematest.c sigwaittest.c svsematest.c sendme.c pip.c
+
+TARGETS = $(sources:.c=)
+
 LIBS 	= -lrt -lpthread
 EXTRA_LIBS ?= -ldl	# for get_cpu
 DESTDIR	?=
@@ -39,9 +41,19 @@ VPATH	+= src/lib
 %.o: %.c
 	$(CC) -D VERSION_STRING=$(VERSION_STRING) -c $< $(CFLAGS)
 
+# Pattern rule to generate dependency files from .c files
+%.d: %.c
+	@set -e; rm -f $@; \
+	$(CC) -MM $(CFLAGS) $< > $@.$$$$; \
+	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+	rm -f $@.$$$$
+
 .PHONY: all
 all: $(TARGETS) hwlatdetect
 
+# Include dependency files, automatically generate them if needed.
+-include $(sources:.c=.d)
+
 cyclictest: cyclictest.o rt-utils.o
 	$(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(NUMA_LIBS)
 
@@ -73,7 +85,7 @@ sendme: sendme.o rt-utils.o rt-get_cpu.o
 pip: pip.o error.o rt-utils.o
 	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
 
-CLEANUP  = $(TARGETS) *.o .depend *.*~ *.orig *.rej rt-tests.spec
+CLEANUP  = $(TARGETS) *.o .depend *.*~ *.orig *.rej rt-tests.spec *.d
 CLEANUP += $(if $(wildcard .git), ChangeLog)
 
 .PHONY: clean
-- 
1.6.6


      parent reply	other threads:[~2010-01-27 20:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27 20:24 [PATCH 0/5] rt-tests: rt_numa.h clean-ups, and dependency files John Kacur
2010-01-27 20:24 ` [PATCH 1/5] rt-tests: Add header including copyright notice to rt_numa.h John Kacur
2010-01-27 20:24 ` [PATCH 2/5] rt-tests: Separate the #ifdef LIBNUMA_API_VERSION functions John Kacur
2010-01-27 20:24 ` [PATCH 3/5] rt-tests: Remove the ret variable, the end label and the goto John Kacur
2010-01-27 20:24 ` [PATCH 4/5] rt-tests: Fix some style problems, such as spaces instead of tabs John Kacur
2010-01-27 20:24 ` John Kacur [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1264623868-23595-6-git-send-email-jkacur@redhat.com \
    --to=jkacur@redhat.com \
    --cc=C.Emde@osadl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).