Skip to content

Commit 5c5ba73

Browse files
qurJunio C Hamano
authored andcommitted
Makefile: Use generic rule to build test programs
Use a generic make rule to build all the test programs, rather than specifically mentioning each one. Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 65c6aca commit 5c5ba73

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

Makefile

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ endif
942942

943943
### Testing rules
944944

945-
TEST_PROGRAMS = test-chmtime$X test-genrandom$X
945+
TEST_PROGRAMS = test-chmtime$X test-genrandom$X test-date$X test-delta$X test-sha1$X test-match-trees$X
946946

947947
all:: $(TEST_PROGRAMS)
948948

@@ -955,26 +955,12 @@ export NO_SVN_TESTS
955955
test: all
956956
$(MAKE) -C t/ all
957957

958-
test-date$X: test-date.c date.o ctype.o
959-
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) test-date.c date.o ctype.o
958+
test-date$X: date.o ctype.o
960959

961-
test-delta$X: test-delta.o diff-delta.o patch-delta.o $(GITLIBS)
962-
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
960+
test-delta$X: diff-delta.o patch-delta.o
963961

964-
test-dump-cache-tree$X: dump-cache-tree.o $(GITLIBS)
965-
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
966-
967-
test-sha1$X: test-sha1.o $(GITLIBS)
968-
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
969-
970-
test-match-trees$X: test-match-trees.o $(GITLIBS)
971-
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
972-
973-
test-chmtime$X: test-chmtime.c
974-
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $<
975-
976-
test-genrandom$X: test-genrandom.c
977-
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $<
962+
test-%$X: test-%.o $(GITLIBS)
963+
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
978964

979965
check-sha1:: test-sha1$X
980966
./test-sha1.sh

0 commit comments

Comments
 (0)