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 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 Slide

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

    View Slide

  4. View Slide

  5. Motivation

    View Slide

  6. 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 Slide

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

    View Slide

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

    View Slide

  9. 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 Slide

  10. Features

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  14. Demo

    View Slide

  15. Thanks!
    @JaceBrowning

    View Slide