I am new to programming under linux and not familiar with makefiles since MSVC-Express hides such things very well. But now i wanted to play with some code I found, but it won't compile in qtcreator. But with the makefile in the package i can successfully compile and use it. So all dependencies (libraries and headerfiles) must be correctly installed but in the .pro file there must be something missing.
Maybe some on can help me out and give me some hints how to find the missing settings.
working makefile:
# Defining the compiler:
CC = g++
CUDACC = nvcc
SRCPATH=src
OBJPATH=obj
LIBPATH=lib
BINPATH=bin
OPTIMIZATION_LEVEL=-O3
DEBUG= #-Wall -g #-pg
DEBUG_CUDA = #-g --ptxas-options=-v #-deviceemu
SWITCHES= -msse2 -flax-vector-conversions
nj_cuda : SWITCHES += -DENABLEGPU
INCLUDES= -Isrc/distanceCalculation -Isrc/bootstrapping -Isrc/
nj_cuda : INCLUDES += -I /usr/local/cuda/include -Isrc/distanceCalculation/gpu
#use -pg for gprof profiling in both steps
# Defining the object files:
objects = $(OBJPATH)/main.o $(OBJPATH)/node.o $(OBJPATH)/distMatrixReader.o $(OBJPATH)/sortedNJ.o $(OBJPATH)/polytree.o $(OBJPATH)/diskMatrix.o $(OBJPATH)/rapidDisk.o $(OBJPATH)/rdDataInitialiser.o $(OBJPATH)/sortedRedundantNJ.o $(OBJPATH)/rapidDiskRedundant.o $(OBJPATH)/rapidNJMem.o $(OBJPATH)/rapidNJMemRedundant.o $(OBJPATH)/simpleNJ.o $(OBJPATH)/testNJ.o $(OBJPATH)/distanceCalculation/dnaBitString.o $(OBJPATH)/distanceCalculation/dataloaderPhylip.o $(OBJPATH)/distanceCalculation/hammingDistance.o $(OBJPATH)/distanceCalculation/bitDistanceNoGap.o $(OBJPATH)/distanceCalculation/bitDistanceGap.o $(OBJPATH)/distanceCalculation/JCdistance.o $(OBJPATH)/distanceCalculation/simpleDistanceCalculator.o $(OBJPATH)/distanceCalculation/dataloader.o $(OBJPATH)/distanceCalculation/KimuraDistance.o $(OBJPATH)/distanceCalculation/bitDistance.o $(OBJPATH)/distanceCalculation/bitDistanceProtein.o $(OBJPATH)/distanceCalculation/bitDistanceProteinPopCnt.o $(OBJPATH)/distanceCalculation/bitDistanceGapPopCnt.o $(OBJPATH)/bootstrapping/bootstrapper.o
objects_cuda = $(OBJPATH)/distanceCalculation/gpu/distanceCalculatorDNA_gpu.o $(OBJPATH)/distanceCalculation/gpu/distanceCalculatorProtein_gpu.o
all: nj
echo all: make complete
nj: $(objects)
$(CC) $(DEBUG) $(SWITCHES) $(OPTIMIZATION_LEVEL) -lpthread -lboost_program_options -o $(BINPATH)/$@ $+
nj_cuda: $(objects_cuda) $(objects)
$(CUDACC) $(DEBUG_CUDA) $(OPTIMIZATION_LEVEL) -lpthread -lboost_program_options -o $(BINPATH)/$@ $+
$(OBJPATH)/%.o: $(SRCPATH)/%.cu
$(CUDACC) $(DEBUG_CUDA) $(INCLUDES) $(OPTIMIZATION_LEVEL) -o $@ -c $<
# compile to objectfiles
$(OBJPATH)/%.o: $(SRCPATH)/%.cpp
$(CC) $(DEBUG) $(SWITCHES) $(OPTIMIZATION_LEVEL) $(INCLUDES) -o $@ -c $<
# clean target
clean:
-rm $(OBJPATH)/*.o
-rm $(OBJPATH)/distanceCalculation/*.o
-rm $(OBJPATH)/bootstrapping/*.o
-rm $(BINPATH)/*
echo clean: make complete
release:
mkdir rapidNJ
cp -R src rapidNJ/
cp -R obj rapidNJ/
cp -R bin rapidNJ/
cp Makefile rapidNJ/
find . -name "*.~" -exec rm {} \;
zip rapidNJ.zip rapidNJ/INSTALL rapidNJ/Makefile rapidNJ/src/* rapidNJ/src/distanceCalculation/* rapidNJ/src/distanceCalculation/gpu/* rapidNJ/src/bootstrapping/* rapidNJ/obj rapidNJ/obj/distanceCalculation rapidNJ/obj/distanceCalculation/gpu rapidNJ/obj/bootstrapping rapidNJ/bin
rm -Rf rapidNJ/
util:
g++ -O3 src/distanceCalculation/sim_seq.cpp -o bin/sim_seq
#Make sure that make rebuilds files if included headers change:
$(objects): $(SRCPATH)/stdinclude.h $(SRCPATH)/sortedNJ.h $(SRCPATH)/polytree.h $(SRCPATH)/rapidDisk.h $(SRCPATH)/diskMatrix.h $(SRCPATH)/rdDataInitialiser.h $(SRCPATH)/distMatrixReader.hpp $(SRCPATH)/node.h $(SRCPATH)/sortedRedundantNJ.h $(SRCPATH)/rapidDiskRedundant.h $(SRCPATH)/rapidNJMem.h $(SRCPATH)/rapidNJMemRedundant.hpp $(SRCPATH)/simpleNJ.h $(SRCPATH)/testNJ.h $(SRCPATH)/distanceCalculation/dataloader.hpp $(SRCPATH)/distanceCalculation/hammingDistance.hpp $(SRCPATH)/distanceCalculation/bitDistanceNoGap.hpp $(SRCPATH)/distanceCalculation/bitDistanceGap.hpp $(SRCPATH)/distanceCalculation/dnaBitString.hpp $(SRCPATH)/distanceCalculation/JCdistance.hpp $(SRCPATH)/distanceCalculation/simpleDistanceCalculator.hpp $(SRCPATH)/distanceCalculation/dataloaderStockholm.hpp $(SRCPATH)/distanceCalculation/dataloaderPhylip.hpp $(SRCPATH)/distanceCalculation/KimuraDistance.hpp $(SRCPATH)/distanceCalculation/bitStringUtils.hpp $(SRCPATH)/distanceCalculation/bitDistance.hpp $(SRCPATH)/distanceCalculation/bitDistanceProtein.hpp $(SRCPATH)/distanceCalculation/dataloaderMemory.hpp $(SRCPATH)/distanceCalculation/bitDistanceProteinPopCnt.hpp $(SRCPATH)/distanceCalculation/bitDistanceGapPopCnt.hpp $(SRCPATH)/bootstrapping/bootstrapper.hpp $(SRCPATH)/distanceCalculation/gpu/constants.hpp
.pro file and makefile from qtcreator which doesn't work:
#-------------------------------------------------
#
# Project created by QtCreator 2010-08-13T16:54:50
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = rapidNJ
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp \
distMatrixReader.cpp \
diskMatrix.cpp \
threadedNJ.cpp \
testNJ.cpp \
sortedRedundantNJ.cpp \
sortedNJ.cpp \
simpleNJ.cpp \
rdDataInitialiser.cpp \
rapidNJMemRedundant.cpp \
node.cpp \
ninjaComparator.cpp \
rapidNJMem.cpp \
rapidDiskRedundant.cpp \
rapidDisk.cpp \
polytree.cpp \
distanceCalculation/simpleDistanceCalculator.cpp \
distanceCalculation/sim_seq.cpp \
distanceCalculation/KimuraDistance.cpp \
distanceCalculation/JCdistance.cpp \
distanceCalculation/hammingDistance.cpp \
distanceCalculation/dnaBitString.cpp \
distanceCalculation/dataloaderPhylip.cpp \
distanceCalculation/dataloader.cpp \
distanceCalculation/bitDistanceProteinPopCnt.cpp \
distanceCalculation/bitDistanceProtein.cpp \
distanceCalculation/bitDistanceNoGap.cpp \
distanceCalculation/bitDistanceGapPopCnt.cpp \
distanceCalculation/bitDistanceGap.cpp \
distanceCalculation/bitDistance.cpp \
distanceCalculation/gpu/distanceCalculatorProtein_gpu.cu \
distanceCalculation/gpu/distanceCalculatorDNA_gpu.cu \
bootstrapping/bootstrapper.cpp
OTHER_FILES += \
#distMatrixReader.cpp%23 \
ninjaComparator.cpp~ \
Makefile \
rapidNJ.pro.user \
distanceCalculation/dataloaderMemory.hpp~
HEADERS += \
distMatrixReader.hpp \
diskMatrix.h \
cluster_pair.h \
threadedNJ.h \
testNJ.h \
stdinclude.h \
sortedRedundantNJ.h \
sortedNJ.h \
simpleNJ.h \
rdDataInitialiser.h \
rapidNJMemRedundant.hpp \
minFinder.h \
rapidNJMem.h \
rapidDiskRedundant.h \
rapidDisk.h \
polytree.h \
node.h \
distanceCalculation/simpleDistanceCalculator.hpp \
distanceCalculation/KimuraDistance.hpp \
distanceCalculation/JCdistance.hpp \
distanceCalculation/hammingDistance.hpp \
distanceCalculation/dnaBitString.hpp \
distanceCalculation/dataloaderStockholm.hpp \
distanceCalculation/dataloaderPhylip.hpp \
distanceCalculation/dataloaderMemory.hpp \
distanceCalculation/dataloader.hpp \
distanceCalculation/bitStringUtils.hpp \
distanceCalculation/bitDistanceProteinPopCnt.hpp \
distanceCalculation/bitDistanceProtein.hpp \
distanceCalculation/bitDistanceNoGap.hpp \
distanceCalculation/bitDistanceGapPopCnt.hpp \
distanceCalculation/bitDistanceGap.hpp \
distanceCalculation/bitDistance.hpp \
distanceCalculation/gpu/cutil_inline_runtime.h \
distanceCalculation/gpu/cutil_inline.h \
distanceCalculation/gpu/cutil_inline_drvapi.h \
distanceCalculation/gpu/cutil_inline_bankchecker.h \
distanceCalculation/gpu/cutil.h \
distanceCalculation/gpu/constants.hpp \
bootstrapping/bootstrapper.hpp
INCLUDEPATH += \
bootstrapping \
distanceCalculation \
/usr/include/boost/program_options \
/usr/include/boost
thanks in advance