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.

Eff2cdaa8474520ed29ebc38031fab87?s=128

Jace Browning

August 26, 2016
Tweet

Transcript

  1. Intro to Make @JaceBrowning

  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
  3. barcamp: barcamp.c gcc -o barcamp barcamp.c $ make barcamp

  4. None
  5. Motivation

  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?
  7. Arguments for Make • Ubiquitous • Stable • Self-contained •

    Established conventions ◦ make ◦ make test ◦ make clean
  8. Advantages of Standardizing • Reduced project switching overhead • Shared

    Continuous Integration configuration • Easier build debugging
  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
  10. Features

  11. Files and Timestamps • Create missing files • Traverse dependency

    chains • Update files when dependencies are newer
  12. Variables • CONSTANT := value • LAZY = $(shell ls

    *.py) • OPTIONAL ?= value2 ◦ make <target> OPTIONAL=value3
  13. Automatic Variables • $@ • $< • $^ https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html

  14. Demo

  15. Thanks! @JaceBrowning