]> git.donarmstrong.com Git - bamtools.git/blobdiff - Makefile
Reorganized source tree & build system
[bamtools.git] / Makefile
index b3d285b6027df0d7155075cab97200d53787c7f6..033c6628f77e8dc5a49aa0e37df3a516a3844d8d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,33 +1,41 @@
-CXX=           g++\r
-CXXFLAGS=      -Wall -O3 -D_FILE_OFFSET_BITS=64\r
-PROG=          bamtools\r
-API=           BGZF.o \
-               BamIndex.o \
-               BamReader.o \
-               BamWriter.o \
-               BamMultiReader.o
-UTILS=         bamtools_fasta.o \
-               bamtools_options.o \
-               bamtools_pileup.o \
-               bamtools_utilities.o
-TOOLKIT=       bamtools_convert.o \
-               bamtools_count.o \
-               bamtools_coverage.o \
-               bamtools_filter.o \
-               bamtools_header.o \
-               bamtools_index.o \
-               bamtools_merge.o \
-               bamtools_random.o \
-               bamtools_sort.o \
-               bamtools_stats.o
-MAIN=          bamtools.o
-OBJS=          $(API) $(UTILS) $(TOOLKIT) $(MAIN)
-LIBS=          -lz
-\r
-all: $(PROG)\r
-\r
-bamtools: $(OBJS)\r
-       $(CXX) $(CXXFLAGS) -o $@ $(OBJS) $(LIBS)
-\r
-clean:\r
-       rm -fr gmon.out *.o *.a a.out *~\r
+# ==========================
+# BamTools Makefile
+# (c) 2010 Derek Barnett
+# ==========================
+
+# define main directories
+export OBJ_DIR  = obj
+export BIN_DIR  = bin
+export SRC_DIR  = src
+
+# define compile/link flags
+export CXX      = g++\r
+export CXXFLAGS = -Wall -O3 -D_FILE_OFFSET_BITS=64
+export LIBS     = -lz
+
+# define current BamTools version
+export BAMTOOLS_VERSION = 0.7.0812
+
+# define source subdirectories
+SUBDIRS = $(SRC_DIR)/api \
+          $(SRC_DIR)/utils \
+          $(SRC_DIR)/toolkit
+
+all:
+       @echo "Building BamTools:"
+       @echo "Version: $$BAMTOOLS_VERSION"
+       @echo "========================================================="
+       
+       @for dir in $(SUBDIRS); do \
+               echo "- Building in $$dir"; \
+               $(MAKE) --no-print-directory -C $$dir; \
+               echo ""; \
+       done
+
+.PHONY: all
+
+clean:
+       @echo "Cleaning up."
+       @rm -f $(OBJ_DIR)/* $(BIN_DIR)/*
+
+.PHONY: clean