Giter VIP home page Giter VIP logo

Comments (5)

kblomqvist avatar kblomqvist commented on September 28, 2024

I have planned to start working on this. Adding some notes:

  • From GCC Coding Conventions: touch should never be used in GCC Makefiles. Instead of touch foo always use $(STAMP) foo.

from avr32-toolchain.

kblomqvist avatar kblomqvist commented on September 28, 2024

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?

from avr32-toolchain.

kblomqvist avatar kblomqvist commented on September 28, 2024

@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.

from avr32-toolchain.

jsnyder avatar jsnyder commented on September 28, 2024

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)

from avr32-toolchain.

kblomqvist avatar kblomqvist commented on September 28, 2024

So with this refactoring the stamps are actually working correctly?

Yes. I'll open a pull request when I'm done with the refactoring.

from avr32-toolchain.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.