An introduction to Makefiles given at BarCamp GR.
Intro to Make@JaceBrowning
View Slide
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
barcamp: barcamp.cgcc -o barcamp barcamp.c$ make barcamp
Motivation
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?
Arguments for Make● Ubiquitous● Stable● Self-contained● Established conventions○ make○ make test○ make clean
Advantages of Standardizing● Reduced project switching overhead● Shared Continuous Integration configuration● Easier build debugging
before_script:- git submodule update --init --recursive- ./set_token.sh- bundle installscript:- bundle exec rakesecure_pipeline:network_attack- bundle exec rake secure_pipeline:ssl_attack- bundle exec rake secure_pipeline:xss- bundle exec rakesecure_pipeline:information_leakage- bundle exec rakesecure_pipeline:sql_injectionbefore_script:- makescript:- make ci
Features
Files and Timestamps● Create missing files● Traverse dependency chains● Update files when dependencies are newer
Variables● CONSTANT := value● LAZY = $(shell ls *.py)● OPTIONAL ?= value2○ make OPTIONAL=value3
Automatic Variables● $@● $<● $^https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
Demo
Thanks!@JaceBrowning