blob: 4d10534f1c509b00b1437c9ad0a7b1be048470e7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# Generic dependency resolution. Part of liblitmus so that we don't have to
# carry it around in every project using liblitmus.
obj-all = ${sort ${foreach target,${all},${obj-${target}}}}
# rule to generate dependency files
%.d: %.c
@set -e; rm -f $@; \
$(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
ifeq ($(MAKECMDGOALS),)
MAKECMDGOALS += all
endif
ifneq ($(filter-out clean,$(MAKECMDGOALS)),)
# Pull in dependencies.
-include ${obj-all:.o=.d}
endif
|