SlideShare ist ein Scribd-Unternehmen logo
1 von 37
Downloaden Sie, um offline zu lesen
Make
                      Pierre Lindenbaum
              http://plindenbaum.blogspot.com
          @yokofakun(http://twitter.com/yokofakun)
                 INSERM-UMR1087 Nantes
                         January 2013
https://github.com/lindenb/courses/tree/master/about.make
Problem
Build a C program
Make a protein
#!/bin/bash
TRANSCRIPT=cat
TRANSLATE=cat
rm -f merge.protein
for DNA in file1.dna file2.dna file3.dna
do
 echo "ATGCTAGTAGATGC" > ${DNA}
 ${TRANSCRIPT} ${DNA} > ${DNA/%.dna/.rna}
 ${TRANSLATE} ${DNA/%.dna/.rna} > ${DNA/%.dna/.pep}
 cat ${DNA/%.dna/.pep} >> merge.protein
done
What if file1.pep already exists ?
Solution: Test if file exists
#!/bin/bash
TRANSCRIPT=cat
TRANSLATE=cat
rm -f merge.protein
for DNA in file1.dna file2.dna file3.dna
do
 echo "ATGCTAGTAGATGC" > ${DNA}
 ${TRANSCRIPT} ${DNA} > ${DNA/%.dna/.rna}
 if [ ! -f ${DNA/%.dna/.pep} ]
 then
   ${TRANSLATE} ${DNA/%.dna/.rna} > ${DNA/%.dna/.pep}
 fi
 cat ${DNA/%.dna/.pep} >> merge.protein
done
What if file1.pep is outdated ?
Parallelization ?
GNU make
"a utility that automatically
builds executable programs and
 libraries from source code by
 reading files called makefiles"
1977
TARGET1: DEPENDENCIES
            COMMAND-LINES1
            COMMAND-LINES2
            COMMAND-LINES3
Makefile
TRANSCRIPT=cat
TRANSLATE=cat

merged.protein: file1.pep file2.pep file3.pep
    cat file1.pep file2.pep 
        file3.pep > merged.protein

file1.pep: file1.rna
     ${TRANSLATE} file1.rna > file1.pep

file1.rna : file1.dna
    ${TRANSCRIPT} file1.dna > file1.rna

file1.dna:
    echo "ATGCTAGTAGATGC" > file1.dna
Output

echo "ATGCTAGTAGATGC" > file1.dna
cat file1.dna > file1.rna
cat file1.rna > file1.pep
echo "ATGCTAGTAGATGC" > file2.dna
cat file2.dna > file2.rna
cat file2.rna > file2.pep
echo "ATGCTAGTAGATGC" > file3.dna
cat file3.dna > file3.rna
cat file3.rna > file3.pep
cat file1.pep file2.pep 
  file3.pep > merged.protein
If one file is removed

$ rm file2.rna
$ make

cat file2.dna   > file2.rna
cat file2.rna   > file2.pep
cat file1.pep   file2.pep 
  file3.pep >   merged.protein
If one file is changed

$ touch file1.dna file3.pep
$ make

cat file1.dna   > file1.rna
cat file1.rna   > file1.pep
cat file1.pep   file2.pep 
  file3.pep >   merged.protein
Special variables
"name of the target" : $@
TRANSCRIPT=cat
TRANSLATE=cat

merged.protein: file1.pep file2.pep file3.pep
    cat file1.pep file2.pep 
        file3.pep > $@

file1.pep: file1.rna
     ${TRANSLATE} file1.rna > $@

file1.rna : file1.dna
    ${TRANSCRIPT} file1.dna > $@

file1.dna:
    echo "ATGCTAGTAGATGC" > $@
"name of the first dependency" : $<
TRANSCRIPT=cat
TRANSLATE=cat

merged.protein: file1.pep file2.pep file3.pep
    cat file1.pep file2.pep 
        file3.pep > $@

file1.pep: file1.rna
     ${TRANSLATE} $< > $@

file1.rna : file1.dna
    ${TRANSCRIPT} $< > $@

file1.dna:
    echo "ATGCTAGTAGATGC" > $@
"all the dependencies" : $^
TRANSCRIPT=cat
TRANSLATE=cat

merged.protein: file1.pep file2.pep file3.pep
    cat $^ > $@

file1.pep: file1.rna
     ${TRANSLATE} $< > $@

file1.rna : file1.dna
    ${TRANSCRIPT} $< > $@

file1.dna:
    echo "ATGCTAGTAGATGC" > $@

file2.pep: file2.rna
Rules
How to create a *.pep or a *.rna ?
TRANSCRIPT=cat
TRANSLATE=cat

%.pep:%.rna
    ${TRANSLATE} $< > $@
%.rna:%.dna
    ${TRANSCRIPT} $< > $@

merged.protein: file1.pep file2.pep file3.pep
    cat $^ > $@

file1.dna:
    echo "ATGCTAGTAGATGC" > $@
file2.dna:
    echo "ATGCTAGTAGATGC" > $@
file3.dna:
    echo "ATGCTAGTAGATGC" > $@
Output

echo "ATGCTAGTAGATGC" > file1.dna
cat file1.dna > file1.rna
cat file1.rna > file1.pep
echo "ATGCTAGTAGATGC" > file2.dna
cat file2.dna > file2.rna
cat file2.rna > file2.pep
echo "ATGCTAGTAGATGC" > file3.dna
cat file3.dna > file3.rna
cat file3.rna > file3.pep
cat file1.pep file2.pep file3.pep > merged.prot
Useful options
-B "Unconditionally make all targets"
-f FILE "Read FILE as a makefile"
-j [N] "Allow N jobs at once"
-n "Don't actually run any commands; just print them"
.PHONY targets

.PHONY: all clean

all: file1.dna

file1.dna:
       echo "ATGCTAGTAGATGC" > $@
clean:
       rm -f file1.dna
Function Call Syntax

$(function arg1,arg2,arg3...)
Loops: $(foreach var,list,...)
merged.protein: 
   $(foreach INDEX,1 2 3,file${INDEX}.pep )
 cat $^ > $@
$(eval )
TRANSCRIPT=cat
TRANSLATE=cat
INDEXES=1 2 3
%.pep:%.rna
    ${TRANSLATE} $< > $@
%.rna:%.dna
    ${TRANSCRIPT} $< > $@

merged.protein: $(foreach INDEX,${INDEXES},file${INDEX}
    cat $^ > $@

$(foreach INDEX,${INDEXES},$(eval 
file${INDEX}:
    echo "ATGCTAGTAGATGC" > $$@ 
))
$(subst ee,EE,feet on the street)
 ‘fEEt on the strEEt’.

$(patsubst %.c,%.o,x.c.c bar.c)
 ‘x.c.o bar.o’.

 $(strip a b c )
‘a b c’
$(filter %.c,src1.c src2.c src3.c file.txt)

 $(filter-out %.c,src1.c src2.c src3.c file.txt)

$(sort foo bar lose)

$(word 2, foo bar baz)
 'bar'

$(wordlist 2, 3, foo bar baz)
‘bar baz’.

$(firstword foo bar)
‘foo’.

$(lastword foo bar)
‘bar’.
$(dir src/foo.c hacks)
‘src/ ./’

$(notdir src/foo.c hacks)
‘foo.c hacks’

$(suffix src/foo.c src-1.0/bar.c hacks)
‘.c .c’

$(basename src/foo.c src-1.0/bar hacks)
‘src/foo src-1.0/bar hacks’


$(addsuffix .c,foo bar)
‘foo.c bar.c’.

$(addprefix src/,foo bar)
‘src/foo src/bar’
(join a b,.c .o)
‘a.c b.o’

$(shell cat file1.txt)
END

Weitere ähnliche Inhalte

Was ist angesagt?

Perl 6 for Concurrency and Parallel Computing
Perl 6 for Concurrency and Parallel ComputingPerl 6 for Concurrency and Parallel Computing
Perl 6 for Concurrency and Parallel ComputingAndrew Shitov
 
Mengembalikan data yang terhapus atau rusak pada hardisk menggunakan ubuntu
Mengembalikan data yang terhapus atau rusak pada hardisk menggunakan ubuntuMengembalikan data yang terhapus atau rusak pada hardisk menggunakan ubuntu
Mengembalikan data yang terhapus atau rusak pada hardisk menggunakan ubuntuAlferizhy Chalter
 
Joy of Six - Discover the Joy of Perl 6
Joy of Six - Discover the Joy of Perl 6Joy of Six - Discover the Joy of Perl 6
Joy of Six - Discover the Joy of Perl 6trexy
 
いろいろ
いろいろいろいろ
いろいろtekezo
 
Nigel hamilton-megameet-2013
Nigel hamilton-megameet-2013Nigel hamilton-megameet-2013
Nigel hamilton-megameet-2013trexy
 
Hypers and Gathers and Takes! Oh my!
Hypers and Gathers and Takes! Oh my!Hypers and Gathers and Takes! Oh my!
Hypers and Gathers and Takes! Oh my!Workhorse Computing
 
GedcomX SDK - Getting Started
GedcomX SDK - Getting StartedGedcomX SDK - Getting Started
GedcomX SDK - Getting StartedDave Nash
 
Smolder @Silex
Smolder @SilexSmolder @Silex
Smolder @SilexJeen Lee
 
Legacy applications - 4Developes konferencja, Piotr Pasich
Legacy applications  - 4Developes konferencja, Piotr PasichLegacy applications  - 4Developes konferencja, Piotr Pasich
Legacy applications - 4Developes konferencja, Piotr PasichPiotr Pasich
 
Service intergration
Service intergration Service intergration
Service intergration 재민 장
 
Integration with Camel
Integration with CamelIntegration with Camel
Integration with CamelJosué Neis
 
多治見IT勉強会 Groovy Grails
多治見IT勉強会 Groovy Grails多治見IT勉強会 Groovy Grails
多治見IT勉強会 Groovy GrailsTsuyoshi Yamamoto
 
Functional Groovy
Functional GroovyFunctional Groovy
Functional Groovynoamt
 
BSDM with BASH: Command Interpolation
BSDM with BASH: Command InterpolationBSDM with BASH: Command Interpolation
BSDM with BASH: Command InterpolationWorkhorse Computing
 
Perl web app 테스트전략
Perl web app 테스트전략Perl web app 테스트전략
Perl web app 테스트전략Jeen Lee
 

Was ist angesagt? (20)

Perl 6 for Concurrency and Parallel Computing
Perl 6 for Concurrency and Parallel ComputingPerl 6 for Concurrency and Parallel Computing
Perl 6 for Concurrency and Parallel Computing
 
Mengembalikan data yang terhapus atau rusak pada hardisk menggunakan ubuntu
Mengembalikan data yang terhapus atau rusak pada hardisk menggunakan ubuntuMengembalikan data yang terhapus atau rusak pada hardisk menggunakan ubuntu
Mengembalikan data yang terhapus atau rusak pada hardisk menggunakan ubuntu
 
Joy of Six - Discover the Joy of Perl 6
Joy of Six - Discover the Joy of Perl 6Joy of Six - Discover the Joy of Perl 6
Joy of Six - Discover the Joy of Perl 6
 
いろいろ
いろいろいろいろ
いろいろ
 
General Functions
General FunctionsGeneral Functions
General Functions
 
Nigel hamilton-megameet-2013
Nigel hamilton-megameet-2013Nigel hamilton-megameet-2013
Nigel hamilton-megameet-2013
 
Hypers and Gathers and Takes! Oh my!
Hypers and Gathers and Takes! Oh my!Hypers and Gathers and Takes! Oh my!
Hypers and Gathers and Takes! Oh my!
 
GedcomX SDK - Getting Started
GedcomX SDK - Getting StartedGedcomX SDK - Getting Started
GedcomX SDK - Getting Started
 
C99[2]
C99[2]C99[2]
C99[2]
 
git internals
git internalsgit internals
git internals
 
Smolder @Silex
Smolder @SilexSmolder @Silex
Smolder @Silex
 
Legacy applications - 4Developes konferencja, Piotr Pasich
Legacy applications  - 4Developes konferencja, Piotr PasichLegacy applications  - 4Developes konferencja, Piotr Pasich
Legacy applications - 4Developes konferencja, Piotr Pasich
 
Metadata-driven Testing
Metadata-driven TestingMetadata-driven Testing
Metadata-driven Testing
 
Service intergration
Service intergration Service intergration
Service intergration
 
Integration with Camel
Integration with CamelIntegration with Camel
Integration with Camel
 
Findbin libs
Findbin libsFindbin libs
Findbin libs
 
多治見IT勉強会 Groovy Grails
多治見IT勉強会 Groovy Grails多治見IT勉強会 Groovy Grails
多治見IT勉強会 Groovy Grails
 
Functional Groovy
Functional GroovyFunctional Groovy
Functional Groovy
 
BSDM with BASH: Command Interpolation
BSDM with BASH: Command InterpolationBSDM with BASH: Command Interpolation
BSDM with BASH: Command Interpolation
 
Perl web app 테스트전략
Perl web app 테스트전략Perl web app 테스트전략
Perl web app 테스트전략
 

Ähnlich wie Make

Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands Ahmed El-Arabawy
 
Logrotate sh
Logrotate shLogrotate sh
Logrotate shBen Pope
 
Puppet: What _not_ to do
Puppet: What _not_ to doPuppet: What _not_ to do
Puppet: What _not_ to doPuppet
 
PuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with PuppetPuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with PuppetWalter Heck
 
PuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with PuppetPuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with PuppetOlinData
 
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTHBhavsingh Maloth
 
Shell Scripts
Shell ScriptsShell Scripts
Shell ScriptsDr.Ravi
 
Linux Bash Shell Cheat Sheet for Beginners
Linux Bash Shell Cheat Sheet for BeginnersLinux Bash Shell Cheat Sheet for Beginners
Linux Bash Shell Cheat Sheet for BeginnersDavide Ciambelli
 
Shell Script Disk Usage Report and E-Mail Current Threshold Status
Shell Script  Disk Usage Report and E-Mail Current Threshold StatusShell Script  Disk Usage Report and E-Mail Current Threshold Status
Shell Script Disk Usage Report and E-Mail Current Threshold StatusVCP Muthukrishna
 
Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本Lingfei Kong
 
Zendcon 2007 Api Design
Zendcon 2007 Api DesignZendcon 2007 Api Design
Zendcon 2007 Api Designunodelostrece
 
R版Getopt::Longを作ってみた
R版Getopt::Longを作ってみたR版Getopt::Longを作ってみた
R版Getopt::Longを作ってみたTakeshi Arabiki
 
Chap 5 php files part 1
Chap 5 php files part 1Chap 5 php files part 1
Chap 5 php files part 1monikadeshmane
 
Basic linux commands
Basic linux commands Basic linux commands
Basic linux commands Raghav Arora
 
101 3.4 use streams, pipes and redirects
101 3.4 use streams, pipes and redirects101 3.4 use streams, pipes and redirects
101 3.4 use streams, pipes and redirectsAcácio Oliveira
 

Ähnlich wie Make (20)

Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands
 
Logrotate sh
Logrotate shLogrotate sh
Logrotate sh
 
Puppet: What _not_ to do
Puppet: What _not_ to doPuppet: What _not_ to do
Puppet: What _not_ to do
 
PuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with PuppetPuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with Puppet
 
PuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with PuppetPuppetCamp Ghent - What Not to Do with Puppet
PuppetCamp Ghent - What Not to Do with Puppet
 
Perl Programming - 03 Programming File
Perl Programming - 03 Programming FilePerl Programming - 03 Programming File
Perl Programming - 03 Programming File
 
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VI BY BHAVSINGH MALOTH
 
Shell Scripts
Shell ScriptsShell Scripts
Shell Scripts
 
Linux Bash Shell Cheat Sheet for Beginners
Linux Bash Shell Cheat Sheet for BeginnersLinux Bash Shell Cheat Sheet for Beginners
Linux Bash Shell Cheat Sheet for Beginners
 
Examples -partII
Examples -partIIExamples -partII
Examples -partII
 
spug_2008-08
spug_2008-08spug_2008-08
spug_2008-08
 
Shell Script Disk Usage Report and E-Mail Current Threshold Status
Shell Script  Disk Usage Report and E-Mail Current Threshold StatusShell Script  Disk Usage Report and E-Mail Current Threshold Status
Shell Script Disk Usage Report and E-Mail Current Threshold Status
 
Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本
 
Five
FiveFive
Five
 
Zendcon 2007 Api Design
Zendcon 2007 Api DesignZendcon 2007 Api Design
Zendcon 2007 Api Design
 
Perl basics for Pentesters
Perl basics for PentestersPerl basics for Pentesters
Perl basics for Pentesters
 
R版Getopt::Longを作ってみた
R版Getopt::Longを作ってみたR版Getopt::Longを作ってみた
R版Getopt::Longを作ってみた
 
Chap 5 php files part 1
Chap 5 php files part 1Chap 5 php files part 1
Chap 5 php files part 1
 
Basic linux commands
Basic linux commands Basic linux commands
Basic linux commands
 
101 3.4 use streams, pipes and redirects
101 3.4 use streams, pipes and redirects101 3.4 use streams, pipes and redirects
101 3.4 use streams, pipes and redirects
 

Mehr von Pierre Lindenbaum

Next Generation Sequencing file Formats ( 2017 )
Next Generation Sequencing file Formats ( 2017 )Next Generation Sequencing file Formats ( 2017 )
Next Generation Sequencing file Formats ( 2017 )Pierre Lindenbaum
 
Mum, I 3D printed a gel comb !
Mum, I 3D printed a gel comb !Mum, I 3D printed a gel comb !
Mum, I 3D printed a gel comb !Pierre Lindenbaum
 
"Mon make à moi", (tout sauf Galaxy)
"Mon make à moi", (tout sauf Galaxy)"Mon make à moi", (tout sauf Galaxy)
"Mon make à moi", (tout sauf Galaxy)Pierre Lindenbaum
 
File formats for Next Generation Sequencing
File formats for Next Generation SequencingFile formats for Next Generation Sequencing
File formats for Next Generation SequencingPierre Lindenbaum
 
Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook
Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebookBuilding a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook
Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebookPierre Lindenbaum
 
Introduction to mongodb for bioinformatics
Introduction to mongodb for bioinformaticsIntroduction to mongodb for bioinformatics
Introduction to mongodb for bioinformaticsPierre Lindenbaum
 
Tweeting for the BioStar Paper
Tweeting for the BioStar PaperTweeting for the BioStar Paper
Tweeting for the BioStar PaperPierre Lindenbaum
 
Analyzing Exome Data with KNIME
Analyzing Exome Data with KNIMEAnalyzing Exome Data with KNIME
Analyzing Exome Data with KNIMEPierre Lindenbaum
 
20110114 Next Generation Sequencing Course
20110114 Next Generation Sequencing Course20110114 Next Generation Sequencing Course
20110114 Next Generation Sequencing CoursePierre Lindenbaum
 

Mehr von Pierre Lindenbaum (20)

Next Generation Sequencing file Formats ( 2017 )
Next Generation Sequencing file Formats ( 2017 )Next Generation Sequencing file Formats ( 2017 )
Next Generation Sequencing file Formats ( 2017 )
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
Mum, I 3D printed a gel comb !
Mum, I 3D printed a gel comb !Mum, I 3D printed a gel comb !
Mum, I 3D printed a gel comb !
 
"Mon make à moi", (tout sauf Galaxy)
"Mon make à moi", (tout sauf Galaxy)"Mon make à moi", (tout sauf Galaxy)
"Mon make à moi", (tout sauf Galaxy)
 
Advanced NCBI
Advanced NCBI Advanced NCBI
Advanced NCBI
 
File formats for Next Generation Sequencing
File formats for Next Generation SequencingFile formats for Next Generation Sequencing
File formats for Next Generation Sequencing
 
Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook
Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebookBuilding a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook
Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook
 
20120423.NGS.Rennes
20120423.NGS.Rennes20120423.NGS.Rennes
20120423.NGS.Rennes
 
Sketching 20120412
Sketching 20120412Sketching 20120412
Sketching 20120412
 
Introduction to mongodb for bioinformatics
Introduction to mongodb for bioinformaticsIntroduction to mongodb for bioinformatics
Introduction to mongodb for bioinformatics
 
Biostar17037
Biostar17037Biostar17037
Biostar17037
 
Tweeting for the BioStar Paper
Tweeting for the BioStar PaperTweeting for the BioStar Paper
Tweeting for the BioStar Paper
 
Variation Toolkit
Variation ToolkitVariation Toolkit
Variation Toolkit
 
Bioinformatician 2.0
Bioinformatician 2.0Bioinformatician 2.0
Bioinformatician 2.0
 
Analyzing Exome Data with KNIME
Analyzing Exome Data with KNIMEAnalyzing Exome Data with KNIME
Analyzing Exome Data with KNIME
 
NOTCH2 backstage
NOTCH2 backstageNOTCH2 backstage
NOTCH2 backstage
 
Bioinfo tweets
Bioinfo tweetsBioinfo tweets
Bioinfo tweets
 
Post doctoriales 2011
Post doctoriales 2011Post doctoriales 2011
Post doctoriales 2011
 
20110114 Next Generation Sequencing Course
20110114 Next Generation Sequencing Course20110114 Next Generation Sequencing Course
20110114 Next Generation Sequencing Course
 
MyWordle.java
MyWordle.javaMyWordle.java
MyWordle.java
 

Kürzlich hochgeladen

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 

Kürzlich hochgeladen (20)

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 

Make

  • 1. Make Pierre Lindenbaum http://plindenbaum.blogspot.com @yokofakun(http://twitter.com/yokofakun) INSERM-UMR1087 Nantes January 2013 https://github.com/lindenb/courses/tree/master/about.make
  • 3. Build a C program
  • 4. Make a protein #!/bin/bash TRANSCRIPT=cat TRANSLATE=cat rm -f merge.protein for DNA in file1.dna file2.dna file3.dna do echo "ATGCTAGTAGATGC" > ${DNA} ${TRANSCRIPT} ${DNA} > ${DNA/%.dna/.rna} ${TRANSLATE} ${DNA/%.dna/.rna} > ${DNA/%.dna/.pep} cat ${DNA/%.dna/.pep} >> merge.protein done
  • 5. What if file1.pep already exists ?
  • 6. Solution: Test if file exists #!/bin/bash TRANSCRIPT=cat TRANSLATE=cat rm -f merge.protein for DNA in file1.dna file2.dna file3.dna do echo "ATGCTAGTAGATGC" > ${DNA} ${TRANSCRIPT} ${DNA} > ${DNA/%.dna/.rna} if [ ! -f ${DNA/%.dna/.pep} ] then ${TRANSLATE} ${DNA/%.dna/.rna} > ${DNA/%.dna/.pep} fi cat ${DNA/%.dna/.pep} >> merge.protein done
  • 7. What if file1.pep is outdated ?
  • 10. "a utility that automatically builds executable programs and libraries from source code by reading files called makefiles"
  • 11. 1977
  • 12. TARGET1: DEPENDENCIES COMMAND-LINES1 COMMAND-LINES2 COMMAND-LINES3
  • 13. Makefile TRANSCRIPT=cat TRANSLATE=cat merged.protein: file1.pep file2.pep file3.pep cat file1.pep file2.pep file3.pep > merged.protein file1.pep: file1.rna ${TRANSLATE} file1.rna > file1.pep file1.rna : file1.dna ${TRANSCRIPT} file1.dna > file1.rna file1.dna: echo "ATGCTAGTAGATGC" > file1.dna
  • 14. Output echo "ATGCTAGTAGATGC" > file1.dna cat file1.dna > file1.rna cat file1.rna > file1.pep echo "ATGCTAGTAGATGC" > file2.dna cat file2.dna > file2.rna cat file2.rna > file2.pep echo "ATGCTAGTAGATGC" > file3.dna cat file3.dna > file3.rna cat file3.rna > file3.pep cat file1.pep file2.pep file3.pep > merged.protein
  • 15. If one file is removed $ rm file2.rna $ make cat file2.dna > file2.rna cat file2.rna > file2.pep cat file1.pep file2.pep file3.pep > merged.protein
  • 16. If one file is changed $ touch file1.dna file3.pep $ make cat file1.dna > file1.rna cat file1.rna > file1.pep cat file1.pep file2.pep file3.pep > merged.protein
  • 18. "name of the target" : $@ TRANSCRIPT=cat TRANSLATE=cat merged.protein: file1.pep file2.pep file3.pep cat file1.pep file2.pep file3.pep > $@ file1.pep: file1.rna ${TRANSLATE} file1.rna > $@ file1.rna : file1.dna ${TRANSCRIPT} file1.dna > $@ file1.dna: echo "ATGCTAGTAGATGC" > $@
  • 19. "name of the first dependency" : $< TRANSCRIPT=cat TRANSLATE=cat merged.protein: file1.pep file2.pep file3.pep cat file1.pep file2.pep file3.pep > $@ file1.pep: file1.rna ${TRANSLATE} $< > $@ file1.rna : file1.dna ${TRANSCRIPT} $< > $@ file1.dna: echo "ATGCTAGTAGATGC" > $@
  • 20. "all the dependencies" : $^ TRANSCRIPT=cat TRANSLATE=cat merged.protein: file1.pep file2.pep file3.pep cat $^ > $@ file1.pep: file1.rna ${TRANSLATE} $< > $@ file1.rna : file1.dna ${TRANSCRIPT} $< > $@ file1.dna: echo "ATGCTAGTAGATGC" > $@ file2.pep: file2.rna
  • 21. Rules
  • 22. How to create a *.pep or a *.rna ? TRANSCRIPT=cat TRANSLATE=cat %.pep:%.rna ${TRANSLATE} $< > $@ %.rna:%.dna ${TRANSCRIPT} $< > $@ merged.protein: file1.pep file2.pep file3.pep cat $^ > $@ file1.dna: echo "ATGCTAGTAGATGC" > $@ file2.dna: echo "ATGCTAGTAGATGC" > $@ file3.dna: echo "ATGCTAGTAGATGC" > $@
  • 23. Output echo "ATGCTAGTAGATGC" > file1.dna cat file1.dna > file1.rna cat file1.rna > file1.pep echo "ATGCTAGTAGATGC" > file2.dna cat file2.dna > file2.rna cat file2.rna > file2.pep echo "ATGCTAGTAGATGC" > file3.dna cat file3.dna > file3.rna cat file3.rna > file3.pep cat file1.pep file2.pep file3.pep > merged.prot
  • 25. -B "Unconditionally make all targets"
  • 26. -f FILE "Read FILE as a makefile"
  • 27. -j [N] "Allow N jobs at once"
  • 28. -n "Don't actually run any commands; just print them"
  • 29. .PHONY targets .PHONY: all clean all: file1.dna file1.dna: echo "ATGCTAGTAGATGC" > $@ clean: rm -f file1.dna
  • 30. Function Call Syntax $(function arg1,arg2,arg3...)
  • 31. Loops: $(foreach var,list,...) merged.protein: $(foreach INDEX,1 2 3,file${INDEX}.pep ) cat $^ > $@
  • 32. $(eval ) TRANSCRIPT=cat TRANSLATE=cat INDEXES=1 2 3 %.pep:%.rna ${TRANSLATE} $< > $@ %.rna:%.dna ${TRANSCRIPT} $< > $@ merged.protein: $(foreach INDEX,${INDEXES},file${INDEX} cat $^ > $@ $(foreach INDEX,${INDEXES},$(eval file${INDEX}: echo "ATGCTAGTAGATGC" > $$@ ))
  • 33. $(subst ee,EE,feet on the street) ‘fEEt on the strEEt’. $(patsubst %.c,%.o,x.c.c bar.c) ‘x.c.o bar.o’. $(strip a b c ) ‘a b c’
  • 34. $(filter %.c,src1.c src2.c src3.c file.txt) $(filter-out %.c,src1.c src2.c src3.c file.txt) $(sort foo bar lose) $(word 2, foo bar baz) 'bar' $(wordlist 2, 3, foo bar baz) ‘bar baz’. $(firstword foo bar) ‘foo’. $(lastword foo bar) ‘bar’.
  • 35. $(dir src/foo.c hacks) ‘src/ ./’ $(notdir src/foo.c hacks) ‘foo.c hacks’ $(suffix src/foo.c src-1.0/bar.c hacks) ‘.c .c’ $(basename src/foo.c src-1.0/bar hacks) ‘src/foo src-1.0/bar hacks’ $(addsuffix .c,foo bar) ‘foo.c bar.c’. $(addprefix src/,foo bar) ‘src/foo src/bar’
  • 36. (join a b,.c .o) ‘a.c b.o’ $(shell cat file1.txt)
  • 37. END