The R Project SVN R

Rev

Rev 76788 | Rev 78005 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6994 pd 1
#-*- Makefile -*-
4394 ripley 2
 
67240 murdoch 3
## Defaults for user settings.  See MkRules.dist for descriptions.
4
 
5
LOCAL_SOFT ?= $(R_HOME)/extsoft
6
EXT_LIBS ?= $(LOCAL_SOFT)
7
G_FLAG ?= -gdwarf-2
8
USE_ATLAS ?= NO
67302 ripley 9
ATLAS_PATH ?= 
67240 murdoch 10
MULTI ?=
68007 murdoch 11
TOOL_PATH ?=
70363 murdoch 12
BINPREF ?= c:/Rtools/mingw_32/bin/
13
BINPREF64 ?= c:/Rtools/mingw_64/bin/
70374 murdoch 14
COMPILED_BY ?= gcc-$(shell $(CC) --version | egrep -o "([0-9]{1,}\.){2,}[0-9]{1,}")
67240 murdoch 15
M_ARCH ?=
16
AS_ARCH ?=
17
RC_ARCH ?=
18
DT_ARCH ?=
19
WIN ?= 32
67302 ripley 20
ICU_PATH ?= 
67240 murdoch 21
ICU_LIBS ?= -lsicuin -lsicuuc -lsicudt -lstdc++
22
CAIRO_HOME ?=
76788 ligges 23
USE_CAIRO ?= $(if $(CAIRO_HOME),YES)
24
CAIRO_CPPFLAGS ?= "-I$(CAIRO_HOME)/win$(WIN)"
25
CAIRO_LIBS ?= "-L$(CAIRO_HOME)/win$(WIN) -lcairo -lpixman-1 -lpng -lz -lgdi32 -lmsimg32"
67240 murdoch 26
BUILD_HTML ?= NO
27
MIKTEX ?= TRUE
67343 murdoch 28
TEXI2ANY ?= missing
69460 ripley 29
TEXI2DVI ?= texi2dvi
76828 kalibera 30
EOPTS ?=
67240 murdoch 31
OPENMP ?= -fopenmp
32
PTHREAD ?= -pthread
33
ISDIR ?= C:/packages/Inno
34
QPDF ?=
35
HOME32 ?=
36
DLLs32 ?=
37
DLLs64 ?=
38
WIX3DIR ?= C:/packages/WiX3.5/bin
39
WIX_PERSONAL ?= 0
40
 
41
## =============== end of user setting defaults  ===================
42
 
43
 
57924 ripley 44
ifeq "$(MULTI)" "64"
45
WIN = 64
46
M_ARCH = -m64
47
AS_ARCH = --64
48
RC_ARCH = -F pe-x86-64
49
DT_ARCH = -m i386:x86-64 --as-flags --64
50
BINPREF64 = $(TOOL_PATH)
51
endif
52
ifeq "$(MULTI)" "32"
53
WIN = 32
54
# these are normally the defaults
55
M_ARCH = -m32
56
AS_ARCH = --32
57
RC_ARCH = -F pe-i386
58
DT_ARCH = -m i386 --as-flags --32
59
BINPREF = $(TOOL_PATH)
60
endif
61
 
62
 
53418 ripley 63
ifeq "$(WIN)" "64"
51456 ripley 64
R_ARCH = /x64
53403 ripley 65
arch_DEFS = -DR_ARCH='"x64"'
57583 ripley 66
BINPREF = $(BINPREF64)
67
SYMPAT = 's/^.* [BCDRT] / /p'
70358 murdoch 68
NM_FILTER ?= | $(SED) -e '/[.]refptr[.]/d' -e '/[.]weak[.]/d'
51491 ripley 69
else
70
R_ARCH = /i386
53403 ripley 71
arch_DEFS = -DR_ARCH='"i386"'
52549 ripley 72
SYMPAT = 's/^.* [BCDRT] _/ /p'
42609 ripley 73
endif
74
 
51796 ripley 75
## -std=c99 would force __STRICT_ANSI__ disabling strdup etc, and also alloca
40917 ripley 76
C99FLAG=-std=gnu99
38811 ripley 77
 
51796 ripley 78
## earlier Rtools needed -sjlj; the alternative is -dw2, which failed building R.
43549 ripley 79
GCC4_SUFF=
38811 ripley 80
 
51491 ripley 81
BINDIR=bin$(R_ARCH)
51073 ripley 82
 
49840 ripley 83
ifdef USE_IMPLIBS
42589 ripley 84
IMPDIR=lib
85
else
51073 ripley 86
IMPDIR=$(BINDIR)
42589 ripley 87
endif
38811 ripley 88
 
47846 ripley 89
AR=$(BINPREF)ar
4394 ripley 90
CAT=cat
55076 ripley 91
CC=$(BINPREF)gcc$(GCC4_SUFF) $(C99FLAG) $(M_ARCH)
41449 murdoch 92
CP=cp
42698 ripley 93
# as set by make
41449 murdoch 94
CPP=$(CC) -E
57426 ripley 95
DLL=$(CC)
55267 ripley 96
DLLTOOL=$(BINPREF)dlltool
42468 ripley 97
## some versions have trouble with paths, so we always need this
98
## even for native builds
55267 ripley 99
DLLTOOLFLAGS=--as $(BINPREF)as $(DT_ARCH) -k
41449 murdoch 100
ECHO=echo
55076 ripley 101
F77=$(BINPREF)gfortran$(GCC4_SUFF) $(M_ARCH)
67879 murdoch 102
FLIBS=-lgfortran -lquadmath
47698 ripley 103
LINKER=$(MAIN_LD)
42446 ripley 104
MAIN_LD=$(CC)
75808 ripley 105
## MAKEINFO = $(TEXI2ANY)
41449 murdoch 106
MKDIR=mkdir
47846 ripley 107
NM=$(BINPREF)nm
108
RANLIB=$(BINPREF)ranlib
55078 ripley 109
RESCOMP=$(BINPREF)windres $(RC_ARCH)
55076 ripley 110
 
76752 kalibera 111
## If the Fortran compiler is gfortran >= 7, add
112
## -fno-optimize-sibling-calls to avoid recent gfortran optimizations
113
## that break with LAPACK/BLAS-style passing of length-1 strings
114
## (without hidden arguments giving their lengths).
115
GFVER = $(shell echo "__GNUC__" | $(F77) -E -P -)
116
GF7OPTS =
117
ifneq ($(GFVER),"")
118
GF7OPTS = $(shell [ $(GFVER) -ge 7 ] && echo "-fno-optimize-sibling-calls")
119
endif
120
 
42698 ripley 121
# as set by make
41449 murdoch 122
RM=rm -f
123
SED=sed
42510 murdoch 124
SORT=sort
4394 ripley 125
 
40666 ripley 126
.SUFFIXES:
127
.SUFFIXES: .c .cc .cpp .C .f .o .a .def .exp .dll .exe .d .f90 .f95 .m .S
17913 ripley 128
 
14136 ripley 129
.c.d:
130
	@echo "making $@ from $<"
48072 ripley 131
	@$(CC) -MM $(CPPFLAGS) $($*-CPPFLAGS) $(DEFINES) $< -o $@
14136 ripley 132
 
4394 ripley 133
.c.o:
57426 ripley 134
	$(CC) $(CPPFLAGS) $($*-CPPFLAGS) $(CFLAGS) $($*-CFLAGS) $(DEFINES) -c $< -o $@
6994 pd 135
 
4394 ripley 136
.f.o:
57426 ripley 137
	$(F77) $(FFLAGS) $($*-FFLAGS) -c $< -o $@
4394 ripley 138
 
9372 ripley 139
%.exe:
15534 ripley 140
	$(LINKER) $(LINKFLAGS) $($*-LINKFLAGS) -o $@ $^ $($*-LIBS) $(LIBS)
4394 ripley 141
 
18256 ripley 142
%.dll:
37433 ripley 143
	@$(ECHO) EXPORTS > $*.def
66212 ripley 144
	@$(NM) $^ | $(SED) -n $(SYMPAT) $(NM_FILTER) >> $*.def
36874 ripley 145
	$(DLL) -shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ $*.def $^ $($*-DLLLIBS) $(DLLLIBS)
21580 ripley 146
	@$(RM) $*.def
4394 ripley 147
 
37086 ripley 148
lib%.dll.a: %.def
42468 ripley 149
	$(DLLTOOL) $(DLLTOOLFLAGS) $($*-DLLTOOLFLAGS) --dllname $*.dll --input-def $*.def --output-lib $@
37086 ripley 150
 
9372 ripley 151
%.a:
21638 ripley 152
#	@$(ECHO) -------- Building $@ from $^ --------
32342 ripley 153
	@$(RM) $@
37514 ripley 154
	$(AR) crs $@ $^
4394 ripley 155
 
15534 ripley 156
%.o: %.rc
9058 ripley 157
	$(RESCOMP) $(RESFLAGS) $($*-RESFLAGS) -i $< -o $@