/
MkRules
151 lines (119 loc) · 3.55 KB
/
MkRules
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
#-*- Makefile -*-
## This files contains tabs: make sure your editor leaves them unchanged.
## ===== configuration macros for building packages or R ===============
# Alternatives MINGW (mingw), CROSS (Linux)
BUILD=MINGW
HELP = YES
ifeq ($(strip $(BUILD)),CROSS)
WINHELP = NO
else
WINHELP = CHM # NO or CHM
endif
## ============== configuration macros for building R ===================
# Comment out if the msvcrt.dll malloc/free is required.
LEA_MALLOC=YES
# Set to YES and specify the path if you want to use the ATLAS BLAS.
USE_ATLAS=NO
ATLAS_PATH=/R/ATLAS/lib/WinNT_PIIISSE1
# Set to YES and specify the DLL name if you want to use K. Goto's BLAS.
USE_GOTO=NO
GOTO_DLL=libgoto_p4_512-r0.9.dll
# Where does 'HTML Help Workshop' live? (unused if compiled HTML help is
# not requested. Spaces allowed.)
HHWDIR=C:/Program Files/HTML Help Workshop
# Where does Tcl/Tk live? Spaces allowed.
TCL_HOME = $(RHOME)/Tcl
TCL_VERSION = 84
## ====== configuration macros for building installers ===========
# location where Inno Setup 4.x or 5.x was installed
ISDIR=C:/packages/Inno4
## =================== cross-compilation settings =================
ifeq ($(strip $(BUILD)),CROSS)
# Next might be i386-mingw32msvc- or i586- depending on the cross-compiler.
BINPREF=mingw32-
# Set this to where the mingw32 include files are. It must be accurate.
HEADER=/users/ripley/R/cross-tools/mingw32/include
endif
# path (possibly full path) to same version of R on the host system
# R_EXE=R
## =============== end of user-customizable parts ===================
ifeq ($(strip $(BUILD)),MINGW)
BINPREF=
MINGW32CFLAG=
MINGW32LDFLAG=
FLIBS=-lg2c
AWK=gawk
## only safe for gcc >= 3.1
DEPARG=-MM
endif
ifeq ($(strip $(BUILD)),CROSS)
MINGW32CFLAG=-isystem $(HEADER)
MINGW32LDFLAG=
FLIBS=-lg2c
AWK=awk
## BDR's build of cross-compiler is 2.95.3
DEPARG=-M
endif
PERL=perl
RM=rm -f
SED=sed
ECHO=echo
CP=cp
MKDIR=mkdir
CAT=cat
CC=$(BINPREF)gcc $(MINGW32CFLAG)
CXX=$(BINPREF)g++ $(MINGW32CFLAG)
F77=$(BINPREF)g77
AS=$(BINPREF)as
DLL_LDMAIN=gcc
DLL=$(BINPREF)$(DLL_LDMAIN) $(MINGW32LDFLAG)
DLLTOOL=$(BINPREF)dlltool -k --as $(AS)
LINKER=$(BINPREF)gcc $(MINGW32LDFLAG)
AR=$(BINPREF)ar
RANLIB=$(BINPREF)ranlib
NM=$(BINPREF)nm
CPP=$(CC) -E
RESCOMP=$(BINPREF)windres
.SUFFIXES: .c .cc .cpp .C .f .o .a .def .exp .dll .exe .d
.c.d:
@echo "making $@ from $<"
@$(CC) $(DEPARG) $(CFLAGS) $($*-CFLAGS) $< -o $@
.cc.d:
@echo "making $@ from $<"
@$(CXX) $(DEPARG) $(CXXFLAGS) $($*-CXXFLAGS) $< -o $@
.cpp.d:
@echo "making $@ from $<"
@$(CXX) $(DEPARG) $(CXXFLAGS) $($*-CXXFLAGS) $< -o $@
.C.d:
@echo "making $@ from $<"
@$(CXX) $(DEPARG) $(CXXFLAGS) $($*-CXXFLAGS) $< -o $@
.c.o:
$(CC) $(CFLAGS) $($*-CFLAGS) -c $< -o $@
.f.o:
$(F77) $(FFLAGS) $($*-FFLAGS) -c $< -o $@
.cc.o:
$(CXX) $(CXXFLAGS) $($*-CXXFLAGS) -c $< -o $@
.cpp.o:
$(CXX) $(CXXFLAGS) $($*-CXXFLAGS) -c $< -o $@
.C.o:
$(CXX) $(CXXFLAGS) $($*-CXXFLAGS) -c $< -o $@
%.exe:
$(LINKER) $(LINKFLAGS) $($*-LINKFLAGS) -o $@ $^ $($*-LIBS) $(LIBS)
%.dll:
# @$(ECHO) ------- Building $@ from $^ --------
@$(ECHO) LIBRARY $* > $*.def
@$(ECHO) EXPORTS >> $*.def
@$(NM) $^ > Defs
@$(SED) -n '/^........ [BCDRT] _/s/^........ [BCDRT] _/ /p' Defs >> $*.def
@$(RM) Defs
$(DLL) --shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ $*.def $^ $($*-DLLLIBS) $(DLLLIBS)
@$(RM) $*.def
lib%.a: %.def
@$(ECHO) -------- Building $@ from $^ --------
$(DLLTOOL) $(DLLTOOLFLAGS) $($*-DLLTOOLFLAGS) --dllname $*.dll --def $*.def --output-lib lib$*.a
%.a:
# @$(ECHO) -------- Building $@ from $^ --------
$(AR) cr $@ $^
$(RANLIB) $@
%.o: %.rc
$(RESCOMP) $(RESFLAGS) $($*-RESFLAGS) -i $< -o $@