Makefile 4.97 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
3
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id$
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Copyright (c) 2010 by Daniel Armbruster 
# ----
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# ----
# Daniel Armbruster 30/09/2010
thomas.forbriger's avatar
thomas.forbriger committed
20
21
# 
# REVISIONS and CHANGES 
22
23
24
25
#    15/07/2010   V1.0   	Thomas Forbriger & Daniel Armbruster
#    30/09/2010   V1.1   	make code functional in new repository
#    13/10/2010   V1.2   	- check environment variables
#                        	- deploy doxygen output as a copy
26
27
28
29
30
31
32
#                        	- use configurable path in doxygen output -
#                        	changed doxygen path name to any2matlab, since I
#                        	expect more mex programs to contribute
#                        	documentation in the future
#    05/05/2011	V1.3 		provides now the build of an any2matlab package 
#  					with src/pakete/Makefile.packages
#    21/07/2011	V1.4		add mechanism to find MATLAB mex compiler binary
33
34
35
36
#
# ----------------------------------------------------------------------------
# Usage:
#
37
38
# make all				creates the documentation and the
# any2matlab binary
39
40
41
#
# make install			builds the any2matlab binary
#
42
43
44
# make package			builds a full package of any2matlab with all
# 					library dependencies and including documentation
# 					to distribute
45
#  
thomas.forbriger's avatar
thomas.forbriger committed
46
47
48
# ============================================================================
#

49
50
all: any2matlab doxydoc
install: any2matlab
51
package: fullpackage
52

53
54
55
56
57
58
CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1)))
CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var)))

$(call CHECKVARS,LOCINCLUDEDIR LOCLIBDIR LOCBINDIR)
$(call CHECKVARS,TF_BROWSER TF_WWWBASEDIR)

Daniel Armbruster's avatar
Daniel Armbruster committed
59
# check operating system
thomas.forbriger's avatar
thomas.forbriger committed
60
OS := $(shell uname -m)
61
MEXFLAGS =-cxx
thomas.forbriger's avatar
thomas.forbriger committed
62
63
64
65
66
67
68

ifeq ($(OS),x86_64)
TYPE:=mexa64
else
TYPE:=mexglx
endif

Daniel Armbruster's avatar
Daniel Armbruster committed
69
70
71
72
73
74
75
76
77
78
# find the binary of MATLAB mex compiler
# If an error occurs add the path to your MATLAB mex compiler binary e.g.
# MEX=/usr/local/MATLAB/R2011a/bin/mex
MEX=

ifndef $(MEX)
MEX:=$(shell tmp=`matlab -n | grep -e "->  r   MATLAB"`; \
echo $${tmp\#*=})/bin/mex	
endif

79
README=README README.install
80
SRC=$(wildcard *.cc)
thomas.forbriger's avatar
thomas.forbriger committed
81

82
flist: Makefile $(README) $(SRC) COPYING
thomas.forbriger's avatar
thomas.forbriger committed
83
84
85
86
87
88
	echo $^ | tr ' ' '\n' | sort > $@

.PHONY: edit
edit: flist; vim $<

.PHONY: clean
Daniel Armbruster's avatar
Daniel Armbruster committed
89
clean:  
90
	-/bin/rm *.o *.bak *.o77 *.exe *.ps *.xxx *.d
thomas.forbriger's avatar
thomas.forbriger committed
91
92
93

#======================================================================
# installation part
94
# ------------------
thomas.forbriger's avatar
thomas.forbriger committed
95
96
97
# depends on operating system $(OS)
.PHONY: any2matlab
any2matlab: any2matlab.cc
98
99
	mkdir -pv $(LOCBINDIR)
	mkdir -pv $(LOCBINDIR)/matlab
Daniel Armbruster's avatar
Daniel Armbruster committed
100
	$(MEX) $< $(MEXFLAGS) -output $(LOCBINDIR)/matlab/$@.$(TYPE) \
101
        -L$(LOCLIBDIR) -I$(LOCINCLUDEDIR) -ldatrwxx\
102
103
        -lsffxx -lgsexx -laff -ltime++

thomas.forbriger's avatar
thomas.forbriger committed
104
105
#======================================================================
# documentation part
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# ------------------
#
# targets commonly used:
# ----------------------
#
# make doxyclean        removes all documentation
# make doxydoc          creates doxygen documentation in the DOXYWWWPATH
# make doxyview         creates doxygen documentation and launches netscape to
#                       browse in the documentation
#
# If you launch "make doxydoc" the documentation will be written to
# DOXYWWWPATH (see below). This is meant to export the documentation through
# your homepage. The doxyfull directory is just a symbolic link to this
# directory.
#

$(call CHECKVARS,TF_WWWBASEDIR TF_BROWSER)

DOXYWWWPATH=$(TF_WWWBASEDIR)/any2matlab

.PHONY: doxyclean doxyview doxydoc doxyconf
thomas.forbriger's avatar
thomas.forbriger committed
127

128
doxyclean: ;/bin/rm -rfv $(DOXYWWWPATH)
thomas.forbriger's avatar
thomas.forbriger committed
129

130
131
132
133
134
135
136
137
138
DOXYSRC=$(README) $(SRC) 

# create doxygen intermediate configuration
PWD=$(shell env pwd)
doxydoc.xxx: doxyfull.cfg
	sed 's,<OUTPUTDIRECTORY>,$(DOXYWWWPATH),g;s,<STRIPFROMPATH>,$(PWD),g' \
	  $< > $@

$(DOXYWWWPATH)/html/index.html: doxydoc.xxx $(DOXYSRC)
thomas.forbriger's avatar
thomas.forbriger committed
139
140
141
	mkdir -vp $(DOXYWWWPATH)
	doxygen $<

142
143
144
145
doxydoc: $(DOXYWWWPATH)/html/index.html

doxyfullview doxyview: $(DOXYWWWPATH)/html/index.html
	$(TF_BROWSER) file:$< &
146

147
148
149
150
151
152
153
154
155
#======================================================================
# create package
# --------------
# is delegated to Makefile.packages
ifdef TF_MAKEPKG
.PHONY: fullpackage
fullpackage: $(TF_MAKEPKG)
	$(MAKE) -f $< \
  	PACKAGE=any2matlab \
156
157
    PACKAGEEXPORT="trunk/src/matlab/any2matlab:src " \
		PACKAGEEXPORT+="trunk/src/matlab/any2matlab/README.install:README.any2matlab " \
158
    PACKAGETARGETS="src:install src/texts/installDoc:pdf:" \
159
160
161
    PACKAGELIBS="libaff:libtime:libsffxx:libgsexx:libdatrwxx"
endif

thomas.forbriger's avatar
thomas.forbriger committed
162
# ----- END OF Makefile -----