Makefile 2.86 KB
Newer Older
1
2
3
4
5
# ==========================
# BEDTools Makefile
# (c) 2009 Aaron Quinlan
# ==========================

Aaron's avatar
Aaron committed
6
7
SHELL := /bin/bash -e

8
# define our object and binary directories
Aaron's avatar
Aaron committed
9
10
11
export OBJ_DIR	= obj
export BIN_DIR	= bin
export SRC_DIR	= src
Aaron's avatar
Aaron committed
12
export UTIL_DIR	= src/utils
Aaron's avatar
Aaron committed
13
export CXX		= g++
Aaron's avatar
Aaron committed
14
export CXXFLAGS = -Wall -O2 -D_FILE_OFFSET_BITS=64 -fPIC
Aaron's avatar
Aaron committed
15
export LIBS		= -lz
16
export BT_ROOT  = src/utils/BamTools/
17
18


Aaron's avatar
Aaron committed
19
SUBDIRS = $(SRC_DIR)/annotateBed \
Aaron's avatar
Aaron committed
20
21
		  $(SRC_DIR)/bamToBed \
		  $(SRC_DIR)/bedToBam \
Aaron's avatar
Aaron committed
22
		  $(SRC_DIR)/bedpeToBam \
Aaron's avatar
Aaron committed
23
24
25
		  $(SRC_DIR)/bedToIgv \
		  $(SRC_DIR)/bed12ToBed6 \
		  $(SRC_DIR)/closestBed \
26
		  $(SRC_DIR)/clusterBed \
Aaron's avatar
Aaron committed
27
28
29
		  $(SRC_DIR)/complementBed \
		  $(SRC_DIR)/coverageBed \
		  $(SRC_DIR)/fastaFromBed \
Aaron's avatar
Aaron committed
30
		  $(SRC_DIR)/flankBed \
Aaron's avatar
Aaron committed
31
		  $(SRC_DIR)/genomeCoverageBed \
32
33
		  $(SRC_DIR)/getOverlap \
		  $(SRC_DIR)/groupBy \
Aaron's avatar
Aaron committed
34
35
36
		  $(SRC_DIR)/intersectBed \
		  $(SRC_DIR)/linksBed \
		  $(SRC_DIR)/maskFastaFromBed \
37
		  $(SRC_DIR)/mapBed \
38
		  $(SRC_DIR)/mergeBed \
39
		  $(SRC_DIR)/multiBamCov \
40
		  $(SRC_DIR)/multiIntersectBed \
41
		  $(SRC_DIR)/nucBed \
Aaron's avatar
Aaron committed
42
43
44
45
46
47
		  $(SRC_DIR)/pairToBed \
		  $(SRC_DIR)/pairToPair \
		  $(SRC_DIR)/shuffleBed \
		  $(SRC_DIR)/slopBed \
		  $(SRC_DIR)/sortBed \
		  $(SRC_DIR)/subtractBed \
Aaron's avatar
Aaron committed
48
		  $(SRC_DIR)/tagBam \
Aaron's avatar
Aaron committed
49
		  $(SRC_DIR)/unionBedGraphs \
Aaron's avatar
Aaron committed
50
51
		  $(SRC_DIR)/windowBed \
		  $(SRC_DIR)/windowMaker
52

53
UTIL_SUBDIRS =	$(SRC_DIR)/utils/bedFile \
Aaron's avatar
Aaron committed
54
				$(SRC_DIR)/utils/bedGraphFile \
55
				$(SRC_DIR)/utils/chromsweep \
Aaron's avatar
Aaron committed
56
57
58
59
				$(SRC_DIR)/utils/gzstream \
				$(SRC_DIR)/utils/fileType \
				$(SRC_DIR)/utils/bedFilePE \
				$(SRC_DIR)/utils/sequenceUtilities \
60
				$(SRC_DIR)/utils/tabFile \
61
				$(SRC_DIR)/utils/BamTools \
62
				$(SRC_DIR)/utils/BamTools-Ancillary \
63
				$(SRC_DIR)/utils/BlockedIntervals \
64
				$(SRC_DIR)/utils/Fasta \
Aaron's avatar
Aaron committed
65
				$(SRC_DIR)/utils/VectorOps \
66
				$(SRC_DIR)/utils/genomeFile
67

Aaron's avatar
Aaron committed
68
BUILT_OBJECTS = $(OBJ_DIR)/*.o
Aaron's avatar
Aaron committed
69

Aaron's avatar
Aaron committed
70

71
all:
Aaron's avatar
Aaron committed
72
73
74
75
76
77
78
79
80
81
82
	[ -d $(OBJ_DIR) ] || mkdir -p $(OBJ_DIR)
	[ -d $(BIN_DIR) ] || mkdir -p $(BIN_DIR)
	
	@echo "Building BEDTools:"
	@echo "========================================================="
	
	@for dir in $(UTIL_SUBDIRS); do \
		echo "- Building in $$dir"; \
		$(MAKE) --no-print-directory -C $$dir; \
		echo ""; \
	done
83

Aaron's avatar
Aaron committed
84
85
86
87
88
	@for dir in $(SUBDIRS); do \
		echo "- Building in $$dir"; \
		$(MAKE) --no-print-directory -C $$dir; \
		echo ""; \
	done
89

Aaron's avatar
Aaron committed
90
	@echo "- Building main bedtools binary."
91
	@$(CXX) $(CXXFLAGS) -c src/bedtools.cpp -o obj/bedtools.o -I$(UTIL_DIR)/version/
Aaron's avatar
Aaron committed
92
	@$(CXX) $(LDFLAGS) $(CXXFLAGS) -o $(BIN_DIR)/bedtools $(BUILT_OBJECTS) -L$(UTIL_DIR)/BamTools/lib/ -lbamtools $(LIBS)
93
94
95
96
97
98
	@echo "done."
	
	@echo "- Creating executables for old CLI."
	@python scripts/makeBashScripts.py
	@chmod +x bin/*
	@echo "done."
Aaron's avatar
Aaron committed
99
	
100

101
102
103
.PHONY: all

clean:
104
	@echo "Cleaning up."	
Aaron's avatar
Aaron committed
105
	@rm -f $(OBJ_DIR)/* $(BIN_DIR)/*
106
	@rm -Rf $(BT_ROOT)/lib
Aaron's avatar
Aaron committed
107
	@rm -f $(BT_ROOT)/src/api/*.o
108
	@rm -f $(BT_ROOT)/src/api/internal/*/*.o
109
	@rm -Rf $(BT_ROOT)/include
110
111

.PHONY: clean
112

Aaron's avatar
Aaron committed
113
test: all
114
115
	@cd test; sh test.sh

Aaron's avatar
Aaron committed
116
.PHONY: test