File: Makefile.in

package info (click to toggle)
biosig4c%2B%2B 1.9.3-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,220 kB
  • sloc: ansic: 41,218; cpp: 8,946; sh: 4,365; makefile: 1,758; python: 87; awk: 73; php: 40; perl: 36; java: 14; ruby: 7
file content (282 lines) | stat: -rw-r--r-- 9,737 bytes parent folder | download
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
####### Makefile for "BioSig for C/C++" #####################
###
###  Copyright (C) 2006-2015 Alois Schloegl <alois.schloegl@ist.ac.at>
###  This file is part of the "BioSig for C/C++" repository
###  (biosig4c++) at http://biosig.sf.net/
###
##############################################################

##### Target: GNU/Linux
#
## make && make install    build and install libbiosig, but no other tools.
#             libbiosig is a prerequisite for building all the other tools below.
#
## make save2gdf   - makes converter
## make install_save2gdf   - installs converter
#
## make mex4o      - makes mexSLOAD, mexSOPEN for Octave (requires Octave-headers)
## make mex4m      - makes mexSLOAD, mexSOPEN for Matlab (requires Matlab, mex -setup must be configured)
## make mexw32     - makes mexSLOAD.mexw32, mexSOPEN.mexw32 (requires that mingw32, gnumex libraries from Matlab/Win32)
## make mexw64     - makes mexSLOAD.mexw64, mexSOPEN.mexw64 (requires that mce-w32, gnumex libraries from Matlab/Win64)
## make mex        - mex4o, mex4m, mexw32, mexw64 combined
## make biosig4python - makes python interface (requires Python)
## make biosig4java - makes Java interface (experimental)
## make biosig4php - makes PHP interface (experimental)
## make biosig4perl - makes perl interface (experimental)
## make biosig4ruby - makes ruby interface (experimental)
## make biosig4tcl - makes tcl/tk interface (experimental)
##
## make win32 and make win64 are obsolete. save2gdf.exe, and libbiosig.{a,dll} for windows can now be built
## with the mingw-cross-compiler environment (mxe.cc).
##    git clone https://github.com/schloegl/mxe.git
##    make biosig
## should do what you want. Please note, that win32mma does now also rely that libbiosig is built with MXE.
## Make sure that CROSS or CROSS64 is properly defined when running `make`
##
## ???
## make sigviewer  - makes sigviewer

##### Target: Win32
## make win32      - makes save2gdf.exe,libbiosig.lib,libbiosig.dll, for MSWindows, requires MinGW
## make mexw32 mex/mexSLOAD.mexw32   - requires MinGW32 and GNUMEX libraries from Matlab/Win32
## make win32/sigviewer.exe 	- requires sources of SigViewer, and MinGW32 (mex: make suitesparse zlib qt )

##### Target: Win64
## make win64      - makes save2gdf.exe,libbiosig.lib,libbiosig.dll, for MSWindows, requires MinGW
## make mexw64 mex/mexSLOAD.mexw64   - requires MCE-W64 and GNUMEX libraries from Matlab/Win64
## make win64/sigviewer.exe 	- requires sources of SigViewer and MCE-W64, make suitesparse zlib qt 

##### Target: MacOSX w/ homebrew
## make install_homebrew	installs libbiosig and save2gdf
	# requires: brew tap homebrew/dupes
	#	    brew install libiconv

###############################
# whether dynamic or static linking is used, can be controlled with
# LIBEXT. Setting it to 'a' links statically, 'so' links dynamically
#
LIBEXT        = a
#LIBEXT	      = so
###############################


## TARGET dependencies
ifeq (,$(TARGET))
	CC      ?= gcc
	CXX     ?= g++
	AR      := ar rcs
	PKGCONF := pkg-config
ifneq (Darwin,$(shell uname))
	LFLAGS  += -Wl,-z,relro,-z,now
endif
else ifeq (intel,$(TARGET))
	CC      := /opt/intel/bin/icc
	CXX     := /opt/intel/bin/icc
	LD      := /opt/intel/bin/xild
	AR      := /opt/intel/bin/xiar crs
else 
	prefix  := $(dir $(shell which $(TARGET)-gcc))
	CC      := $(TARGET)-gcc
	CXX     := $(TARGET)-g++
	LD      := $(TARGET)-ld
	AR      := $(TARGET)-ar rcs
	PKGCONF := $(TARGET)-pkg-config
	ifeq (mingw, $(findstring mingw, $(TARGET)))
		## add gnulib's getlogin
		SOURCES += win32/getlogin.c win32/getline.c win32/getdelim.c
		OBJECTS += getlogin.o getline.o getdelim.o
		## exclude conflicting definition of sopen from mingw's io.h
		CFLAGS  += -I.
		IO_H_FILE2 = io.h
		CFLAGS  += -I$(prefix)/include
		LIBS    += -lssp
		LDLIBS  += -liconv -liberty -lws2_32
	endif
endif

ifeq (Darwin,$(shell uname))
	## Homebrew:
	##	brew tap homebrew/dupes
	##	brew install libiconv
	##
	LD	       = ld
	CFLAGS        += -I/usr/local/opt/libiconv/include
	LDLIBS        += -L/usr/local/opt/libiconv/lib/ -liconv -lstdc++
	LDFLAGS        += -dylib -arch x86_64 -macosx_version_min 10.9
	DLEXT          = dylib
	FULLDLEXT      = ${BIOSIG_VERSION}.dylib
	SONAME_PREFIX  = -install_name # the last space character is crucial
	SONAME_POSTFIX = .${MAJOR_VERSION}.${MINOR_VERSION}.$(DLEXT)
else
	LD	       = $(CXX)
	LDFLAGS       += -shared
	DLEXT          = so
	FULLDLEXT      = so.${BIOSIG_VERSION}
	SONAME_PREFIX  = -Wl,-soname=
	SONAME_POSTFIX = .$(DLEXT).${MAJOR_VERSION}.${MINOR_VERSION}
endif

ifeq (,$(prefix))
	prefix  := /usr/local
endif

DEFINES_ALL   = #-D=NDEBUG

DEFINES      += $(DEFINES_ALL)
#DEFINES      += -D=WITH_SON 
#DEFINES      += -D=WITHOUT_SCP_DECODE
#DEFINES      += -D=WITH_TIMESTAMPEVENT
#DEFINES      += -D=WITH_TIMESTAMPCHANNEL
#DEFINES      += -D=WITH_CURL
DEFINES      += -D=__4HAERTEL__
DEFINES      += -D=WITH_FAMOS
DEFINES      += -D=WITH_FIFF
DEFINES      += -D=WITHOUT_NETWORK
#DEFINES      += -D=WITH_HDF
#DEFINES      += -D=WITH_MATIO
#DEFINES      += -D=WITH_LIBXML2 
DEFINES      += -D=WITH_FEF
#DEFINES      += -D=WITH_PDP
#DEFINES      += -D=WITH_DCMTK
#DEFINES      += -D=WITH_DICOM
#DEFINES      += -D=WITH_GDCM
#DEFINES      += -D=WITH_GSL
#DEFINES      += -D=WITH_EEPROBE
#DEFINES      += -D=WITH_TDMS
#DEFINES      += -D=WITH_ATF
#DEFINES      += -D=WITH_AVI
#DEFINES      += -D=WITH_RIFF
#DEFINES      += -D=WITH_WAV
#DEFINES      += -D=WITH_NEV
DEFINES      += -D=MAKE_EDFLIB


ifneq (,$(findstring WITH_GDCM, $(DEFINES)))
  INCPATH    += -I$(wildcard /usr/include/gdcm-2*/)
  LDLIBS     += -lgdcmCommon -lgdcmDSED -lgdcmMEXD -lgdcmMSFF -lgdcmDICT -lgdcmIOD
endif
ifneq (,$(findstring WITH_LIBXML2, $(DEFINES)))
  LDLIBS     += -lxml2
endif
ifneq (,$(findstring WITH_CURL, $(DEFINES)))
  LDLIBS     += -lcurl
endif
ifneq (,$(findstring WITH_HDF, $(DEFINES)))
  LDLIBS     += -lhdf5
endif
ifneq (,$(findstring WITH_DCMTK, $(DEFINES)))
  LDLIBS     += -ldcmdata -loflog -lofstd
endif
ifneq (,$(findstring WITH_MATIO, $(DEFINES)))
  LDLIBS     += -lmatio
endif
ifneq (,$(findstring stack-protector, $(CFLAGS)))
ifneq (,$(findstring CYGWIN, $(shell uname)))
  LDLIBS     += -lssp -liconv
endif 
endif

LIBS         += $(LDLIBS)

DELETE        = rm -f
COPY          = cp -f
DATA_DIR      = data/
DATA_DIR_CFS  = $(HOME)/L/data/test/CFS/
TEMP_DIR      = test/
SED           = sed
VERBOSE	     := -V0

##########################################################
## set Matlab and Octave variables
ifeq (undefined,$(origin MATLABDIR))
  ifeq (Darwin,$(shell uname))
    MATLABDIR := $(shell find /Applications/MATLAB* -name bin -type d -depth 1 2>/dev/null | head -1)
  else
    MATLABDIR ?= $(shell find /usr/local/MATLAB* -maxdepth 2 -name bin -type d 2>/dev/null | head -1)
  endif
endif

ifeq (,$(MATLABDIR))
  #$(warning MATLABDIR is not defined)
else
  MEX         = $(MATLABDIR)/mex
  MEX_EXT    := $(shell $(MATLABDIR)/mexext)
endif


# use environment variable to define OCTAVE_VERSION
#   e.g. export OCTAVE_VERSION=-3.6.2
# Octave - global install  (e.g. from debian package)
#OCTAVE_VERSION = 
# Octave - local install (e.g. compiled from sources) 
#OCTAVE_VERSION = -3.6.1

OCT           := mkoctfile$(OCTAVE_VERSION)
##########################################################


first: mex4o 


#############################################################
#	Compilation: Implicit, default rules
#############################################################


#############################################################
#	MEX-files for Octave and Matlab
#############################################################

# include directory for Win32-Matlab include
W32MAT_INC = $(HOME)/bin/win32/Matlab/R2010b/extern/include/ -I../win32
W64MAT_INC = $(HOME)/bin/win64/Matlab/R2010b/extern/include/ -I../win64
# path to GNUMEX libraries, available from here http://sourceforge.net/projects/gnumex/
GNUMEX   = $(HOME)/bin/win32/gnumex
GNUMEX64 = $(HOME)/bin/win64/gnumex

mexSOPEN.cpp : mexSLOAD.cpp
	echo "#define mexSOPEN" > mexSOPEN.cpp
	cat mexSLOAD.cpp >> mexSOPEN.cpp

MEX_OBJECTS = mexSLOAD.cpp mexSOPEN.cpp mexSSAVE.cpp

mex4o: $(patsubst %.cpp, %.mex, $(MEX_OBJECTS))
oct: $(patsubst %.cpp, %.oct, $(MEX_OBJECTS))
mexw32: $(patsubst %.cpp, %.mexw32, $(MEX_OBJECTS))
mexw64: $(patsubst %.cpp, %.mexw64, $(MEX_OBJECTS))

ifdef MEX_EXT
mex: mex4o mex4m mexw32 mexw64
mex4m: $(patsubst %.cpp, %.$(MEX_EXT), $(MEX_OBJECTS))

ifneq (Darwin,$(shell uname))
%.$(MEX_EXT): %.cpp
	$(MEX) $(MEX_OPTION) $(DEFINES) $(shell $(PKGCONF) --cflags libbiosig) "$<" $(shell $(PKGCONF) --libs libbiosig) -o "$@"
else
%.$(MEX_EXT): %.cpp
	## $(MEX) $(MEX_OPTION) $(DEFINES) "$<" $(shell $(PKGCONF) --libs libbiosig) -o "$@"
	$(MEX) $(DEFINES) $(shell $(PKGCONF) --cflags libbiosig) -outdir mex "$<" -lbiosig
endif

else
mex: mex4o mexw32 mexw64
endif

%.mex: %.cpp
	$(OCT) $(DEFINES) $(shell $(PKGCONF) --cflags libbiosig) -v -g --mex "$<" -lbiosig $(shell $(PKGCONF) --libs libbiosig) -o "$@"

%.oct: %.cpp
	$(OCT) $(DEFINES) $(shell $(PKGCONF) --cflags libbiosig) "$<" -lbiosig $(shell $(PKGCONF) --libs libbiosig) -o "$@"

%.mexw32: %.cpp Makefile biosig.h biosig-dev.h
	## $(CROSS)-g++ is used instead of $(CXX), so it can be called from biosig as well as mxe. 
	$(CROSS)-g++ -shared $(GNUMEX)/mex.def -DMATLAB_MEX_FILE $(DEFINES) -x c++ \
		-I$(prefix)/include \
		-I$(W32MAT_INC) -O2 -o "$@" -L$(GNUMEX) -s "$<" -llibmx -llibmex -lbiosig -liconv -lssp $(LDLIBS) -lws2_32

%.mexw64: %.cpp Makefile biosig.h biosig-dev.h
	$(CROSS64)-g++ -shared $(GNUMEX64)/mex.def -DMATLAB_MEX_FILE $(DEFINES) -x c++ \
		-I$(prefix)/include \
		-I$(W64MAT_INC) -O2 -o "$@" -L$(GNUMEX64) -s "$<" -llibmx -llibmex -lbiosig -liconv -lssp $(LDLIBS) -lws2_32