The R Project SVN R

Rev

Rev 57583 | Rev 67240 | 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
 
57924 ripley 3
ifeq "$(MULTI)" "64"
4
WIN = 64
5
M_ARCH = -m64
6
AS_ARCH = --64
7
RC_ARCH = -F pe-x86-64
8
DT_ARCH = -m i386:x86-64 --as-flags --64
9
BINPREF64 = $(TOOL_PATH)
10
endif
11
ifeq "$(MULTI)" "32"
12
WIN = 32
13
# these are normally the defaults
14
M_ARCH = -m32
15
AS_ARCH = --32
16
RC_ARCH = -F pe-i386
17
DT_ARCH = -m i386 --as-flags --32
18
BINPREF = $(TOOL_PATH)
19
endif
20
 
21
 
53418 ripley 22
ifeq "$(WIN)" "64"
51456 ripley 23
R_ARCH = /x64
53403 ripley 24
arch_DEFS = -DR_ARCH='"x64"'
57583 ripley 25
BINPREF = $(BINPREF64)
26
SYMPAT = 's/^.* [BCDRT] / /p'
51491 ripley 27
else
28
R_ARCH = /i386
53403 ripley 29
arch_DEFS = -DR_ARCH='"i386"'
52549 ripley 30
SYMPAT = 's/^.* [BCDRT] _/ /p'
42609 ripley 31
endif
32
 
51796 ripley 33
## -std=c99 would force __STRICT_ANSI__ disabling strdup etc, and also alloca
40917 ripley 34
C99FLAG=-std=gnu99
38811 ripley 35
 
51796 ripley 36
## earlier Rtools needed -sjlj; the alternative is -dw2, which failed building R.
43549 ripley 37
GCC4_SUFF=
38811 ripley 38
 
51491 ripley 39
BINDIR=bin$(R_ARCH)
51073 ripley 40
 
49840 ripley 41
ifdef USE_IMPLIBS
42589 ripley 42
IMPDIR=lib
43
else
51073 ripley 44
IMPDIR=$(BINDIR)
42589 ripley 45
endif
38811 ripley 46
 
47846 ripley 47
AR=$(BINPREF)ar
48072 ripley 48
# AWK=gawk
4394 ripley 49
CAT=cat
55076 ripley 50
CC=$(BINPREF)gcc$(GCC4_SUFF) $(C99FLAG) $(M_ARCH)
41449 murdoch 51
CP=cp
42698 ripley 52
# as set by make
41449 murdoch 53
CPP=$(CC) -E
57426 ripley 54
DLL=$(CC)
55267 ripley 55
DLLTOOL=$(BINPREF)dlltool
42468 ripley 56
## some versions have trouble with paths, so we always need this
57
## even for native builds
55267 ripley 58
DLLTOOLFLAGS=--as $(BINPREF)as $(DT_ARCH) -k
41449 murdoch 59
ECHO=echo
55076 ripley 60
F77=$(BINPREF)gfortran$(GCC4_SUFF) $(M_ARCH)
61
FLIBS=-lgfortran
47698 ripley 62
LINKER=$(MAIN_LD)
42446 ripley 63
MAIN_LD=$(CC)
41449 murdoch 64
MKDIR=mkdir
47846 ripley 65
NM=$(BINPREF)nm
66
RANLIB=$(BINPREF)ranlib
55078 ripley 67
RESCOMP=$(BINPREF)windres $(RC_ARCH)
55076 ripley 68
 
42698 ripley 69
# as set by make
41449 murdoch 70
RM=rm -f
71
SED=sed
42510 murdoch 72
SORT=sort
4394 ripley 73
 
40666 ripley 74
.SUFFIXES:
75
.SUFFIXES: .c .cc .cpp .C .f .o .a .def .exp .dll .exe .d .f90 .f95 .m .S
17913 ripley 76
 
14136 ripley 77
.c.d:
78
	@echo "making $@ from $<"
48072 ripley 79
	@$(CC) -MM $(CPPFLAGS) $($*-CPPFLAGS) $(DEFINES) $< -o $@
14136 ripley 80
 
4394 ripley 81
.c.o:
57426 ripley 82
	$(CC) $(CPPFLAGS) $($*-CPPFLAGS) $(CFLAGS) $($*-CFLAGS) $(DEFINES) -c $< -o $@
6994 pd 83
 
4394 ripley 84
.f.o:
57426 ripley 85
	$(F77) $(FFLAGS) $($*-FFLAGS) -c $< -o $@
4394 ripley 86
 
9372 ripley 87
%.exe:
15534 ripley 88
	$(LINKER) $(LINKFLAGS) $($*-LINKFLAGS) -o $@ $^ $($*-LIBS) $(LIBS)
4394 ripley 89
 
18256 ripley 90
%.dll:
37433 ripley 91
	@$(ECHO) EXPORTS > $*.def
52518 ripley 92
	@$(NM) $^ | $(SED) -n $(SYMPAT) >> $*.def
36874 ripley 93
	$(DLL) -shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ $*.def $^ $($*-DLLLIBS) $(DLLLIBS)
21580 ripley 94
	@$(RM) $*.def
4394 ripley 95
 
37086 ripley 96
lib%.dll.a: %.def
42468 ripley 97
	$(DLLTOOL) $(DLLTOOLFLAGS) $($*-DLLTOOLFLAGS) --dllname $*.dll --input-def $*.def --output-lib $@
37086 ripley 98
 
9372 ripley 99
%.a:
21638 ripley 100
#	@$(ECHO) -------- Building $@ from $^ --------
32342 ripley 101
	@$(RM) $@
37514 ripley 102
	$(AR) crs $@ $^
4394 ripley 103
 
15534 ripley 104
%.o: %.rc
9058 ripley 105
	$(RESCOMP) $(RESFLAGS) $($*-RESFLAGS) -i $< -o $@