The R Project SVN R

Rev

Rev 42637 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 42637 Rev 42639
1
#-*- Makefile -*-
1
#-*- Makefile -*-
2
## This files contains tabs: make sure your editor leaves them unchanged.
2
## This files contains tabs: make sure your editor leaves them unchanged.
3
 
3
 
4
## ===== configuration macros for building packages or R  ===============
4
## ===== configuration macros for building packages or R  ===============
5
 
5
 
6
# Alternatives GCC3 (MinGW gcc3), GCC4 (MinGW gcc4) or CROSS (e.g. Linux)
6
# Alternatives GCC3 (MinGW gcc3), GCC4 (MinGW gcc4) or CROSS (e.g. Linux)
7
# or F2C (use suitable f2c rather than a Fortran compiler).
7
# or F2C (use suitable f2c rather than a Fortran compiler).
8
 
8
 
9
BUILD=GCC4
9
BUILD=GCC4
10
## if cross-building, is this gcc3 or gcc4?
10
## if cross-building, is this gcc3 or gcc4?
11
CROSS-GCC=gcc4
11
CROSS-GCC=gcc4
12
 
12
 
13
## These are overridden by R CMD INSTALL: they only apply to
13
## These are overridden by R CMD INSTALL: they only apply to
14
## standard packages when building R and when using 'make pkg-foo'
14
## standard packages when building R and when using 'make pkg-foo'
15
HELP = YES
15
HELP = YES
16
HELPTYPES = -txt -html -latex -example
16
HELPTYPES = -txt -html -latex -example
17
ifeq ($(strip $(BUILD)),CROSS)
17
ifeq ($(strip $(BUILD)),CROSS)
18
WINHELP = NO
18
WINHELP = NO
19
else
19
else
20
WINHELP = CHM # NO or CHM
20
WINHELP = CHM # NO or CHM
21
endif
21
endif
22
 
22
 
23
# an alternative is to use -g here, if the debugger supports only stabs.
23
# an alternative is to use -g here, if the debugger supports only stabs.
24
G_FLAG=-gdwarf-2
24
G_FLAG=-gdwarf-2
25
 
25
 
26
## ============== configuration macros for building R ===================
26
## ============== configuration macros for building R ===================
27
 
27
 
28
# Comment out if the msvcrt.dll malloc/free is required.
28
# Comment out if the msvcrt.dll malloc/free is required.
29
LEA_MALLOC=YES
29
LEA_MALLOC=YES
30
 
30
 
31
# Set to YES and specify the path if you want to use the ATLAS BLAS.
31
# Set to YES and specify the path if you want to use the ATLAS BLAS.
32
USE_ATLAS=NO
32
USE_ATLAS=NO
33
ATLAS_PATH=/R/ATLAS/lib/WinNT_P4SSE2
33
ATLAS_PATH=/R/ATLAS/lib/WinNT_P4SSE2
34
 
34
 
35
# If you want to use AMD's ACML BLAS,
35
# If you want to use AMD's ACML BLAS,
36
# set to YES and specify the path to libacml.a 
36
# set to YES and specify the path to libacml.a 
37
USE_ACML=NO
37
USE_ACML=NO
38
ACML_PATH=c:/Program Files/AMD/acml3.6.0/gnu32/lib
38
ACML_PATH=c:/Program Files/AMD/acml3.6.0/gnu32/lib
39
## Set this to YES if you want to use ACML's LAPACK not R's.
39
## Set this to YES if you want to use ACML's LAPACK not R's.
40
USE_ACML_LAPACK=NO
40
USE_ACML_LAPACK=NO
41
 
41
 
42
# Support for the Goto BLAS has been withdrawn: see R-admin.html
42
# Support for the Goto BLAS has been withdrawn: see R-admin.html
43
 
43
 
44
# Where does 'HTML Help Workshop' live? (unused if compiled HTML help is
44
# Where does 'HTML Help Workshop' live? (unused if compiled HTML help is
45
# not requested. Spaces allowed.)
45
# not requested. Spaces allowed.)
46
HHWDIR=C:/Program Files/HTML Help Workshop
46
HHWDIR=C:/Program Files/HTML Help Workshop
47
 
47
 
48
# Define this to enable memory profiling.
48
# Define this to enable memory profiling.
49
# R_MEMORY_PROFILING=YES
49
# R_MEMORY_PROFILING=YES
50
 
50
 
51
# Where does Tcl/Tk live? Spaces allowed.
51
# Where does Tcl/Tk live? Spaces allowed.
52
TCL_HOME = $(RHOME)/Tcl
52
TCL_HOME = $(RHOME)/Tcl
53
TCL_VERSION = 84
53
TCL_VERSION = 84
54
 
54
 
55
# Define to use unicows
55
# Define to use unicows
56
# USE_UNICOWS = YES
56
# USE_UNICOWS = YES
57
 
57
 
58
# Define to use svnversion to set SVN-REVISION (slow, but more informative
58
# Define to use svnversion to set SVN-REVISION (slow, but more informative
59
# than without it because mixed or modified revisions will be indicated)
59
# than without it because mixed or modified revisions will be indicated)
60
# USE_SVNVERSION = YES
60
# USE_SVNVERSION = YES
61
 
61
 
62
# We normally link against DLLs, but this forces the use of import libs
62
# We normally link against DLLs, but this forces the use of import libs
63
# Needed if using other compilers, and currently on Win64
63
# Needed if using other compilers, and currently on Win64
64
# USE_IMPLIBS = YES
64
# USE_IMPLIBS = YES
65
 
65
 
66
# 32- or 64-bit Windows?
66
# 32- or 64-bit Windows?
67
WIN=32
67
WIN=32
68
ifeq ($(strip $(WIN)),64)
68
ifeq ($(strip $(WIN)),64)
69
USE_IMPLIBS = YES
69
USE_IMPLIBS = YES
70
endif
70
endif
71
 
71
 
72
## ====== configuration macros for building installer ===========
72
## ====== configuration macros for building installer ===========
73
 
73
 
74
# location where Inno Setup 5.1.x was installed. Spaces allowed.
74
# location where Inno Setup 5.1.x was installed. Spaces allowed.
75
ISDIR=C:/packages/Inno51
75
ISDIR=C:/packages/Inno51
76
 
76
 
77
## ====== configuration macros for building MSI installer ===========
77
## ====== configuration macros for building MSI installer ===========
78
 
78
 
79
# location where WiX was installed. Spaces allowed, slashes required.
79
# location where WiX was installed. Spaces allowed, slashes required.
80
WIXDIR=C:/packages/WiX
80
WIXDIR=C:/packages/WiX
81
 
81
 
82
## ====== configuration macros for building packages ================
82
## ====== configuration macros for building packages ================
83
 
83
 
84
## For a package using F90/95 set the name or path of gfortran.exe 
84
## For a package using F90/95 set the name or path of gfortran.exe 
85
## or g95.exe.  Spaces allowed.
85
## or g95.exe.  Spaces allowed.
86
ifeq ($(strip $(BUILD)),GCC4)
86
ifeq ($(strip $(BUILD)),GCC4)
87
FC=gfortran$(GCC4_SUFF)
87
FC=gfortran$(GCC4_SUFF)
88
else
88
else
89
# needs to be set by user
89
# needs to be set by user
90
FC=
90
FC=
91
endif
91
endif
92
FCFLAGS=-O3
92
FCFLAGS=-O3
93
 
93
 
94
## =================== cross-compilation settings  =================
94
## =================== cross-compilation settings  =================
95
 
95
 
96
ifeq ($(strip $(BUILD)),CROSS)
96
ifeq ($(strip $(BUILD)),CROSS)
97
# Next might be i586-mingw32- or x86_64-pc-mingw32- or ...
97
# Next might be i586-mingw32- or x86_64-pc-mingw32- or ...
98
# depending on the cross-compiler.
98
# depending on the cross-compiler.
99
BINPREF=i586-mingw32-
99
BINPREF=i586-mingw32-
100
# Optional, if compiler has been relocated
100
# Optional, if compiler has been relocated
101
# Set this to full path to dir where the mingw32 include files are.
101
# Set this to full path to dir where the mingw32 include files are.
102
# It should contain fcntl.h and windows.h
102
# It should contain fcntl.h and windows.h
103
HEADER=
103
HEADER=
104
# path (possibly full path) to same version of R on the host system
104
# path (possibly full path) to same version of R on the host system
105
R_EXE='I failed to read the instructions to set R_EXE in MkRules'
105
R_EXE='I failed to read the instructions to set R_EXE in MkRules'
106
 
106
 
107
## SHLIB extension on host: 'so' or 'dll'
107
## SHLIB extension on host: 'so' or 'dll'
108
CROSS_EXT=so
108
CROSS_EXT=so
109
endif
109
endif
110
 
110
 
111
## =============== end of user-customizable parts  ===================
111
## =============== end of user-customizable parts  ===================
112
 
112
 
113
DEPARG=-MM
113
DEPARG=-MM
114
MINGW32LDFLAG=
114
MINGW32LDFLAG=
115
C99FLAG=-std=gnu99
115
C99FLAG=-std=gnu99
116
 
116
 
117
ifeq ($(strip $(BUILD)),GCC3)
117
ifeq ($(strip $(BUILD)),GCC3)
118
BINPREF=
118
BINPREF=
119
MINGW32CFLAG=
119
MINGW32CFLAG=
120
F77=g77
120
F77=g77
121
FLIBS=-lg2c
121
FLIBS=-lg2c
122
AWK=gawk
122
AWK=gawk
123
endif
123
endif
124
 
124
 
125
ifeq ($(strip $(BUILD)),GCC4)
125
ifeq ($(strip $(BUILD)),GCC4)
126
BINPREF=
126
BINPREF=
127
MINGW32CFLAG=
127
MINGW32CFLAG=
128
F77=gfortran$(GCC4_SUFF)
128
F77=gfortran$(GCC4_SUFF)
129
FLIBS=-lgfortran
129
FLIBS=-lgfortran
130
AWK=gawk
130
AWK=gawk
131
## for mingw-runtime <= 3.11
131
## for mingw-runtime <= 3.11
132
# C99FLAG=-std=gnu99 -fgnu89-inline
132
# C99FLAG=-std=gnu99 -fgnu89-inline
133
## alternative is -dw2, which currently fails building R, or empty
133
## alternative is -dw2, which currently fails building R, or empty
134
## for unofficial builds including TDM's and GFortran from the Wiki
134
## for unofficial builds including TDM's and GFortran from the Wiki
135
GCC4_SUFF=-sjlj
135
GCC4_SUFF=-sjlj
136
endif
136
endif
137
 
137
 
138
ifeq ($(strip $(BUILD)),CROSS)
138
ifeq ($(strip $(BUILD)),CROSS)
139
ifneq ($(strip $(HEADER)),)
139
ifneq ($(strip $(HEADER)),)
140
MINGW32CFLAG=-isystem $(HEADER)
140
MINGW32CFLAG=-isystem $(HEADER)
141
endif
141
endif
142
ifeq ($(strip $(CROSS-GCC)),gcc4)
142
ifeq ($(strip $(CROSS-GCC)),gcc4)
143
F77=$(BINPREF)gfortran
143
F77=$(BINPREF)gfortran
144
FLIBS=-lgfortran
144
FLIBS=-lgfortran
145
else
145
else
146
F77=$(BINPREF)g77
146
F77=$(BINPREF)g77
147
FLIBS=-lg2c
147
FLIBS=-lg2c
148
endif
148
endif
149
AWK=awk
149
AWK=awk
150
endif
150
endif
151
 
151
 
152
ifeq ($(strip $(BUILD)),F2C)
152
ifeq ($(strip $(BUILD)),F2C)
153
BINPREF=
153
BINPREF=
154
MINGW32CFLAG=
154
MINGW32CFLAG=
155
F77=sh $(RHOME)/src/scripts/f77_f2c
155
F77=sh $(RHOME)/src/scripts/f77_f2c
156
FLIBS=-lf2c
156
FLIBS=-lf2c
157
AWK=gawk
157
AWK=gawk
158
endif
158
endif
159
 
159
 
160
ifeq ($(strip $(USE_IMPLIBS)),YES)
160
ifeq ($(strip $(USE_IMPLIBS)),YES)
161
IMPDIR=lib
161
IMPDIR=lib
162
else
162
else
163
IMPDIR=bin
163
IMPDIR=bin
164
endif
164
endif
165
 
165
 
166
BLAS_LIBS= -L$(RHOME)/$(IMPDIR) -lRblas
166
BLAS_LIBS= -L$(RHOME)/$(IMPDIR) -lRblas
167
ifeq ($(strip $(USE_ACML_LAPACK)),YES)
167
ifeq ($(strip $(USE_ACML_LAPACK)),YES)
168
LAPACK_LIBS=-L"$(ACML_PATH)" -lacml -lg2c
168
LAPACK_LIBS=-L"$(ACML_PATH)" -lacml -lg2c
169
else
169
else
170
LAPACK_LIBS= -L$(RHOME)/$(IMPDIR) -lRlapack
170
LAPACK_LIBS= -L$(RHOME)/$(IMPDIR) -lRlapack
171
endif
171
endif
172
 
172
 
173
ifdef USE_UNICOWS
173
ifdef USE_UNICOWS
174
LIBEXTRAS+=-lunicows
174
LIBEXTRAS+=-lunicows
175
endif
175
endif
176
 
176
 
-
 
177
GRAPHAPP_LIB=-lgraphapp
177
 
178
 
178
AR=$(BINPREF)ar
179
AR=$(BINPREF)ar
179
AS=$(BINPREF)as
180
AS=$(BINPREF)as
180
CAT=cat
181
CAT=cat
181
CC=$(BINPREF)gcc$(GCC4_SUFF) $(MINGW32CFLAG) $(C99FLAG)
182
CC=$(BINPREF)gcc$(GCC4_SUFF) $(MINGW32CFLAG) $(C99FLAG)
182
CP=cp
183
CP=cp
183
CPP=$(CC) -E
184
CPP=$(CC) -E
184
CXX=$(BINPREF)g++$(GCC4_SUFF) $(MINGW32CFLAG)
185
CXX=$(BINPREF)g++$(GCC4_SUFF) $(MINGW32CFLAG)
185
## overridden in some packages
186
## overridden in some packages
186
DLL_LDMAIN=$(CC)
187
DLL_LDMAIN=$(CC)
187
DLL=$(DLL_LDMAIN) $(MINGW32LDFLAG)
188
DLL=$(DLL_LDMAIN) $(MINGW32LDFLAG)
188
## formerly used version without -k for front-ends/libproxy.a
189
## formerly used version without -k for front-ends/libproxy.a
189
DLLTOOL=$(BINPREF)dlltool
190
DLLTOOL=$(BINPREF)dlltool
190
## some versions have trouble with paths, so we always need this
191
## some versions have trouble with paths, so we always need this
191
## even for native builds
192
## even for native builds
192
DLLTOOLFLAGS=--as $(AS) -k
193
DLLTOOLFLAGS=--as $(AS) -k
193
ECHO=echo
194
ECHO=echo
194
FIND=find
195
FIND=find
195
LINKER=$(MAIN_LD) $(MINGW32LDFLAG)
196
LINKER=$(MAIN_LD) $(MINGW32LDFLAG)
196
MAIN_LD=$(CC)
197
MAIN_LD=$(CC)
197
MKDIR=mkdir
198
MKDIR=mkdir
198
NM=$(BINPREF)nm
199
NM=$(BINPREF)nm
199
OBJC=$(BINPREF)gcc$(GCC4_SUFF) $(MINGW32CFLAG)
200
OBJC=$(BINPREF)gcc$(GCC4_SUFF) $(MINGW32CFLAG)
200
PERL=perl
201
PERL=perl
201
RANLIB=$(BINPREF)ranlib
202
RANLIB=$(BINPREF)ranlib
202
RESCOMP=$(BINPREF)windres --preprocessor="$(BINPREF)gcc$(GCC4_SUFF) -E -xc -DRC_INVOKED"
203
RESCOMP=$(BINPREF)windres --preprocessor="$(BINPREF)gcc$(GCC4_SUFF) -E -xc -DRC_INVOKED"
203
RM=rm -f
204
RM=rm -f
204
SED=sed
205
SED=sed
205
SORT=sort
206
SORT=sort
206
 
207
 
207
.SUFFIXES:
208
.SUFFIXES:
208
.SUFFIXES: .c .cc .cpp .C .f .o .a .def .exp .dll .exe .d .f90 .f95 .m .S
209
.SUFFIXES: .c .cc .cpp .C .f .o .a .def .exp .dll .exe .d .f90 .f95 .m .S
209
 
210
 
210
.c.d:
211
.c.d:
211
	@echo "making $@ from $<"
212
	@echo "making $@ from $<"
212
	-@$(CC) $(DEPARG) $(CPPFLAGS) $($*-CPPFLAGS) $< -o $@
213
	-@$(CC) $(DEPARG) $(CPPFLAGS) $($*-CPPFLAGS) $< -o $@
213
 
214
 
214
.cc.d:
215
.cc.d:
215
	@echo "making $@ from $<"
216
	@echo "making $@ from $<"
216
	-@$(CXX) $(DEPARG) $(CPPFLAGS) $($*-CPPFLAGS) $< -o $@
217
	-@$(CXX) $(DEPARG) $(CPPFLAGS) $($*-CPPFLAGS) $< -o $@
217
 
218
 
218
.cpp.d:
219
.cpp.d:
219
	@echo "making $@ from $<"
220
	@echo "making $@ from $<"
220
	-@$(CXX) $(DEPARG) $(CPPFLAGS) $($*-CPPFLAGS) $< -o $@
221
	-@$(CXX) $(DEPARG) $(CPPFLAGS) $($*-CPPFLAGS) $< -o $@
221
 
222
 
222
.C.d:
223
.C.d:
223
	@echo "making $@ from $<"
224
	@echo "making $@ from $<"
224
	-@$(CXX) $(DEPARG) $(CPPFLAGS) $($*-CPPFLAGS) $< -o $@
225
	-@$(CXX) $(DEPARG) $(CPPFLAGS) $($*-CPPFLAGS) $< -o $@
225
 
226
 
226
.m.d:
227
.m.d:
227
	@echo "making $@ from $<"
228
	@echo "making $@ from $<"
228
	@$(OBJC) $(DEPARG) $(CPPFLAGS) $($*-CPPFLAGS) $< -o $@
229
	@$(OBJC) $(DEPARG) $(CPPFLAGS) $($*-CPPFLAGS) $< -o $@
229
 
230
 
230
.c.o:
231
.c.o:
231
	$(CC) $(CPPFLAGS) $($*-CPPFLAGS) $(CFLAGS) $($*-CFLAGS) -c $< -o $@
232
	$(CC) $(CPPFLAGS) $($*-CPPFLAGS) $(CFLAGS) $($*-CFLAGS) -c $< -o $@
232
 
233
 
233
.f.o:
234
.f.o:
234
	$(F77) $(FFLAGS) $($*-FFLAGS) -c $< -o $@
235
	$(F77) $(FFLAGS) $($*-FFLAGS) -c $< -o $@
235
 
236
 
236
.cc.o:
237
.cc.o:
237
	$(CXX) $(CPPFLAGS) $($*-CPPFLAGS) $(CXXFLAGS) $($*-CXXFLAGS) -c $< -o $@
238
	$(CXX) $(CPPFLAGS) $($*-CPPFLAGS) $(CXXFLAGS) $($*-CXXFLAGS) -c $< -o $@
238
 
239
 
239
.cpp.o:
240
.cpp.o:
240
	$(CXX) $(CPPFLAGS) $($*-CPPFLAGS) $(CXXFLAGS) $($*-CXXFLAGS) -c $< -o $@
241
	$(CXX) $(CPPFLAGS) $($*-CPPFLAGS) $(CXXFLAGS) $($*-CXXFLAGS) -c $< -o $@
241
 
242
 
242
.C.o:
243
.C.o:
243
	$(CXX) $(CPPFLAGS) $($*-CPPFLAGS) $(CXXFLAGS) $($*-CXXFLAGS) -c $< -o $@
244
	$(CXX) $(CPPFLAGS) $($*-CPPFLAGS) $(CXXFLAGS) $($*-CXXFLAGS) -c $< -o $@
244
 
245
 
245
.m.o:
246
.m.o:
246
	$(OBJC) $(CPPFLAGS) $($*-CPPFLAGS) $(OBJCFLAGS) $($*-OBJCFLAGS) -c $< -o $@
247
	$(OBJC) $(CPPFLAGS) $($*-CPPFLAGS) $(OBJCFLAGS) $($*-OBJCFLAGS) -c $< -o $@
247
 
248
 
248
%.exe:
249
%.exe:
249
	$(LINKER) $(LINKFLAGS) $($*-LINKFLAGS) -o $@ $^ $($*-LIBS) $(LIBS)
250
	$(LINKER) $(LINKFLAGS) $($*-LINKFLAGS) -o $@ $^ $($*-LIBS) $(LIBS)
250
 
251
 
251
%.dll:
252
%.dll:
252
	@$(ECHO) EXPORTS > $*.def
253
	@$(ECHO) EXPORTS > $*.def
253
	@$(NM) $^ | $(SED) -n 's/^.* [BCDRT] _/ /p' >> $*.def
254
	@$(NM) $^ | $(SED) -n 's/^.* [BCDRT] _/ /p' >> $*.def
254
	$(DLL) -shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ $*.def $^ $($*-DLLLIBS) $(DLLLIBS)
255
	$(DLL) -shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ $*.def $^ $($*-DLLLIBS) $(DLLLIBS)
255
	@$(RM) $*.def
256
	@$(RM) $*.def
256
 
257
 
257
lib%.dll.a: %.def
258
lib%.dll.a: %.def
258
	$(DLLTOOL) $(DLLTOOLFLAGS) $($*-DLLTOOLFLAGS) --dllname $*.dll --input-def $*.def --output-lib $@
259
	$(DLLTOOL) $(DLLTOOLFLAGS) $($*-DLLTOOLFLAGS) --dllname $*.dll --input-def $*.def --output-lib $@
259
 
260
 
260
%.a:
261
%.a:
261
#	@$(ECHO) -------- Building $@ from $^ --------
262
#	@$(ECHO) -------- Building $@ from $^ --------
262
	@$(RM) $@
263
	@$(RM) $@
263
	$(AR) crs $@ $^
264
	$(AR) crs $@ $^
264
 
265
 
265
ifeq ($(strip $(BUILD)),CROSS)
266
ifeq ($(strip $(BUILD)),CROSS)
266
%.o: %.rc
267
%.o: %.rc
267
	$(RESCOMP) $(RESFLAGS) $($*-RESFLAGS) -I $(HEADER) -i $< -o $@
268
	$(RESCOMP) $(RESFLAGS) $($*-RESFLAGS) -I $(HEADER) -i $< -o $@
268
else
269
else
269
%.o: %.rc
270
%.o: %.rc
270
	$(RESCOMP) $(RESFLAGS) $($*-RESFLAGS) -i $< -o $@
271
	$(RESCOMP) $(RESFLAGS) $($*-RESFLAGS) -i $< -o $@
271
endif
272
endif
272
 
273
 
273
.f90.o:
274
.f90.o:
274
	"$(FC)" $(PKG_FCFLAGS) $(FCFLAGS) -c $< -o $@
275
	"$(FC)" $(PKG_FCFLAGS) $(FCFLAGS) -c $< -o $@
275
.f95.o:
276
.f95.o:
276
	"$(FC)" $(PKG_FCFLAGS) $(FCFLAGS) -c $< -o $@
277
	"$(FC)" $(PKG_FCFLAGS) $(FCFLAGS) -c $< -o $@