macros copyright © software carpentry 2010 this work is licensed under the creative commons...
TRANSCRIPT
![Page 1: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/1.jpg)
Macros
Copyright © Software Carpentry 2010
This work is licensed under the Creative Commons Attribution License
See http://software-carpentry.org/license.html for more information.
Automated Builds
![Page 2: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/2.jpg)
Automated Builds Macros
Manage tasks and dependencies
![Page 3: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/3.jpg)
Automated Builds Macros
figure-1.svg
summary-1.dat
Manage tasks and dependencies
figure-2.svg
data-1-1.dat data-1-3.datdata-1-2.dat
paper.pdf
paper.wdp
![Page 4: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/4.jpg)
Automated Builds Macros
"must conform to university style"
![Page 5: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/5.jpg)
Automated Builds Macros
"must conform to university style"
figure-1.svg figure-2.svg
paper.pdf
euphoric.wps paper.wdp
![Page 6: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/6.jpg)
Automated Builds Macros
"must conform to university style"
figure-1.svg figure-2.svg
paper.pdf
euphoric.wps paper.wdp
C:\papers
home
![Page 7: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/7.jpg)
Automated Builds Macros
"must conform to university style"
figure-1.svg figure-2.svg
paper.pdf
euphoric.wps paper.wdp
C:\papers /lib/styles/
home lab
![Page 8: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/8.jpg)
Automated Builds Macros
"must conform to university style"
figure-1.svg figure-2.svg
paper.pdf
euphoric.wps paper.wdp
data-1-1.dat data-1-2.dateuphoric.fig
![Page 9: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/9.jpg)
Automated Builds Macros
"must conform to university style"
figure-1.svg figure-2.svg
paper.pdf
euphoric.wps paper.wdp
C:\papers
home
data-1-1.dat data-1-2.dateuphoric.fig
![Page 10: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/10.jpg)
Automated Builds Macros
"must conform to university style"
figure-1.svg figure-2.svg
paper.pdf
euphoric.wps paper.wdp
C:\papers /lib/styles/
home lab
data-1-1.dat data-1-2.dateuphoric.fig
![Page 11: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/11.jpg)
Automated Builds Macros
# false-dependencies.mk
paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf $<
figure-%.svg : summary-%.dat sgr -N -r $@ $^
summary-%.dat : data-%-*.dat stats.py $@ $^
data-*-*.dat : stats.py touch $@
Makefile so far
![Page 12: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/12.jpg)
Automated Builds Macros
# with-directories-at-home.mk
paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf --style c:/papers/euphoric.wps $<
figure-%.svg : summary-%.dat sgr -N -r -s c:/papers/euphoric.fig $@ $^
summary-%.dat : data-%-*.dat stats.py $@ $^
data-*-*.dat : stats.py touch $@
Add directories for working at home
![Page 13: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/13.jpg)
Automated Builds Macros
# with-directories-at-home.mk
paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf --style c:/papers/euphoric.wps $<
figure-%.svg : summary-%.dat sgr -N -r -s c:/papers/euphoric.fig $@ $^
summary-%.dat : data-%-*.dat stats.py $@ $^
data-*-*.dat : stats.py touch $@
Add directories for working at home
![Page 14: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/14.jpg)
Automated Builds Macros
# with-directories-at-home.mk
paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf --style c:/papers/euphoric.wps $<
figure-%.svg : summary-%.dat sgr -N -r -s c:/papers/euphoric.fig $@ $^
summary-%.dat : data-%-*.dat stats.py $@ $^
data-*-*.dat : stats.py touch $@
Usually don't list "system" files explicitly
Add directories for working at home
![Page 15: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/15.jpg)
Automated Builds Macros
# with-directories-at-home.mk
paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf --style c:/papers/euphoric.wps $<
figure-%.svg : summary-%.dat sgr -N -r -s c:/papers/euphoric.fig $@ $^
summary-%.dat : data-%-*.dat stats.py $@ $^
data-*-*.dat : stats.py touch $@
Usually don't list "system" files explicitly
But what about the lab?
Add directories for working at home
![Page 16: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/16.jpg)
Automated Builds Macros
1. Write two Makefiles
![Page 17: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/17.jpg)
Automated Builds Macros
1. Write two Makefiles
Write and maintain
![Page 18: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/18.jpg)
Automated Builds Macros
1. Write two Makefiles
2. Comment and uncomment lines
Write and maintain
![Page 19: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/19.jpg)
Automated Builds Macros
1. Write two Makefiles
2. Comment and uncomment lines
Write and maintain
Consistently every time
![Page 20: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/20.jpg)
Automated Builds Macros
1. Write two Makefiles
2. Comment and uncomment lines
Write and maintain
Consistently every time
Will create lots of noise in
version control
![Page 21: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/21.jpg)
Automated Builds Macros
1. Write two Makefiles
2. Comment and uncomment lines
3. Refactor
Write and maintain
Consistently every time
Will create lots of noise in
version control
![Page 22: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/22.jpg)
Automated Builds Macros
Use a macro
![Page 23: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/23.jpg)
Automated Builds Macros
# with-macro.mk
STYLE_DIR=c:/papers/
paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf --style ${STYLE_DIR}/euphoric.wps $<
figure-%.svg : summary-%.dat sgr -N -r -s ${STYLE_DIR}/euphoric.fig $@ $^
summary-%.dat : data-%-*.dat stats.py $@ $^
data-*-*.dat : stats.py touch $@
Use a macro
![Page 24: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/24.jpg)
Automated Builds Macros
# with-macro.mk
STYLE_DIR=c:/papers/
paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf --style ${STYLE_DIR}/euphoric.wps $<
figure-%.svg : summary-%.dat sgr -N -r -s ${STYLE_DIR}/euphoric.fig $@ $^
summary-%.dat : data-%-*.dat stats.py $@ $^
data-*-*.dat : stats.py touch $@
Use a macro
![Page 25: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/25.jpg)
Automated Builds Macros
# with-macro.mk
STYLE_DIR=c:/papers/
paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf --style ${STYLE_DIR}/euphoric.wps $<
figure-%.svg : summary-%.dat sgr -N -r -s ${STYLE_DIR}/euphoric.fig $@ $^
summary-%.dat : data-%-*.dat stats.py $@ $^
data-*-*.dat : stats.py touch $@
Use a macro
![Page 26: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/26.jpg)
Automated Builds Macros
Only have one thing to change
![Page 27: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/27.jpg)
Automated Builds Macros
Only have one thing to change
✓ Consistency
![Page 28: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/28.jpg)
Automated Builds Macros
Only have one thing to change
✓ Consistency
✗ But still have noise
![Page 29: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/29.jpg)
Automated Builds Macros
Only have one thing to change
Must use ${MACRO} or $(MACRO), not $MACRO
✓ Consistency
✗ But still have noise
![Page 30: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/30.jpg)
Automated Builds Macros
Only have one thing to change
Must use ${MACRO} or $(MACRO), not $MACRO
Make reads $MACRO is ($M)ACRO
✓ Consistency
✗ But still have noise
![Page 31: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/31.jpg)
Automated Builds Macros
Only have one thing to change
Must use ${MACRO} or $(MACRO), not $MACRO
Make reads $MACRO is ($M)ACRO
Which is probably just "ACRO"
✓ Consistency
✗ But still have noise
![Page 32: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/32.jpg)
Automated Builds Macros
Only have one thing to change
Must use ${MACRO} or $(MACRO), not $MACRO
Make reads $MACRO is ($M)ACRO
Which is probably just "ACRO"
Which is probably not what you want
✓ Consistency
✗ But still have noise
![Page 33: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/33.jpg)
Automated Builds Macros
Only have one thing to change
Must use ${MACRO} or $(MACRO), not $MACRO
Make reads $MACRO is ($M)ACRO
Which is probably just "ACRO"
Which is probably not what you want
yet another legacy wart
✓ Consistency
✗ But still have noise
![Page 34: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/34.jpg)
Automated Builds Macros
Commonly define macros for control flags
![Page 35: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/35.jpg)
Automated Builds Macros
# with-lots-of-macros.mk
STYLE_DIR=c:/papers/WDP2PDF_FLAGS=--style ${STYLE_DIR}/euphoric.wpsSGR_FLAGS=-N -r -s ${STYLE_DIR}/euphoric.fig
paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf ${WDP2PDF_FLAGS} $<
figure-%.svg : summary-%.dat sgr ${SGR_FLAGS} $@ $^
summary-%.dat : data-%-*.dat stats.py $@ $^
data-*-*.dat : stats.py touch $@
Commonly define macros for control flags
![Page 36: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/36.jpg)
Automated Builds Macros
# with-lots-of-macros.mk
STYLE_DIR=c:/papers/WDP2PDF_FLAGS=--style ${STYLE_DIR}/euphoric.wpsSGR_FLAGS=-N -r -s ${STYLE_DIR}/euphoric.fig
paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf ${WDP2PDF_FLAGS} $<
figure-%.svg : summary-%.dat sgr ${SGR_FLAGS} $@ $^
summary-%.dat : data-%-*.dat stats.py $@ $^
data-*-*.dat : stats.py touch $@
Commonly define macros for control flags
![Page 37: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/37.jpg)
Automated Builds Macros
# with-lots-of-macros.mk
STYLE_DIR=c:/papers/WDP2PDF_FLAGS=--style ${STYLE_DIR}/euphoric.wpsSGR_FLAGS=-N -r -s ${STYLE_DIR}/euphoric.fig
paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf ${WDP2PDF_FLAGS} $<
figure-%.svg : summary-%.dat sgr ${SGR_FLAGS} $@ $^
summary-%.dat : data-%-*.dat stats.py $@ $^
data-*-*.dat : stats.py touch $@
Commonly define macros for control flags
![Page 38: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/38.jpg)
Automated Builds Macros
# config.mk
STYLE_DIR=c:/papers/
Now put the first macro in a separate file
![Page 39: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/39.jpg)
Automated Builds Macros
# with-include.mkinclude config.mk
WDP2PDF_FLAGS=--style ${STYLE_DIR}/euphoric.wpsSGR_FLAGS=-N -r -s ${STYLE_DIR}/euphoric.fig
paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf ${WDP2PDF_FLAGS} $<
figure-%.svg : summary-%.dat sgr ${SGR_FLAGS} $@ $^
summary-%.dat : data-%-*.dat stats.py $@ $^
data-*-*.dat : stats.py touch $@
And include it from the main file
![Page 40: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/40.jpg)
Automated Builds Macros
# with-include.mkinclude config.mk
WDP2PDF_FLAGS=--style ${STYLE_DIR}/euphoric.wpsSGR_FLAGS=-N -r -s ${STYLE_DIR}/euphoric.fig
paper.pdf : paper.wdp figure-1.svg figure-2.svg wdp2pdf ${WDP2PDF_FLAGS} $<
figure-%.svg : summary-%.dat sgr ${SGR_FLAGS} $@ $^
summary-%.dat : data-%-*.dat stats.py $@ $^
data-*-*.dat : stats.py touch $@
And include it from the main file
![Page 41: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/41.jpg)
Automated Builds Macros
Actually create two configuration files
![Page 42: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/42.jpg)
Automated Builds Macros
# config-home.mk
STYLE_DIR=c:/papers/
Actually create two configuration files
![Page 43: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/43.jpg)
Automated Builds Macros
# config-home.mk
STYLE_DIR=c:/papers/
Actually create two configuration files
# config-lab.mk
STYLE_DIR=/lib/styles
![Page 44: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/44.jpg)
Automated Builds Macros
# config-home.mk
STYLE_DIR=c:/papers/
Actually create two configuration files
# config-lab.mk
STYLE_DIR=/lib/styles
These two files stay in version control
![Page 45: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/45.jpg)
Automated Builds Macros
# config-home.mk
STYLE_DIR=c:/papers/
Actually create two configuration files
# config-lab.mk
STYLE_DIR=/lib/styles
These two files stay in version control
Copy to create config.mk per machine
![Page 46: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/46.jpg)
Automated Builds Macros
paper/
config-lab.mkconfig-home.mkMakefile
Home
![Page 47: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/47.jpg)
Automated Builds Macros
paper/
config.mkconfig-lab.mkconfig-home.mkMakefile
Home
![Page 48: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/48.jpg)
Automated Builds Macros
paper/
config.mkconfig-lab.mkconfig-home.mkMakefile
Home
paper/
config-lab.mkconfig-home.mkMakefile
Lab
![Page 49: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/49.jpg)
Automated Builds Macros
paper/
config.mkconfig-lab.mkconfig-home.mkMakefile
Home
paper/
config.mkconfig-lab.mkconfig-home.mkMakefile
Lab
![Page 50: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/50.jpg)
Automated Builds Macros
paper/
config.mkconfig-lab.mkconfig-home.mkMakefile
Home
paper/
config.mkconfig-lab.mkconfig-home.mkMakefile
Lab
![Page 51: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/51.jpg)
Automated Builds Macros
Can also define macro value on command line
![Page 52: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/52.jpg)
Automated Builds Macros
$ make -DSTYLE_DIR=/lib/styles -f Makefile
Can also define macro value on command line
![Page 53: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/53.jpg)
Automated Builds Macros
$ make -DSTYLE_DIR=/lib/styles -f Makefile
Can also define macro value on command line
Generally a bad idea
![Page 54: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/54.jpg)
Automated Builds Macros
$ make -DSTYLE_DIR=/lib/styles -f Makefile
Can also define macro value on command line
Generally a bad idea
Have to remember to type definition each time
![Page 55: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/55.jpg)
Automated Builds Macros
$ make -DSTYLE_DIR=/lib/styles -f Makefile
Can also define macro value on command line
Generally a bad idea
Have to remember to type definition each time
correctly
![Page 56: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/56.jpg)
Automated Builds Macros
$ make -DSTYLE_DIR=/lib/styles -f Makefile
Can also define macro value on command line
Generally a bad idea
Have to remember to type definition each time
correctly
And there's no record of the flag
![Page 57: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/57.jpg)
Automated Builds Macros
Many other approaches
![Page 58: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/58.jpg)
Automated Builds Macros
Many other approaches
CMake and Autoconf/Automake: compile higher-level
specification into a Makefile (or equivalent)
![Page 59: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/59.jpg)
Automated Builds Macros
Many other approaches
CMake and Autoconf/Automake: compile higher-level
specification into a Makefile (or equivalent)
✓ Automatically discover/manage differences
between machines
![Page 60: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/60.jpg)
Automated Builds Macros
Many other approaches
CMake and Autoconf/Automake: compile higher-level
specification into a Makefile (or equivalent)
✓ Automatically discover/manage differences
between machines
✗ But even harder to debug
![Page 61: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/61.jpg)
Automated Builds Macros
Many other approaches
CMake and Autoconf/Automake: compile higher-level
specification into a Makefile (or equivalent)
✓ Automatically discover/manage differences
between machines
✗ But even harder to debug
A build file is a program
![Page 62: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/62.jpg)
Automated Builds Macros
Many other approaches
CMake and Autoconf/Automake: compile higher-level
specification into a Makefile (or equivalent)
✓ Automatically discover/manage differences
between machines
✗ But even harder to debug
A build file is a program
Requires the same degree of respect
![Page 63: Macros Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See](https://reader035.vdocuments.net/reader035/viewer/2022062720/56649f115503460f94c23cdb/html5/thumbnails/63.jpg)
August 2010
created by
Greg Wilson
Copyright © Software Carpentry 2010
This work is licensed under the Creative Commons Attribution License
See http://software-carpentry.org/license.html for more information.