Skip to content
Per Unneberg edited this page Dec 3, 2013 · 2 revisions

The biomake Makefile library is a collection of rules for commonly used operations in bioinformatics. By using make's built-in include statement, it is easy to reuse rules in different settings.

Anatomy of a makefile

The makefile that includes biomake makefiles should preferably be setup according to the following template:

[
  ...
	  options
  ...
]
[
  ...
	  include statements
  ...
]
[
  ...
	  redefined rules
  ...
]

In other words, the makefile consists of three sections, with the include statements comprising the second section.

options

In the options section, you can set options available in the included makefile. As far as possible, I have used ifndef statements in the included makefile so that if an option is unset, it will always be given a default value. Therefore, if you want to change an option so that it's new value is used in the included makefile, you need to set it before the include statement.

As an example, consider the option THREADS in Makefile.ngsvars. which is defined as

ifndef THREADS
THREADS=8
endif

The THREADS option is actually used by other biomake makefiles, so changing it here will affect more options (e.g. BWA_THREADS in Makefile.bwa, GATK_THREADS in Makefile.gatk).

If you want to change the THREADS option to 16, your Makefile should look like this

THREADS=16
include /path/to/biomake/Makefile.ngsvars

and not

include /path/to/biomake/Makefile.ngsvars
THREADS=16

include statements

In the include statements section, you specify which rules you want to include. For instance, to use bwa, gatk, and picard rules, do

# ... options ...

include /path/to/biomake/Makefile.bwa
include /path/to/biomake/Makefile.gatk
include /path/to/biomake/Makefile.picard

# ... redefined rules ...

redefined rules

Sometimes it is necessary to override the supplied rules (see GNU Make documentation, section 10.5.6 for details on how this works). In order for redefinition to take place, the rules must therefore be applied after the include statements.

Clone this wiki locally