Thinking in C and *nix (CSC 282 2015S) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] [FAQ] [Teaching & Learning] - [Calendar]
Current: [Outline] [EBoard] [Lab] [Assignment]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines]
Reference: [EBook] - [ISO] [GNU Coding Standards] [GCC Documentation] - [TAoUP] [Make3]
Previous Offerings: [CSC 295 2013S] [CSC 295 2014S]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker]
Overview
Goals
Format
MakefileNeed to specify target, action, dependencies
target: dependencies
\t action1
\t action2
...
We can include variables in our makefile (see next section)
Learned from writing your own
make. If you
have multiple targets, typing make only makes the first one.
default and lists
all the things you really want to make.pi rather than 3.141592653589... (mnemonic rather
than a value)In make, initialize with
VARIABLE = values or computations
Custom is that variables are all caps
$(VARIABLE)Make has a lot of standard rules (e.g., for building .o files from .c files). We can customize using variables.
CCSam's web sites
Rules are often almost identical. So we want patterns that will work with anything that follows some standard naming conventions.
Two mechansisms for doing this: Original Make and GNU Make.
Two stages: Automatic variables
$@Refer to the prerequisites: $^
file.htm: file.md
Markdown.pl < $^ > $@
Use patterns for the target and dependecies (% means "anything")
%.htm: %.md
Markdown.pl < $^ > $@
make -p
VAR = $(shell COMMAND)