Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
315 lines (269 sloc) 9.79 KB
########################################################################
# Makefile for static compilation Stimfit
# no auto-tools (autoconf, automake, libtool, shave etc.) are needed.
#
# No global installation (sudo make install) is needed, but
# stimfit can be started immediately after compilation.
#
# This is most useful for debugging, when several instances of stimfit
# should be available.
#
# Usage:
# cd ~/src/stimfit/ # change into stimfit's root directory
# make -f Makefile.static # build stimfit
# make -B -f Makefile.static # rebuild everything
#
# WXCONF=/usr/bin/wx-config make -f Makefile.static
# # build built with non-default WX
#
# PREFIX=/usr/local make -f Makefile.static
# search for libhdf5 in ${PREFIX}/{include,lib}
#
# ./stimfit # start stimfit
#
# win32 built
# CROSS=i686-pc-mingw32- make -f Makefile.static
# WXCONF=i686-pc-mingw32-wx-config make -f Makefile.static
# win64 built
# CROSS=x86_64-static-mingw32- make -f Makefile.static
# WXCONF=x86_64-static-mingw32-wx-config make -f Makefile.static
#
# The use of WXCONF is deprecated, and might be removed in future
# Limitations:
# - no support for ASCII, SON format
# - PYTHON shell, matplotlib (print) are not supported
# - configure not supported
#
# Copyright (C) 2012,2013,2014,2015 Alois Schloegl
# This is part of the stimfit project http://stimfit.org
#
########################################################################
ifeq (,$(WXCONF))
# default wx-config
WXCONF = $(CROSS)wx-config
else
ifneq (,$(findstring mingw,$(WXCONF)))
# for backwords compatibility to older MXE scripts
CROSS = $(subst wx-config,,$(WXCONF))
endif
endif
DEFINES += -DWITH_BIOSIG2
DEFINES += -DHAVE_LAPACK
#DEFINES += -DWITHOUT_ABF
#DEFINES += -DWITHOUT_AXG
DEFINES += -DWITH_PSLOPE
#DEFINES += -DTEST_MINIMAL
#DEFINES += -DPYTHON -DWITH_PYTHON
WXVERSION = $(basename $(shell $(WXCONF) --version))
#WXDIR = $(dir $(WXCONF))../include/wx-$(WXVERSION)/
WXDIR = $(dir $(WXCONF))../include/
#DEFINES += -I$(WXDIR)
#DEFINES += -I$(WXDIR)/..
PY_VERSION := 2.7
##############################################################
### SOURCES
##############################################################
vpath %.cpp ./src/stimfit:./src/stimfit/gui:./src/stimfit/gui/dlgs:./src/stimfit/gui/usrdlg:./src/libstfnum:./src/libstfio/:./src/libstfio/cfs/:./src/libstfio/atf/:./src/libstfio/abf/:./src/libstfio/abf/axon2:./src/libstfio/abf/axon/Common:./src/libstfio/abf/axon/AxAbfFio32:./src/libstfio/abf/axon/AxAtfFio32/:./src/libstfio/biosig/:./src/libstfio/hdf5/:./src/libstfio/heka/:./src/libstfio/igor:./src/libstfio/ascii/:./src/libstfio/axg/
vpath %.c ./src/libstfnum/levmar/:./src/libstfio/igor/:./src/libstfio/cfs/
vpath %.cpp ./src/libstfnum/:./src/libstfnum/levmar/:./src/stimfit/gui/:./src/stimfit/gui/dlgs/:./src/libstfio/:./src/libstfio/biosig/:./src/libstfio/igor/:./src/libstfio/cfs/
SOURCES = ./src/stimfit/stf.cpp \
./src/libstfnum/stfnum.cpp \
./src/libstfnum/funclib.cpp \
./src/libstfnum/measure.cpp \
./src/libstfnum/fit.cpp \
./src/libstfnum/levmar/lm.c \
./src/libstfnum/levmar/Axb.c \
./src/libstfnum/levmar/misc.c \
./src/libstfnum/levmar/lmbc.c \
./src/libstfnum/levmar/lmlec.c \
./src/stimfit/gui/doc.cpp \
./src/stimfit/gui/zoom.cpp \
./src/stimfit/gui/childframe.cpp \
./src/stimfit/gui/app.cpp \
./src/stimfit/gui/parentframe.cpp \
./src/stimfit/gui/dlgs/convertdlg.cpp \
./src/stimfit/gui/dlgs/cursorsdlg.cpp \
./src/stimfit/gui/dlgs/eventdlg.cpp \
./src/stimfit/gui/dlgs/smalldlgs.cpp \
./src/stimfit/gui/dlgs/fitseldlg.cpp \
./src/stimfit/gui/copygrid.cpp \
./src/stimfit/gui/usrdlg/usrdlg.cpp \
./src/stimfit/gui/graph.cpp \
./src/stimfit/gui/unopt.cpp \
./src/stimfit/gui/view.cpp \
./src/stimfit/gui/table.cpp \
./src/stimfit/gui/printout.cpp \
./src/stimfit/gui/main.cpp \
./src/libstfio/igor/igorlib.cpp \
./src/libstfio/cfs/cfslib.cpp \
./src/libstfio/section.cpp \
./src/libstfio/recording.cpp \
./src/libstfio/hdf5/hdf5lib.cpp \
./src/libstfio/intan/intanlib.cpp \
./src/libstfio/intan/common.cpp \
./src/libstfio/intan/streams.cpp \
./src/libstfio/channel.cpp \
./src/libstfio/stfio.cpp \
./src/libstfio/igor/WriteWave.c \
./src/libstfio/igor/CrossPlatformFileIO.c \
./src/libstfio/cfs/cfs.c
SOURCES_OPTIONAL = \
./src/libstfio/heka/hekalib.cpp \
SOURCES_ABF = ./src/libstfio/atf/atflib.cpp \
./src/libstfio/abf/abflib.cpp \
./src/libstfio/abf/axon2/ProtocolReaderABF2.cpp \
./src/libstfio/abf/axon2/abf2headr.cpp \
./src/libstfio/abf/axon2/SimpleStringCache.cpp \
./src/libstfio/abf/axon/Common/FileReadCache.cpp \
./src/libstfio/abf/axon/Common/unix.cpp \
./src/libstfio/abf/axon/Common/FileIO.cpp \
./src/libstfio/abf/axon/AxAtfFio32/axatffio32.cpp \
./src/libstfio/abf/axon/AxAtfFio32/fileio2.cpp \
./src/libstfio/abf/axon/AxAbfFio32/abferror.cpp \
./src/libstfio/abf/axon/AxAbfFio32/abfheadr.cpp \
./src/libstfio/abf/axon/AxAbfFio32/filedesc.cpp \
./src/libstfio/abf/axon/AxAbfFio32/msbincvt.cpp \
./src/libstfio/abf/axon/AxAbfFio32/abfutil.cpp \
./src/libstfio/abf/axon/AxAbfFio32/abffiles.cpp \
./src/libstfio/abf/axon/AxAbfFio32/Oldheadr.cpp \
./src/libstfio/abf/axon/AxAbfFio32/abfhwave.cpp \
./src/libstfio/abf/axon/AxAbfFio32/csynch.cpp
EXCLUDED = ./src/libstfio/ascii/asciilib.cpp \
./src/libstfio/abf/axon/AxAtfFio32/fileio2.cpp \
./src/libstfnum/levmar/lmbc_core.c \
./src/libstfnum/levmar/lmlec_core.c \
./src/libstfnum/levmar/misc_core.c \
./src/libstfnum/levmar/lm_core.c \
./src/libstfnum/levmar/Axb_core.c \
./src/stimfit/gui/dclatex.cpp \
TESTSRC = ./src/test/section.cpp \
./src/test/recording.cpp \
./src/test/measure.cpp \
./src/test/channel.cpp \
./src/test/gtest/src/gtest.cc \
./src/test/gtest/src/gtest-port.cc \
./src/test/gtest/src/gtest-test-part.cc \
./src/test/gtest/src/gtest-typed-test.cc \
./src/test/gtest/src/gtest.cc \
./src/test/gtest/src/gtest-printers.cc \
./src/test/gtest/src/gtest-death-test.cc \
./src/test/gtest/src/gtest-all.cc \
./src/test/gtest/src/gtest_main.cc \
./src/test/gtest/src/gtest-filepath.cc
SOURCES_AXG = ./src/libstfio/axg/axglib.cpp \
./src/libstfio/axg/AxoGraph_ReadWrite.cpp \
./src/libstfio/axg/fileUtils.cpp \
./src/libstfio/axg/stringUtils.cpp \
./src/libstfio/axg/byteswap.cpp \
### DEPENDENCIES ###
ifneq (,$(findstring HAVE_LAPACK, $(DEFINES)))
LIBS += -llapack -lblas
endif
ifeq (,$(findstring WITHOUT_ABF, $(DEFINES)))
SOURCES += $(SOURCES_ABF)
endif
ifeq (,$(findstring WITHOUT_AXG, $(DEFINES)))
SOURCES += $(SOURCES_AXG)
endif
ifeq (,$(findstring mingw, $(WXCONF)))
TARGET = stimfit
OBJEXT = o
else
### MINGW ###
TARGET = stimfit.exe
OBJEXT = obj
endif
ifeq (,$(findstring TEST_MINIMAL, $(DEFINES)))
SOURCES += $(SOURCES_OPTIONAL)
endif
ifneq (,$(findstring WITH_PYTHON, $(DEFINES)))
SOURCES += ./src/stimfit/py/pystf.cxx ./src/stimfit/py/pystf_wrap.cxx ./src/pystfio/pystfio.cxx
DEFINES += -I/usr/include/python$(PY_VERSION)
DEFINES += -I/usr/lib/pymodules/python$(PY_VERSION)/numpy/core/include
LDFLAGS += -L/usr/lib/python$(PY_VERSION)/
LIBS += -lpython$(PY_VERSION)
endif
CC ?= $(shell $(WXCONF) --cc)
CXX ?= $(shell $(WXCONF) --cxx)
CFLAGS = $(DEFINES) $(shell $(WXCONF) --cflags) -fstack-protector -O2
CPPFLAGS = $(DEFINES) $(shell $(WXCONF) --cppflags) -std=gnu++11 -fstack-protector -O2
CXXFLAGS = $(DEFINES) $(shell $(WXCONF) --cxxflags) -std=gnu++11 -fstack-protector -O2
LIBS += $(shell $(WXCONF) --libs net,adv,aui,core,base)
PREFIX ?= /usr
PKGCONF ?= $(CROSS)pkg-config
ifeq (5,$(shell $(CXX) -v 2>&1 | awk '/gcc version / {print substr($$3,1,1)}' ))
# g++-5 changes default ABI, if WX was compiled with an earlier compiler
CXXFLAGS += -fabi-version=2
endif
CPPFLAGS += -I$(WXDIR)
## HDF5 related stuff ##
ifneq ($(CROSS),)
## Debian/Wheezy
LIBS += -lhdf5_hl -lhdf5
else
ifneq ($(wildcard /usr/lib/libhdf5*),)
## Debian/Wheezy
CPPFLAGS += -I$(PREFIX)/include
LIBS += -lhdf5_hl -lhdf5
else ifneq ($(wildcard $(PREFIX)/$(TARGET)/lib/libhdf5*),)
CPPFLAGS += -I$(PREFIX)/$(TARGET)/include
CXXFLAGS += -I$(PREFIX)/$(TARGET)/include
LDFLAGS += -L$(PREFIX)/$(TARGET)/lib
LIBS += -lhdf5_hl -lhdf5
else ifneq ($(wildcard $(PREFIX)/lib/libhdf5*),)
CPPFLAGS += -I$(PREFIX)/include
CXXFLAGS += -I$(PREFIX)/include
LDFLAGS += -L$(PREFIX)/lib
LIBS += -lhdf5_hl -lhdf5
else
PLATFORM = $(shell dpkg-architecture -q DEB_TARGET_MULTIARCH)
ifneq ($(wildcard /usr/lib/$(PLATFORM)/libhdf5_serial*),)
## Debian/Jessie
CPPFLAGS += -I/usr/include/hdf5/serial
LDFLAGS += -L/usr/lib/$(PLATFORM)
LIBS += -lhdf5_serial_hl -lhdf5_serial
else
LIBS += -lhdf5_hl -lhdf5
endif
endif
endif
## BIOSIG related stuff ##
ifneq (,$(findstring WITH_BIOSIG2, $(DEFINES)))
LIBS += -lbiosig2
else
ifneq (,$(findstring WITH_BIOSIG, $(DEFINES)))
LIBS += -lbiosig
endif
endif
ifneq (,$(findstring WITH_BIOSIG, $(DEFINES)))
SOURCES += ./src/libstfio/biosig/biosiglib.cpp
LIBS += $(shell $(PKGCONF) --libs libbiosig)
endif
LIBS += -lfftw3
ifeq (mingw,$(findstring mingw, $(WXCONF)))
LIBS += -lgfortran -lquadmath
LIBS += -liberty -liconv
endif
##############################################################
### BUILT
##############################################################
OBJECTS = $(addsuffix .$(OBJEXT), $(basename $(SOURCES)))
$(TARGET): $(OBJECTS)
$(CXX) $(OBJECTS) $(CPPFLAGS) $(LDFLAGS) $(LIBS) -o "$@"
%.c: %.h
%.cpp: %.h
%.$(OBJEXT): %.c
$(CC) -c $(CFLAGS) -c -o "$@" "$<"
%.$(OBJEXT): %.cpp
$(CXX) -c $(CPPFLAGS) -c -o "$@" "$<"
%.$(OBJEXT): %.cc
$(CXX) -c $(CXXFLAGS) -c -o "$@" "$<"
%.$(OBJEXT): %.cxx
$(CXX) -c $(CXXFLAGS) -c -o "$@" "$<"
clean:
find src -name "*.$(OBJEXT)" -exec rm {} \;
rm -f stimfit
install: $(TARGET)
install $(TARGET) $(PREFIX)/bin/
uninstall:
rm $(PREFIX)/bin/stimfit