Skip to content

Instantly share code, notes, and snippets.

@claczny
Created August 25, 2017 12:11
Show Gist options
  • Save claczny/dde3d1a6ce3afa47f240fb885c661562 to your computer and use it in GitHub Desktop.
Save claczny/dde3d1a6ce3afa47f240fb885c661562 to your computer and use it in GitHub Desktop.
Skeleton of a Makefile
SHELL = /bin/bash
DDIR = data
RDIR = results
SDIR = src
SAMPLES = S1 S2 S3
DOUBLED_SAMPLES = $(foreach sample, $(SAMPLES), $(sample)/$(sample))
####################
# BEAUTY TARGETS
#########################
.PHONY: all
all:
get_data: $(addprefix $(DDIR)/, $(SAMPLES:=.tar.gz))
run_program: $(addprefix $(RDIR)/program/, $(DOUBLED_SAMPLES:=.new.fa))
####################
# ACTUAL TARGETS
####################
$(DDIR)/%.gz:
mkdir -p $(dir $@)
wget URL/$*.tar.gz -O $@
.SECONDEXPANSION:
$(RDIR)/program/%.new.fa: $(DDIR)/$$(notdir $$*).fa
@echo "###### RUNNING program - $(notdir $*) ######"
@date
mkdir -p $(dir $@)
(date &&\
$(PROGRAM_BIN) -i $^ -o $@ &&\
date) 2>$(dir $@)/program.stderr 1>$(dir $@)/program.stdout
@date
@echo "##########"
@echo
####################
# CLEAN-UP
####################
clean:
@echo "TODO: clean"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment