mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-30 13:57:41 +00:00
Introduced automatic dependencies within Makefiles.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
9
Makefile
9
Makefile
@@ -62,6 +62,9 @@ endif
|
||||
|
||||
.PHONY: all clean install version package
|
||||
|
||||
# Make all the default rule
|
||||
all::
|
||||
|
||||
# Include all makefiles for sub-modules
|
||||
include $(patsubst %,%/Module.mk,$(MODULES))
|
||||
|
||||
@@ -73,6 +76,12 @@ install::
|
||||
clean::
|
||||
$(RM) lm_sensors-*
|
||||
|
||||
# Create a dependency file. Tricky.
|
||||
%.d: %.c
|
||||
gcc -M -MG $(CFLAGS) $< | \
|
||||
sed -e 's@ /[^ ]*@@g' -e 's@^\(.*\)\.o:@\1.d \1.o:@' > $@
|
||||
|
||||
|
||||
# This is tricky, but it works like a charm. It needs lots of utilities
|
||||
# though: cut, find, gzip, ln, tail and tar.
|
||||
package: version clean
|
||||
|
@@ -7,6 +7,9 @@ TARGETS := $(MODULE_DIR)/i2c-core.o $(MODULE_DIR)/algo-bit.o \
|
||||
$(MODULE_DIR)/i2c-dev.o $(MODULE_DIR)/bit-lp.o \
|
||||
$(MODULE_DIR)/bit-velle.o $(MODULE_DIR)/bit-mb.o
|
||||
|
||||
# Include all dependency files
|
||||
include $(TARGETS:.o=.d)
|
||||
|
||||
all :: $(TARGETS)
|
||||
|
||||
install :: $(TARGETS)
|
||||
@@ -14,4 +17,4 @@ install :: $(TARGETS)
|
||||
install -o root -g root -m 644 $(MODDIR) $(TARGETS)
|
||||
|
||||
clean ::
|
||||
$(RM) $(TARGETS)
|
||||
$(RM) $(TARGETS) $(TARGETS:.o=.d)
|
||||
|
Reference in New Issue
Block a user