Skip to content
Browse files

use wildcard rule for object files

  • Loading branch information...
1 parent 362d64d commit d46ba4bac7f2db9f9984c15fe75706dec3afd4f8 @zhemao committed
Showing with 3 additions and 18 deletions.
  1. +3 −18 Makefile
View
21 Makefile
@@ -13,39 +13,24 @@ ds.h: $(HEADERS)
listtest: libds.a listtest.c
gcc $(OPTS) listtest.c $(LDFLAGS) -o listtest
-list.o: list.h list.c
- gcc $(OPTS) -c list.c
-
-vector.o: vector.h vector.c
- gcc $(OPTS) -c vector.c
-
vectest: libds.a vectest.c
gcc $(OPTS) vectest.c $(LDFLAGS) -o vectest
-hashmap.o: hashmap.h hashmap.c
- gcc $(OPTS) -c hashmap.c
-
maptest: libds.a maptest.c
gcc $(OPTS) maptest.c $(LDFLAGS) -o maptest
strutiltest: strutiltest.c libds.a
gcc $(OPTS) strutiltest.c $(LDFLAGS) -o strutiltest
-strutils.o: strutils.h strutils.c
- gcc $(OPTS) -c strutils.c
-
-heap.o: heap.h heap.c
- gcc $(OPTS) -c heap.c
-
heaptest: libds.a heaptest.c
gcc $(OPTS) heaptest.c $(LDFLAGS) -o heaptest
-tree.o: tree.h tree.c
- gcc $(OPTS) -c tree.c
-
treetest: treetest.c libds.a
gcc $(OPTS) treetest.c $(LDFLAGS) -o treetest
+%.o: %.c %.h
+ gcc $(OPTS) -c $<
+
clean:
rm -f *test *.o *.a

0 comments on commit d46ba4b

Please sign in to comment.
Something went wrong with that request. Please try again.