Stamps do not work
Make still does things that have been already done. For example
make install-final-gcc
starts building the final-gcc despite the build-final-gcc stamp. I doubt that the phony target and the stamp file can be chained like this
.PHONY: install-final-gcc
install-final-gcc stamps/install-final-gcc: stamps/build-final-gcc
# ...
maybe it should be like this
.PHONY: install-final-gcc
install-final-gcc: stamps/install-final-gcc
stamps/install-final-gcc: stamps/build-final-gcc
# ...
See for example http://www.technovelty.org/linux/tips/make-stamp.html
I have planned to start working on this. Adding some notes:
- From GCC Coding Conventions:
touchshould never be used in GCC Makefiles. Instead oftouch fooalways use$(STAMP) foo.
This is how stamps would work:
############# SUPP: AUTOCONF ############
.PHONY: download-autoconf
downloads/$(AUTOCONF_ARCHIVE) download-autoconf:
[ -d downloads ] || mkdir downloads ;
cd downloads && curl -LO $(AUTOCONF_URL)
.PHONY: extract-autoconf
extract-autoconf: stamps/extract-autoconf
stamps/extract-autoconf: downloads/$(AUTOCONF_ARCHIVE)
@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
[ "$$t1" = "$(AUTOCONF_MD5)" ] || \
( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
tar -jxf $< ;
[ -d stamps ] || mkdir stamps
touch stamps/extract-autoconf;
.PHONY: build-autoconf
build-autoconf: stamps/build-autoconf
stamps/build-autoconf: stamps/extract-autoconf
mkdir -p build/autoconf && cd build/autoconf && \
../../autoconf-$(AUTOCONF_VERSION)/configure --prefix="$(SUPP_PREFIX)" && \
$(MAKE) -j$(PROCS)
[ -d stamps ] || mkdir stamps
touch stamps/build-autoconf;
.PHONY: install-autoconf
install-autoconf: stamps/install-autoconf
stamps/install-autoconf: stamps/build-autoconf
cd build/autoconf && \
$(MAKE) install
[ -d stamps ] || mkdir stamps
touch stamps/install-autoconf;
Refactored version:
- To reduce noise, I removed phony targets. Not really needed?
- Used
make -p, instead of[-d dir] || mkdir dir
############# SUPP: AUTOCONF ############
stamps/install-autoconf: stamps/build-autoconf
$(MAKE) -C build/autoconf install
mkdir -p stamps && touch $@
stamps/build-autoconf: stamps/extract-autoconf
mkdir -p build/autoconf
cd build/autoconf && ../../autoconf-$(AUTOCONF_VERSION)/configure --prefix="$(SUPP_PREFIX)" \
&& $(MAKE) -j$(PROCS)
mkdir -p stamps && touch $@
stamps/extract-autoconf: downloads/$(AUTOCONF_ARCHIVE)
@(t1=`openssl md5 $< | cut -f 2 -d " " -` && \
[ "$$t1" = "$(AUTOCONF_MD5)" ] || \
( echo "Bad Checksum! Please remove the following file and retry: $<" && false ))
tar -jxf $<
mkdir -p stamps && touch $@
downloads/$(AUTOCONF_ARCHIVE):
mkdir -p downloads
cd downloads && curl -LO $(AUTOCONF_URL)
@jsnyder Do you like to keep all .phonies or could we just have stamp-targets?
@jsnyder What's your preference about the change I proposed above? I'm asking before I'll fix all of these. So could be get rid off "unnecessary" phony-targets? Let's just keep install-cross etc.
That looks good, you can remove the extra phony targets if you like.
So with this refactoring the stamps are actually working correctly?
(again sorry for delays in response)
So with this refactoring the stamps are actually working correctly?
Yes. I'll open a pull request when I'm done with the refactoring.