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