-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGNUmakefile.in
232 lines (169 loc) · 6.26 KB
/
GNUmakefile.in
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
########################################################################
# SNCTRL GNUmakefile.in
########################################################################
#-----------------------------------------------------------------------
# Available modules:
# src examples mex
modules = @modules@
modsrc = $(modules:%=$(srcdir)/%)
#-----------------------------------------------------------------------
# Compilers and linker flags
#-----------------------------------------------------------------------
FC = @FC@
FCFLAGS = @FCFLAGS@
FCLIBS = @FCLIBS@
CC = @CC@
CFLAGS = @CFLAGS@
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
LDFLAGS = @LDFLAGS@
LTFLAGS = --quiet
matlab = @matlab@
MATLABDIR = @MATLABDIR@
MEX = @MEX@
MEXFLAGS = @MEXFLAGS@
#-----------------------------------------------------------------------
# Location of external libraries
#-----------------------------------------------------------------------
blas = @blas@
ifeq ($(blas),yes)
blasLIB = @BLAS_LIBS@
endif
shared = @enable_shared@
static = @enable_static@
#-----------------------------------------------------------------------
SHELL = @SHELL@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
INSTALL = @INSTALL@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
bindir = @bindir@
libdir = @libdir@
incdir = @includedir@
mandir = @mandir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
#-----------------------------------------------------------------------
LIBDIR = $(top_builddir)/lib
INCDIR = $(top_builddir)/include
MODDIR = $(top_builddir)/mod
BINDIR = $(top_builddir)/bin
SRCDIR = $(top_srcdir)/src
OBJDIR = $(top_builddir)/src
EX_SRCDIR = $(top_srcdir)/examples
EX_OBJDIR = $(top_builddir)/examples
MATDIR = $(top_srcdir)/matlab
MEX_SRCDIR = $(top_srcdir)/mex
MEX_OBJDIR = $(top_builddir)/mex
#-----------------------------------------------------------------------
MODLOC = @FC_MODOUT@$(MODDIR)
MODINC = @FC_MODINC@$(MODDIR)
MODFLAGS = $(MODLOC) $(MODINC)
#-----------------------------------------------------------------------
COMPILE_F = $(LIBTOOL) --mode=compile --tag=FC $(LTFLAGS) $(FC)
LINK_F = $(LIBTOOL) --mode=link --tag=FC $(LTFLAGS) $(FC)
COMPILE_C = $(LIBTOOL) --mode=compile --tag=CC $(LTFLAGS) $(CC)
LINK_C = $(LIBTOOL) --mode=link --tag=CC $(LTFLAGS) $(CC)
COMPILE_CXX = $(LIBTOOL) --mode=compile --tag=CXX $(LTFLAGS) $(CXX)
LINK_CXX = $(LIBTOOL) --mode=link --tag=CXX $(LTFLAGS) $(CXX)
LINK_MEX = $(LIBTOOL) --mode=link --tag=CC $(LTFLAGS) $(MEX)
CLEAN = $(LIBTOOL) --mode=clean $(LTFLAGS)
INSTALL_LIB = $(LIBTOOL) --mode=install $(LTFLAGS) $(INSTALL)
FINISH = $(LIBTOOL) --mode=finish $(LTFLAGS)
UNINSTALL = $(LIBTOOL) --mode=uninstall $(LTFLAGS)
#-----------------------------------------------------------------------
# Library names
SNOPT_LIB = -L@SNOPT_LIB@ -lsnopt7
VERSION = @VERSION@
SNCTRLLIBS = snctrl$(VERSION)
SNCTRLLIBS_LA = $(LIBDIR)/lib$(SNCTRLLIBS).la
SNCTRLLIBS_INS = $(libdir)/lib$(SNCTRLLIBS).la
SNCTRL_LIBS = -L$(LIBDIR) -l$(SNCTRLLIBS) $(LDFLAGS) $(blasLIB)
#-----------------------------------------------------------------------
all: lib_snctrl
snctrl: lib_snctrl
matlab:
#-----------------------------------------------------------------------
install: install_snctrl
uninstall: uninstall_snctrl
install_snctrl: lib_snctrl $(libdir)
$(INSTALL_LIB) $(SNCTRLLIBS_LA) $(libdir)
$(FINISH) $(libdir)
uninstall_snctrl:
$(UNINSTALL) rm -f $(SNCTRLLIBS_INS)
$(CLEAN) rm -f $(SNCTRLLIBS_LA)
#-----------------------------------------------------------------------
include $(patsubst %,%/Submakefile,$(modsrc))
#-----------------------------------------------------------------------
lib_snctrl: src_snctrl $(LIBDIR) $(SNCTRLLIBS_LA)
$(SNCTRLLIBS_LA): $(CTSRC_LO)
$(LINK_F) $(FCFLAGS) -o $@ $^ -rpath $(libdir)
#-----------------------------------------------------------------------
clean:
veryclean:
distclean: veryclean
-rm -rf $(LIBDIR) $(BINDIR) $(INCDIR) $(MODDIR)
-rm -f config.cache config.log config.status GNUmakefile libtool
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status libtool
config.status: $(top_srcdir)/configure
./config.status --recheck
GNUmakefile: $(top_srcdir)/GNUmakefile.in $(top_builddir)/config.status
./config.status
$(top_builddir):
if [ ! -d $(top_builddir) ]; then mkdir $@; fi
$(incdir):
if [ ! -d $(incdir) ]; then mkdir -p $@; fi
$(libdir):
echo $(libdir)
if [ ! -d $(libdir) ]; then mkdir -p $@; fi
$(LIBDIR): $(top_builddir)
if [ ! -d $(LIBDIR) ]; then mkdir $@; fi
mod_dir: $(top_builddir)
if [ ! -d $(MODDIR) ]; then mkdir $(MODDIR); fi
bin_dir: $(top_builddir)
if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); fi
$(INCDIR): $(top_builddir)
if [ ! -d $(INCDIR) ]; then mkdir $@; fi
.SUFFIXES:
check: examples
@echo "Checking the installation. This may take a while..."
ifneq ($(EX_SRCDIR),$(EX_OBJDIR))
@-cp ${EX_SRCDIR}/check ${EX_OBJDIR}/;
endif
@cd ${EX_OBJDIR}; ./check > check.log;
# @cd ${EX_OBJDIR}; rm -f ./check.log; $(foreach ex,$(_EXE),./$(ex) >> ./check.log;)
ifneq ($(EX_SRCDIR),$(EX_OBJDIR))
@-rm ${EX_OBJDIR}/check;
endif
@grep EXIT ${EX_SRCDIR}/check.log0 > /tmp/EXITs0.txt
@grep EXIT ${EX_OBJDIR}/check.log > /tmp/EXITs.txt
@echo " "
@echo "Comparing expected EXIT messages (from examples/check.log0)"
@echo "with those from this installation (from examples/check.log )"
@echo "The differences are listed in /tmp/EXITdiffs.txt"
@echo " 0 /tmp/EXITdiffs.txt is good news (no differences)"
@echo " "
@diff /tmp/EXITs0.txt /tmp/EXITs.txt > /tmp/EXITdiffs.txt
@wc -l /tmp/EXITdiffs.txt
help:
@echo " "
@echo "Options for makefile"
@echo " all: build everything enabled"
@echo " snctrl: build SNCTRL Fortran library"
@echo " examples: compile the examples"
@echo " "
@echo " check: "
@echo " "
@echo " clean: "
@echo " veryclean: "
@echo " distclean: "
@echo " "
@echo " install: "
@echo " uninstall: "
.PHONY: all matlab examples snctrl lib_snctrl \
install uninstall check clean veryclean distclean help