{"thread":{"id":"8367","subject":"[PATCH] Makefile: Use generic rule to build test programs","startedAt":"2007-05-30T23:18:24Z","lastAt":"2007-05-30T23:27:33Z","messageCount":2,"participants":["Julian Phillips","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"43662","messageId":"20070530232206.25366.89397.julian@quantumfyre.co.uk","threadId":"8367","inReplyTo":null,"subject":"[PATCH] Makefile: Use generic rule to build test programs","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2007-05-30T23:18:24Z","receivedAt":"2007-05-30T23:18:24Z","isPatch":true,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"Use a generic make rule to build all the test programs, rather than\nspecifically mentioning each one.\n\nSigned-off-by: Julian Phillips <julian@quantumfyre.co.uk>\n---\n\nOn Tue, 29 May 2007, Junio C Hamano wrote:\n> Hmmm.  One wonders if we can do something about these apparent\n> similarities with all these rules...\n\nSomething like this?\n\n Makefile |   24 +++++-------------------\n 1 files changed, 5 insertions(+), 19 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 7527734..cac0a4a 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -942,7 +942,7 @@ endif\n \n ### Testing rules\n \n-TEST_PROGRAMS = test-chmtime$X test-genrandom$X\n+TEST_PROGRAMS = test-chmtime$X test-genrandom$X test-date$X test-delta$X test-sha1$X test-match-trees$X\n \n all:: $(TEST_PROGRAMS)\n \n@@ -955,26 +955,12 @@ export NO_SVN_TESTS\n test: all\n \t$(MAKE) -C t/ all\n \n-test-date$X: test-date.c date.o ctype.o\n-\t$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) test-date.c date.o ctype.o\n+test-date$X: date.o ctype.o\n \n-test-delta$X: test-delta.o diff-delta.o patch-delta.o $(GITLIBS)\n-\t$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n+test-delta$X: diff-delta.o patch-delta.o\n \n-test-dump-cache-tree$X: dump-cache-tree.o $(GITLIBS)\n-\t$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n-\n-test-sha1$X: test-sha1.o $(GITLIBS)\n-\t$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n-\n-test-match-trees$X: test-match-trees.o $(GITLIBS)\n-\t$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n-\n-test-chmtime$X: test-chmtime.c\n-\t$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $<\n-\n-test-genrandom$X: test-genrandom.c\n-\t$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $<\n+test-%$X: test-%.o $(GITLIBS)\n+\t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n \n check-sha1:: test-sha1$X\n \t./test-sha1.sh\n-- \n1.5.2\n"},{"id":"43663","messageId":"20070530232733.GS7044@spearce.org","threadId":"8367","inReplyTo":"20070530232206.25366.89397.julian@quantumfyre.co.uk","subject":"Re: [PATCH] Makefile: Use generic rule to build test programs","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-05-30T23:27:33Z","receivedAt":"2007-05-30T23:27:33Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Julian Phillips <julian@quantumfyre.co.uk> wrote:\n> Use a generic make rule to build all the test programs, rather than\n> specifically mentioning each one.\n> \n> Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>\n\nYes.  ;-)\n\nI was going to do this tonight.  Thank you for beating me to it!\n\n-- \nShawn.\n"}]}