Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Intro to Make

Intro to Make

An introduction to Makefiles given at BarCamp GR.

Jace Browning

August 26, 2016
Tweet

More Decks by Jace Browning

Other Decks in Programming

Transcript

  1. Intro to Make
    @JaceBrowning

    View full-size slide

  2. What is Make?
    ● Build automation tool
    ○ Builds executable programs from source code
    ○ Update files automatically when related files change
    ● Initial release: 1977
    ● Filename: Makefile
    ○ Targets
    ○ Components
    ○ Commands

    View full-size slide

  3. barcamp: barcamp.c
    gcc -o barcamp barcamp.c
    $ make barcamp

    View full-size slide

  4. Arguments against Grunt, Gulp, etc.
    ● Bootstrapping problem
    ● Limited dependency tracking
    ● Project switching overhead
    ○ How do I install the dependencies?
    ○ How do I run the tests?

    View full-size slide

  5. Arguments for Make
    ● Ubiquitous
    ● Stable
    ● Self-contained
    ● Established conventions
    ○ make
    ○ make test
    ○ make clean

    View full-size slide

  6. Advantages of Standardizing
    ● Reduced project switching overhead
    ● Shared Continuous Integration configuration
    ● Easier build debugging

    View full-size slide

  7. before_script:
    - git submodule update --init --recursive
    - ./set_token.sh
    - bundle install
    script:
    - bundle exec rake
    secure_pipeline:network_attack
    - bundle exec rake secure_pipeline:ssl_attack
    - bundle exec rake secure_pipeline:xss
    - bundle exec rake
    secure_pipeline:information_leakage
    - bundle exec rake
    secure_pipeline:sql_injection
    before_script:
    - make
    script:
    - make ci

    View full-size slide

  8. Files and Timestamps
    ● Create missing files
    ● Traverse dependency chains
    ● Update files when dependencies are newer

    View full-size slide

  9. Variables
    ● CONSTANT := value
    ● LAZY = $(shell ls *.py)
    ● OPTIONAL ?= value2
    ○ make OPTIONAL=value3

    View full-size slide

  10. Automatic Variables
    ● $@
    ● $<
    ● $^
    https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html

    View full-size slide

  11. Thanks!
    @JaceBrowning

    View full-size slide