SlideShare una empresa de Scribd logo
1 de 37
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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 테스트전략
 

Similar a 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
 

Similar a 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
 

Más de 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
 

Más de 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
 

Último

Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 

Último (20)

Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

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