Makefile 3.3 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)/mergeBed \
38
		  $(SRC_DIR)/multiBamCov \
39
		  $(SRC_DIR)/multiIntersectBed \
40
		  $(SRC_DIR)/nucBed \
Aaron's avatar
Aaron committed
41
42
43
44
45
46
		  $(SRC_DIR)/pairToBed \
		  $(SRC_DIR)/pairToPair \
		  $(SRC_DIR)/shuffleBed \
		  $(SRC_DIR)/slopBed \
		  $(SRC_DIR)/sortBed \
		  $(SRC_DIR)/subtractBed \
Aaron's avatar
Aaron committed
47
		  $(SRC_DIR)/tagBam \
Aaron's avatar
Aaron committed
48
		  $(SRC_DIR)/unionBedGraphs \
Aaron's avatar
Aaron committed
49
50
		  $(SRC_DIR)/windowBed \
		  $(SRC_DIR)/windowMaker
51

Aaron's avatar
Aaron committed
52
53
54
UTIL_SUBDIRS =	$(SRC_DIR)/utils/lineFileUtilities \
				$(SRC_DIR)/utils/bedFile \
				$(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
64
				$(SRC_DIR)/utils/Fasta \
				$(SRC_DIR)/utils/genomeFile
65

Aaron's avatar
Aaron committed
66
BUILT_OBJECTS = $(OBJ_DIR)/*.o
Aaron's avatar
Aaron committed
67
68
69
70
71
72
73
74
75
76
77
78
79
# BUILT_OBJECTS = $(OBJ_DIR)/bedtools.o \
# 				$(OBJ_DIR)/BamAncillary.o \
#                 $(OBJ_DIR)/Fasta.o \
#                 $(OBJ_DIR)/bedFile.o \
#                 $(OBJ_DIR)/bedFilePE.o \
#                 $(OBJ_DIR)/bedGraphFile.o \
#                 $(OBJ_DIR)/chromsweep.o \
#                 $(OBJ_DIR)/fileType.o \
#                 $(OBJ_DIR)/gzstream.o \
#                 $(OBJ_DIR)/sequenceUtils.o \
#                 $(OBJ_DIR)/split.o \
#                 $(OBJ_DIR)/intersectBed.o \
#                 $(OBJ_DIR)/intersectMain.o \
Aaron's avatar
Aaron committed
80

81
all:
Aaron's avatar
Aaron committed
82
83
84
85
86
87
88
89
90
91
92
	[ -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
93

Aaron's avatar
Aaron committed
94
95
96
97
98
	@for dir in $(SUBDIRS); do \
		echo "- Building in $$dir"; \
		$(MAKE) --no-print-directory -C $$dir; \
		echo ""; \
	done
99

Aaron's avatar
Aaron committed
100
	@echo "- Building main bedtools binary."
101
	@$(CXX) $(CXXFLAGS) -c src/bedtools.cpp -o obj/bedtools.o -I$(UTIL_DIR)/version/
Aaron's avatar
Aaron committed
102
	@$(CXX) $(LDFLAGS) $(CXXFLAGS) -o $(BIN_DIR)/bedtools $(BUILT_OBJECTS) -L$(UTIL_DIR)/BamTools/lib/ -lbamtools $(LIBS)
103
104
105
106
107
108
	@echo "done."
	
	@echo "- Creating executables for old CLI."
	@python scripts/makeBashScripts.py
	@chmod +x bin/*
	@echo "done."
Aaron's avatar
Aaron committed
109
	
110

111
112
113
.PHONY: all

clean:
114
	@echo "Cleaning up."	
Aaron's avatar
Aaron committed
115
	@rm -f $(OBJ_DIR)/* $(BIN_DIR)/*
116
	@rm -Rf $(BT_ROOT)/lib
Aaron's avatar
Aaron committed
117
	@rm -f $(BT_ROOT)/src/api/*.o
Aaron's avatar
Aaron committed
118
	@rm -f $(BT_ROOT)/src/api/internal/*.o
119
	@rm -Rf $(BT_ROOT)/include
120
121

.PHONY: clean