| 1 |
cpp/Makefile | 16 +++++++++++-----
|
| 2 |
1 files changed, 11 insertions(+), 5 deletions(-)
|
| 3 |
|
| 4 |
diff --git a/cpp/Makefile b/cpp/Makefile
|
| 5 |
index 42d03e4..2f4d4f6 100644
|
| 6 |
--- a/cpp/Makefile
|
| 7 |
+++ b/cpp/Makefile
|
| 8 |
@@ -3,7 +3,7 @@
|
| 9 |
# ($Revision: 1.1 $)
|
| 10 |
|
| 11 |
# Compiler
|
| 12 |
-CPP = g++
|
| 13 |
+CPP ?= g++
|
| 14 |
# Output executable
|
| 15 |
EXECUTABLE = vcftools
|
| 16 |
# Flag used to turn on compilation of PCA routines
|
| 17 |
@@ -11,7 +11,7 @@ ifndef VCFTOOLS_PCA
|
| 18 |
VCFTOOLS_PCA = 0
|
| 19 |
endif
|
| 20 |
# Compiler flags
|
| 21 |
-CPPFLAGS = -O2 -Wall -Wextra
|
| 22 |
+CPPFLAGS = -Wall -Wextra
|
| 23 |
#CPPFLAGS = -g
|
| 24 |
# Included libraries (zlib)
|
| 25 |
LIB = -lz
|
| 26 |
@@ -28,15 +28,21 @@ ifeq ($(VCFTOOLS_PCA), 1)
|
| 27 |
# Define flag for PCA routine compilation
|
| 28 |
CPPFLAGS += -DVCFTOOLS_PCA
|
| 29 |
# Add LAPACK library
|
| 30 |
- LIB += -llapack
|
| 31 |
+ LIB += `$(PKG_CONFIG) --libs lapack`
|
| 32 |
# Add PCA source code
|
| 33 |
SOURCES += dgeev.cpp
|
| 34 |
endif
|
| 35 |
|
| 36 |
+objects := $(patsubst %.cpp,%.o,$(SOURCES))
|
| 37 |
+
|
| 38 |
all: vcftools
|
| 39 |
|
| 40 |
-vcftools: $(SOURCES)
|
| 41 |
- $(CPP) $(CPPFLAGS) $(SOURCES) -o $@ $(LIB)
|
| 42 |
+vcftools: $(objects)
|
| 43 |
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(objects) -o $@ $(LIB)
|
| 44 |
+
|
| 45 |
+.cpp.o: $(SOURCES)
|
| 46 |
+ $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o $@ $<
|
| 47 |
+
|
| 48 |
ifdef BINDIR
|
| 49 |
cp $(CURDIR)/$@ $(BINDIR)/$@
|
| 50 |
endif
|