On Thu, Sep 14, 2017 at 2:45 PM, Uwe Kleine-König <uwe@xxxxxxxxxxxxxxxxx> wrote: > > -# Generating file version.h if current version has changed > SPARSE_VERSION:=$(shell git describe 2>/dev/null || echo '$(VERSION)') > -VERSION_H := $(shell cat version.h 2>/dev/null) > -ifneq ($(lastword $(VERSION_H)),"$(SPARSE_VERSION)") > -$(info $(shell echo ' GEN 'version.h)) > -$(shell echo '#define SPARSE_VERSION "$(SPARSE_VERSION)"' > version.h) > -endif You don't need to move them to into a rule section. You can use "ifneq ($(MAKECMDGOALS),clean)" to wrap it. GNU make document even show that as examples of using $(MAKECMDGOALS). > +version.h: FORCE > + $(QUIET_GEN)echo '#define SPARSE_VERSION "$(SPARSE_VERSION)"' > version.h.tmp; \ > + if cmp -s version.h version.h.tmp; then \ > + rm version.h.tmp; \ > + else \ > + mv version.h.tmp version.h; \ > + fi > + > +.PHONY: FORCE > + > +lib.o: version.h > + The above section is not needed if you use the ifneq test on $(MAKECMDGOALS). I also test it and found the problem that, the version.h was force to obsolete. Two consequent make will always show "GEN version.h" line. > clean: clean-check > - rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc > + rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc version.h This line is good. If you don't mind I am going to apply this (the 3 liner version) after my debug build patches. It has conflict with my debug build patch and it is much easier to fix conflict on this 3 liner patch than the other way around. Chris -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html