Patterns Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See

Slides:



Advertisements
Similar presentations
Introduction Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Advertisements

Introduction Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Floating Point Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Control Flow Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
The make Utility Programming Tools and Environments Winter 2006.
Job Control Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
CS201 – Makefile Tutorial. A Trivial Makefile # Trivial Makefile for puzzle1.c # Ray S. Babcock, CS201, MSU-Bozeman # 1/5/05 # puzzle1: puzzle1.c gcc.
Compilation & linkage.h read.h.c read.c.c main.c.c list.c.h list.h prog1 Linkage: g++ read.o main.o list.o –o prog1.o main.o.o list.o.o read.o Compilation:
1 CS 201 Makefile Debzani Deb. 2 Remember this? 3 What is a Makefile? A Makefile is a collection of instructions that is used to compile your program.
CS465 - Unix C Programming (cc/make and configuration control)
Introduction Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Loops and Iteration Chapter 5 Python for Informatics: Exploring Information
Mechanics Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
July 29, 2003Serguei Mokhov, 1 Makefile Brief Reference COMP 229, 346, 444, 5201 Revision 1.2 Date: July 18, 2004.
Functions Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Fixtures Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Jump to first page (C) 1998, Arun Lakhotia 1 Software Configuration Management: Build Control Arun Lakhotia University of Southwestern Louisiana Po Box.
Scons Writing Solid Code Overview What is scons? scons Basics Other cools scons stuff Resources.
Basic File Input and Output Copyright © Software Carpentry 2011 This work is licensed under the Creative Commons Attribution License See
Browsing Directories Copyright © Software Carpentry and The University of Edinburgh This work is licensed under the Creative Commons Attribution.
It’s all about your mission. Francis Scudellari Trish Perkins Cloud Consultants Validation.
Pipes and Filters Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Advanced Shell Tricks Copyright © The University of Southampton 2011 This work is licensed under the Creative Commons Attribution License See
Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Files and Directories Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
GNU Make Computer Organization II 1 © McQuain What is make ? make is a system utility for managing the build process (compilation/linking/etc).
Introduction Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Interface and Implementation Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Introduction Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Storage Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Introduction Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
How can I find it? Can I use it? considerations for the use and reuse of digital content.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Montreal CRIM Workshop Sakai code exercises Aaron Zeckoski.
Copyright © Software Carpentry 2011 This work is licensed under the Creative Commons Attribution License See
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Introduction Copyright © Software Carpentry This work is licensed under the Creative Commons Attribution License See
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 31. Review Creational Design Patterns – Singleton Pattern – Builder Pattern.
Querying Directory Contents Copyright © The University of Edinburgh 2011 This work is licensed under the Creative Commons Attribution License See
Rollback Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Finding Things Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Lecture 8  make. Using make for compilation  With medium to large software projects containing many files, it’s difficult to: Type commands to compile.
Operators Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Exceptions Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
CSc 352 An Introduction to make Saumya Debray Dept. of Computer Science The University of Arizona, Tucson
GNU Make Computer Organization II 1 © McQuain What is make ? make is a system utility for managing the build process (compilation/linking/etc).
19 Copyright © 2004, Oracle. All rights reserved. Database Backups.
2 Copyright © 2005, Oracle. All rights reserved. Installing Oracle Software and Creating the Database.
Python Aliasing Copyright © Software Carpentry 2010
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha Fall 2015
Program Design Invasion Percolation: Aliasing
Program Design Invasion Percolation: Testing
Sets and Dictionaries Examples Copyright © Software Carpentry 2010
Program Design Invasion Percolation: Resolving Ties
Program Design Invasion Percolation: Neighbors
Makefile Tutorial CIS5027 Prof: Dr. Shu-Ching Chen
What is make? make is a system utility for managing the build process (compilation/linking/etc). There are various versions of make; these notes discuss.
Prof: Dr. Shu-Ching Chen TA: Yimin Yang
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Hector Cen Fall 2017
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha
Makefiles and the make utility
Version Control Basic Operation Copyright © Software Carpentry 2010
Version Control Introduction Copyright © Software Carpentry 2010
Program Design Invasion Percolation: Bugs
Version Control Conflict Copyright © Software Carpentry 2010
Program Design Invasion Percolation: The Grid
CSc 352 An Introduction to make
Browsing Directories Using walk
Makefiles and the make utility
What is make? make is a system utility for managing the build process (compilation/linking/etc). There are various versions of make; these notes discuss.
Presentation transcript:

Patterns Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See for more information. Automated Builds

Patterns Manage tasks and dependencies

Automated BuildsPatterns figure-1.svg summary-1.dat Manage tasks and dependencies figure-2.svg data-1-1.datdata-1-3.datdata-1-2.dat paper.pdf paper.wdp

Automated BuildsPatterns figure-1.svg summary-1.dat Manage tasks and dependencies figure-2.svg data-1-1.datdata-1-3.datdata-1-2.dat paper.pdf paper.wdp stats.py stats.py summary-1.dat data-1-*.dat

Automated BuildsPatterns figure-1.svg summary-1.dat Manage tasks and dependencies figure-2.svg data-1-1.datdata-1-3.datdata-1-2.dat paper.pdf paper.wdp stats.py stats.py summary-1.dat data-1-*.dat ?

Automated BuildsPatterns figure-1.svg summary-1.dat Manage tasks and dependencies figure-2.svg data-1-1.datdata-1-3.datdata-1-2.dat paper.pdf paper.wdp stats.py stats.py summary-1.dat data-1-*.dat ?

Automated BuildsPatterns summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3 # multiple.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py summary-1.dat data-1-1.dat data-1-2.dat data-1-3.dat

Automated BuildsPatterns summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3 # target-variable.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py summary-1.dat data-1-1.dat data-1-2.dat data-1-3.dat

Automated BuildsPatterns summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3 # target-variable.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py summary-1.dat data-1-1.dat data-1-2.dat data-1-3.dat stats.py data-1-1.dat data-1-2.dat data-1-3.dat

Automated BuildsPatterns summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3 # target-variable.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py summary-1.dat data-1-1.dat data-1-2.dat data-1-3.dat stats.py data-1-1.dat data-1-2.dat data-1-3.dat

Automated BuildsPatterns summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3 # target-variable.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py summary-1.dat data-1-1.dat data-1-2.dat data-1-3.dat stats.py data-1-1.dat data-1-2.dat data-1-3.dat Automatic variable

Automated BuildsPatterns summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3 # target-variable.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py summary-1.dat data-1-1.dat data-1-2.dat data-1-3.dat stats.py data-1-1.dat data-1-2.dat data-1-3.dat Automatic variable "the target of this rule"

Automated BuildsPatterns summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3 # target-variable.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py summary-1.dat data-1-1.dat data-1-2.dat data-1-3.dat stats.py data-1-1.dat data-1-2.dat data-1-3.dat Automatic variable "the target of this rule" No, there isn't a more readable form

Automated BuildsPatterns # target-variable.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py data-1-1.dat data-1-2.dat data-1-3.dat Still a lot of redundancy summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3

Automated BuildsPatterns # variables.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py data-1-1.dat data-1-2.dat data-1-3.dat summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3

Automated BuildsPatterns # variables.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py data-1-1.dat data-1-2.dat data-1-3.dat stats.py $^ summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3

Automated BuildsPatterns # variables.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py data-1-1.dat data-1-2.dat data-1-3.dat stats.py $^ All prerequisites of this rule summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3

Automated BuildsPatterns # variables.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py data-1-1.dat data-1-2.dat data-1-3.dat stats.py $^ All prerequisites of this rule $< is "the first prerequisite" summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3

Automated BuildsPatterns # variables.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py data-1-1.dat data-1-2.dat data-1-3.dat stats.py $^ All prerequisites of this rule $< is "the first prerequisite" $? is "all out-of-date prerequisites" summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3

Automated BuildsPatterns # variables.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py $^ summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3

Automated BuildsPatterns # variables.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py $^ summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-2.dat 1 3 Expect more data files

Automated BuildsPatterns # variables.mk summary-1.dat : data-1-1.dat data-1-2.dat data-1-3.dat stats.py $^ summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-*.dat Want to do this

Automated BuildsPatterns # wildcard.mk summary-1.dat : data-1-*.dat stats.py $^ summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-*.dat

Automated BuildsPatterns # wildcard.mk summary-1.dat : data-1-*.dat stats.py $^ summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-*.dat Just like shell wildcard

Automated BuildsPatterns # wildcard.mk summary-1.dat : data-1-*.dat stats.py $^ summary-1.dat data-1-1.datdata-1-3.datdata-1-2.dat stats.py summary-1.dat data-1-*.dat Just like shell wildcard Must use $^ in action, since filenames not fixed in advance

Automated BuildsPatterns figure-1.svg summary-1.dat figure-2.svg data-1-1.datdata-1-3.datdata-1-2.dat paper.pdf paper.wdp wdp2pdf paper.wdp stats.py sgr -N -r summary-1.dat \ > figure-1.svg stats.py summary-1.dat data-1-*.dat The whole tree one more time

Automated BuildsPatterns The makefile so far paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf $< figure-1.svg : summary-1.dat sgr -N -r $^ figure-2.svg : summary-2.dat sgr -N -r $^ summary-1.dat : data-1-*.dat stats.py $^ summary-2.dat : data-2-*.dat stats.py $^

Automated BuildsPatterns Still some redundancy paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf $< figure-1.svg : summary-1.dat sgr -N -r $^ figure-2.svg : summary-2.dat sgr -N -r $^ summary-1.dat : data-1-*.dat stats.py $^ summary-2.dat : data-2-*.dat stats.py $^ The makefile so far

Automated BuildsPatterns Still some redundancy Fix in next episode paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf $< figure-1.svg : summary-1.dat sgr -N -r $^ figure-2.svg : summary-2.dat sgr -N -r $^ summary-1.dat : data-1-*.dat stats.py $^ summary-2.dat : data-2-*.dat stats.py $^ The makefile so far

Automated BuildsPatterns Still some redundancy Fix in next episode paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf $< figure-1.svg : summary-1.dat sgr -N -r $^ figure-2.svg : summary-2.dat sgr -N -r $^ summary-1.dat : data-1-*.dat stats.py $^ summary-2.dat : data-2-*.dat stats.py $^ Doesn't handle summaries' dependency on stats.py The makefile so far

Automated BuildsPatterns paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf $< figure-1.svg : summary-1.dat sgr -N -r $^ figure-2.svg : summary-2.dat sgr -N -r $^ summary-1.dat : stats.py data-1-*.dat stats.py $^ summary-2.dat : stats.py data-2-*.dat stats.py $^ Option 1: add to existing rules

Automated BuildsPatterns ⋮ summary-1.dat : stats.py data-1-*.dat stats.py $^ summary-2.dat : stats.py data-2-*.dat stats.py $^ ⋮ Option 1: add to existing rules $^ is now stats.py data-1-1.dat data-1-1.dat...

Automated BuildsPatterns ⋮ summary-1.dat : stats.py data-1-*.dat stats.py $^ summary-2.dat : stats.py data-2-*.dat stats.py $^ ⋮ $^ is now stats.py data-1-1.dat data-1-1.dat... So the invocation of stats.py is wrong Option 1: add to existing rules

Automated BuildsPatterns ⋮ summary-1.dat : stats.py data-1-*.dat stats.py $^ summary-2.dat : stats.py data-2-*.dat stats.py $^ ⋮ $^ is now stats.py data-1-1.dat data-1-1.dat... So the invocation of stats.py is wrong Having it ignore one argument is an ugly hack Option 1: add to existing rules

Automated BuildsPatterns figure-2.svg : summary-2.dat sgr -N -r $^ summary-1.dat : data-1-*.dat stats.py $^ summary-2.dat : data-2-*.dat stats.py $^ data-1-1.dat : stats.py touch data-1-2.dat : stats.py touch Option 2: make data files depend on stats.py

Automated BuildsPatterns ⋮ data-1-1.dat : stats.py touch data-1-2.dat : stats.py touch ⋮ Option 2: make data files depend on stats.py A false dependency

Automated BuildsPatterns Option 2: make data files depend on stats.py ⋮ data-1-1.dat : stats.py touch data-1-2.dat : stats.py touch ⋮ A false dependency Updating raw data files triggers update of summary

Automated BuildsPatterns Option 2: make data files depend on stats.py ⋮ data-1-1.dat : stats.py touch data-1-2.dat : stats.py touch ⋮ A false dependency Updating raw data files triggers update of summary Back to listing all raw data files explicitly…

Automated BuildsPatterns paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf $< figure-1.svg : summary-1.dat sgr -N -r $^ figure-2.svg : summary-2.dat sgr -N -r $^ summary-1.dat : data-1-*.dat stats.py $^ summary-2.dat : data-2-*.dat stats.py $^ summary-1.dat : stats.py summary-2.dat : stats.py Option 3: add additional dependencies

Automated BuildsPatterns ⋮ summary-1.dat : data-1-*.dat stats.py $^ summary-2.dat : data-2-*.dat stats.py $^ summary-1.dat : stats.py summary-2.dat : stats.py ⋮ Option 3: add additional dependencies Full set of dependencies is union of lists

Automated BuildsPatterns ⋮ summary-1.dat : data-1-*.dat stats.py $^ summary-2.dat : data-2-*.dat stats.py $^ summary-1.dat : stats.py summary-2.dat : stats.py ⋮ Option 3: add additional dependencies Full set of dependencies is union of lists But $^ in the action is still just data-1-*.dat

August 2010 created by Greg Wilson Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See for more information.