Created
March 25, 2014 23:44
-
-
Save jmervine/9773920 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
# Usage: | |
# | |
# Download this file and start by running 'make'. Then run | |
# each target listed, 'make lesson_one', 'make lesson_two', | |
# etc. | |
# | |
introduction: | |
# Introduction: | |
# | |
# Lesson One (lesson_one) | |
# - Makefiles and makefiles | |
# - Default target. | |
# | |
# Lesson Two (lesson_two) | |
# - Running targets. | |
# - Changing directories. | |
# | |
# Lesson Three (lesson_three) | |
# - Hiding commands and comments. | |
# - Ignoring errors. | |
# | |
# Lesson Four (lesson_four) | |
# - Variables | |
lesson_one: | |
# Lesson One | |
# | |
# The standard file naming for 'make' is Makefile, alhtough | |
# I've often seen 'makefile' as well. The accepted extension | |
# is '.mk', often used for include files - I'll cover includes | |
# later. | |
# | |
# The default target, that is to say, the target that is | |
# run when 'make' is executed without a target, will always | |
# be the first target in the 'Makefile'. In this file, | |
# 'introduction' is the default target. | |
lesson_two: clean | |
# Lesson Two | |
# | |
# Make runs commands, one after another. | |
pwd | |
mkdir lesson_two | |
@echo | |
cd lesson_two | |
pwd | |
@echo | |
# Make's commands are always run from the root director | |
# it was called from, it ignores 'cd'. | |
@sleep 1 | |
@echo | |
# To change directory, you must chain commands with '&&' | |
# or ';'. | |
cd lesson_two; pwd | |
lesson_three: | |
# Lesson Three | |
# | |
# You can hide the command or comment that is run, by | |
# prefixing it with '@'. | |
# | |
echo "This command will be shown, and then it's output will be shown." | |
@echo | |
@echo "This command is prefixed with '@', only it's output will be shown." | |
@echo | |
@sleep 1 | |
# This comment will be shown, but comments prefixed with '@' won't be. | |
# | |
# Example: '@#' hidden comment. | |
lesson_four: | |
# Lesson Four | |
# | |
# Variable's are set and called, much like in bash, the difference | |
# being that aside from being prefixed with a dollar sign ($$), the | |
# variable must wrapped in parentheses - e.g. "$$(FOO)". | |
# | |
# FOO=bar # setting | |
# $$(FOO) # calling | |
# | |
# Additionally, variables can only be set external to targets. | |
clean: | |
@-rm -rf lesson_two | |
.PHONY: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment