forked from garglk/garglk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jamrules
325 lines (267 loc) · 8.28 KB
/
Jamrules
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# You will probably need to edit this file to get everything to compile.
# You may want to review the SharedLink action in Jamshared as well.
#
BUILD ?= RELEASE ;
USESDL ?= yes ;
USEBABEL ?= yes ;
MAC_USEHOMEBREW ?= no ;
MACOS_MIN_VER ?= 10.7 ;
BUNDLEFONTS ?= yes ;
USETTS ?= no ;
# jam -sGUILIB=EFL
GUILIB ?= gtk+ ;
# jam -sGARGLKINI=/usr/local/etc/garglk.ini
GARGLKINI ?= /etc/garglk.ini ;
# jam -sGARGLKPRE=gargoyle-
GARGLKPRE ?= "" ;
CC ?= gcc ;
CXX ?= g++ ;
if $(CROSS)
{
MINGWARCH ?= i386-mingw32 ;
CROSS = "(cross-compiling)" ;
OS = MINGW ;
SUFEXE = .exe ;
CC = $(MINGWARCH)-gcc ;
C++ = $(MINGWARCH)-g++ -std=c++0x ;
CXX = $(C++) ;
AR = $(MINGWARCH)-ar cru ;
RANLIB = $(MINGWARCH)-ranlib ;
LINK = $(CC) ;
PKGCONF = $(MINGWARCH)-pkg-config ;
}
#cross compiling for Open Inkpot
#jam -sIPLINUXARCH=mipsel-ip-linux-gnu
if $(IPLINUXARCH)
{
OS = IPLINUX ;
GUILIB = EFL ;
USESDL = no ;
CC = $(IPLINUXARCH)-gcc ;
C++ = $(IPLINUXARCH)-g++ ;
CXX = $(IPLINUXARCH)-g++ ;
AR = $(IPLINUXARCH)-ar cru ;
RANLIB = $(IPLINUXARCH)-ranlib ;
LINK = $(CC) ;
}
switch $(OS)
{
case LINUX :
PLATFORM = UNIX ;
case NETBSD :
PLATFORM = UNIX ;
case FREEBSD :
PLATFORM = UNIX ;
CC = clang ;
C++ = clang++ ;
CXX = clang++ ;
case OPENBSD :
PLATFORM = UNIX ;
CC = clang ;
C++ = clang++ ;
CXX = clang++ ;
case * :
PLATFORM = $(OS) ;
}
switch $(PLATFORM)
{
case MINGW :
Echo "OS is MINGW (win32) $(CROSS)" ;
SUFDLL = .dll ;
LINKLIBS = -lcomdlg32 -lgdi32 -lwinmm -lm ;
SHRLINKLIBS = -lcomdlg32 -lgdi32 -lwinmm -lm ;
PACKAGES = "" ;
if $(MINGW_USE_SYSTEM_LIBRARIES) = yes
{
PACKAGES = "$(PACKAGES) freetype2 libjpeg libpng zlib" ;
}
else
{
SHRLINKLIBS += $(TOP)/support/freetype/libfreetype-6.dll ;
SHRLINKLIBS += $(TOP)/support/libjpeg/libjpeg-8.dll ;
SHRLINKLIBS += $(TOP)/support/libpng/libpng16-16.dll ;
SHRLINKLIBS += $(TOP)/support/zlib/zlib1.dll ;
}
GARGLKCCFLAGS = -std=gnu99 ;
if $(BUILD) = RELEASE || $(BUILD) = TURBO
{
SHRLINKLIBS += -mwindows ;
LINKLIBS += -mwindows ;
}
if $(USESDL) = yes
{
PACKAGES = "$(PACKAGES) sdl2 SDL2_mixer" ;
}
if $(PACKAGES)
{
# the 'only-I' bit is important to avoid SDL messing with main()
GARGLKCCFLAGS += "`$(PKGCONF) $(PACKAGES) --cflags-only-I`" ;
LINKLIBS += "`$(PKGCONF) $(PACKAGES) --libs`" ;
SHRLINKLIBS += "`$(PKGCONF) $(PACKAGES) --libs`" ;
}
if $(USETTS) = yes
{
SHRLINKLIBS += -lsapi -lole32 ;
LINKLIBS += -lsapi -lole32 ;
}
case UNIX :
Echo "OS is $(OS) ($(GUILIB))" ;
if $(GUILIB) = EFL {
PKGCONFIG = "pkg-config freetype2 evas ecore ecore-evas elementary fontconfig" ;
} else {
PKGCONFIG = "pkg-config freetype2 gtk+-3.0 gdk-3.0 gobject-2.0 glib-2.0 fontconfig" ;
}
if $(USETTS) = yes {
PKGCONFIG = "$(PKGCONFIG) speech-dispatcher" ;
}
PKGCONFIG = "$(PKGCONFIG) libpng zlib" ;
if $(USESDL) = yes
{
PKGCONFIG = "$(PKGCONFIG) sdl2 SDL2_mixer" ;
}
# Setting C++ standard version to use for current g++ compilers.
C++FLAGS = -std=c++11 ;
GARGLKCCFLAGS = "`$(PKGCONFIG) --cflags` -fPIC -std=gnu99" ;
# Not all supported platforms include a pkg-config file for libjpeg.
GARGLKLIBS = "`$(PKGCONFIG) --libs`" -ljpeg ;
LINKLIBS = -lm "`$(PKGCONFIG) --libs`" ;
if $(STATIC) { LINKLIBS += $(GARGLKLIBS) ; }
else { SHRLINKLIBS += $(GARGLKLIBS) ; }
case IPLINUX :
Echo "OS is IPLINUX (EFL)" ;
PKGCONFIG = "PKG_CONFIG_PATH=/usr/$(IPLINUXARCH)/lib/pkgconfig pkg-config freetype2 fontconfig libkeys libeoi eina-0 evas ecore ecore-x ecore-file ecore-evas edje" ;
GARGLKCCFLAGS = "`$(PKGCONFIG) --cflags`" -fPIC ;
GARGLKLIBS = "`$(PKGCONFIG) --libs`" -ljpeg -lpng -lm -lrt ;
LINKLIBS = -lz -lm "`$(PKGCONFIG) --libs`" ;
if $(USESDL) = yes
{
GARGLKCCFLAGS += -I/usr/include/SDL2 ;
GARGLKLIBS += -lSDL2_mixer -lSDL2 ;
}
if $(STATIC) { LINKLIBS += $(GARGLKLIBS) ; }
else { SHRLINKLIBS += $(GARGLKLIBS) ; }
case SOLARIS :
Echo "OS is SOLARIS (gtk+)" ;
PKGCONFIG = "pkg-config freetype2 gtk+-3.0 gdk-3.0 gobject-2.0 glib-2.0 fontconfig" ;
GARGLKCCFLAGS = "`$(PKGCONFIG) --cflags`" -fPIC ;
GARGLKLIBS = "`$(PKGCONFIG) --libs`" -ljpeg -lpng -lz ;
LINKLIBS = -lz -lm "`$(PKGCONFIG) --libs`" ;
if $(USESDL) = yes
{
GARGLKCCFLAGS += -I/usr/include/SDL2 ;
GARGLKLIBS += -lSDL2_mixer -lSDL2 -lsmpeg -lvorbisfile ;
}
if $(STATIC) { LINKLIBS += $(GARGLKLIBS) ; }
else { SHRLINKLIBS += $(GARGLKLIBS) ; }
case MACOSX :
Echo "OS is MACOSX (cocoa)" ;
SUFDLL = .dylib ;
MAINARCH = -arch x86_64 -mmacosx-version-min=$(MACOS_MIN_VER) ;
AR = "libtool -static -o" ;
RM = "touch -c" ;
CCFLAGS = -Wno-pointer-sign $(MAINARCH) ;
PKGCONFIG = "pkg-config freetype2 libpng" ;
GARGLKCCFLAGS = "`$(PKGCONFIG) --cflags`" ;
SHRLINKLIBS += "`$(PKGCONFIG) --libs`" -lz ;
# Homebrew's JPEG library package is missing some configuration files.
if $(MAC_USEHOMEBREW) = yes
{
GARGLKCCFLAGS += "-I`brew --prefix jpeg`/include" ;
SHRLINKLIBS += "-L`brew --prefix jpeg`/lib" ;
}
SHRLINKLIBS += -ljpeg ;
LINKLIBS = "`$(PKGCONFIG) --libs`" -lz ;
FRAMEWORKS = -framework Cocoa -framework OpenGL ;
if $(USESDL) = yes
{
PKGCONFIG = "pkg-config SDL2_mixer sdl2 vorbisfile" ;
GARGLKCCFLAGS += "`$(PKGCONFIG) --cflags`" ;
SHRLINKLIBS += "`$(PKGCONFIG) --libs`" -lsmpeg ;
}
LINK = $(CC) -headerpad_max_install_names $(FRAMEWORKS) $(MAINARCH) ;
case * :
Exit "Unknown target. Please edit 'Jamrules'." ;
}
switch $(BUILD)
{
case DEBUG :
Echo "BUILD is DEBUG" ;
OPTIM = -g ;
case RELEASE :
Echo "BUILD is RELEASE" ;
OPTIM = -O2 $(CFLAGS) ;
LINKFLAGS = $(LDFLAGS) ;
SHRLINKFLAGS = $(LDFLAGS) ;
case PROFILE :
Echo "BUILD is PROFILE" ;
OPTIM = -g -pg ;
LINKFLAGS = -pg ;
case * :
Exit "Unknown build:" $(BUILD) ;
}
#
# To compile windows resource files
#
rule UserObject
{
switch $(>)
{
case *.rc : WindRes $(<) : $(>) ;
case *.m : Cc $(<) : $(>) ;
case * : Echo "unknown suffix on" $(>) ;
}
}
rule WindRes
{
Depends $(<) : $(>) ;
Clean clean : $(<) ;
}
actions WindRes { $(MINGWARCH)-windres -i $(>) -o $(<) --include-dir=$(>:D) }
#
# You shouldn't need to touch anything from here on.
#
HDRS = [ FDirName $(TOP) garglk ] ;
BTOP = [ FDirName $(TOP) build $(OS:L).$(BUILD:L) ] ;
rule ObjDir
{
LOCATE_TARGET = [ FDirName $(BTOP) $(1) ] ;
}
include [ FDirName $(TOP) Jamshared ] ;
if $(OS) = MINGW
{
LINKLIBS += $(BTOP)/garglk/icons.o ;
}
rule FPrependRoot
{
# FPrependRoot prefix : path ;
#
# Safely prepend a prefix to a path
# Use to e.g. install files into a build root
# FDirName does not allow adding a prefix to a root path
# ( e.g. [ FDirName /some/path /usr/bin ] -> /usr/bin )
#
# Care must be taken not to allow doubled separators in the path:
# this causes MkDir to fail to traverse up the directory tree
# and try to create the same directory twice
local _prefix = [ FDirName $(<) ] ;
local _path = [ FDirName $(>) ] ;
local _full ;
if $(_path) = $(_path:R=$(SLASH))
{
# _path is rooted
_full = $(_prefix) $(_path) ;
}
else
{
# _path is relative
if $(_path) = $(DOT)
{
_full = $(_prefix) ;
}
else
{
_full = $(_prefix) $(SLASH)$(_path) ;
}
}
return $(_full:J=) ;
}