-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJamrules
169 lines (139 loc) · 3.44 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
C++ = g++ ;
LINK = $(C++) ;
MKDIR = mkdir -p ;
LIBS = be ;
LOCATE_TARGET = obj.$(OSPLAT) ;
SRC_DIR = Source ;
BASIC_SRCS = $(SRC_DIR)/BasicLauncher.cpp $(SRC_DIR)/SettingsWindow.cpp ;
BASIC_STUB = LauncherStub ;
DEBUG = 1 ;
if ( $(DEBUG) )
{
C++FLAGS += -g ;
}
rule BuildDistribution
{
local target = $(1) ;
NotFile $(target) ;
Always $(target) ;
Depends $(target) : $(LAUNCHER_BINARIES) ;
}
actions BuildDistribution
{
mkdir -p NowOpen
cd $(LOCATE_TARGET)
cp -af "$(LAUNCHER_BINARIES)" ../NowOpen
cd ..
zip -9ry "./NowOpen-`git describe --tags --dirty --always`-`uname -m`" ./NowOpen
rm -rf NowOpen
}
# BuildCustomLauncher <Launcher Name> ;
rule BuildCustomLauncher
{
BuildStub $(<) : $(SRC_DIR)/$(<).cpp ;
# move it back to the top level after BuildStub changed the destination
LOCATE on $(<) = $(LOCATE_TARGET) ;
Rc $(<).rsrc : $(SRC_DIR)/$(<).rdef ;
AddResources $(<) : $(<).rsrc ;
Clean clean : $(<).rsrc ;
MimeSet $(<) ;
}
# BuildLauncher <Launcher Name> : <output file> ;
rule BuildLauncher
{
local LauncherBinary = $(<) ;
if ( $(>) )
{
LauncherBinary = $(>) ;
}
LOCATE on $(LauncherBinary) = $(LOCATE_TARGET) ;
File $(LauncherBinary) : $(BASIC_STUB) ;
MODE on $(LauncherBinary) = 755 ;
Clean clean : $(LauncherBinary) ;
Rc $(<).rsrc : $(SRC_DIR)/$(<).rdef ;
AddResources $(LauncherBinary) : $(<).rsrc ;
Clean clean : $(<).rsrc ;
MimeSet $(LauncherBinary) ;
LAUNCHER_BINARIES += $(LauncherBinary) ;
}
# BuildStub <Stub Name> : <source files> ;
rule BuildStub
{
LINKFLAGS on $(<) += -Xlinker -soname=_APP_ ;
LINKLIBS on $(<) += [ ProcessLibs $(LIBS) ] ;
Main $(<) : $(>) ;
LOCATE on $(<) = [ FDirName $(LOCATE_TARGET) $(>[1]:D) ] ;
}
# MkObjectDirs <List of Source Files> ;
# Makes the necessary sub-directories in the object target directory based
# on the sub-directories used for the source files.
rule MkObjectDirs
{
local dir ;
for i in $(1)
{
dir = [ FDirName $(LOCATE_TARGET) $(i:D) ] ;
Depends $(i:S=$(SUFOBJ)) : $(dir) ;
MkDir $(dir) ;
}
}
# AddResources <Application Name> : <Resource Files> ;
# Adds the given resources to the given application.
rule AddResources
{
Depends $(<) : $(>) ;
}
actions AddResources
{
xres -o "$(<)" "$(>)"
}
# Rc <Resource File> : <Resource definition file> ;
# Compile an rdef file into a binary resources file
rule Rc
{
Depends $(<) : $(>) ;
LOCATE on $(<) = [ FDirName $(LOCATE_TARGET) $(>:D) ] ;
}
actions Rc
{
rc -o "$(<)" $(>)
}
# MimeSet <Application Name> ;
# Sets the mime type of the given application to be an application.
actions MimeSet
{
mimeset -A -f "$(<)"
}
# ProcessLibs <List of Library Names> ;
# Prepends -l to any library names that aren't _APP_ or _KERNEL_ or
# that don't have .a or .so file extensions. The result will be given
# to the linker so that it links to the right libraries.
rule ProcessLibs
{
local result ;
for i in $(1)
{
if ( ( $(i) in _APP_ _KERNEL_ ) || ( $(i:S) in .so .a ) )
{
result += $(i) ;
}
else
{
result += -l$(i) ;
}
}
return $(result) ;
}
# Link <Application Name> : <List of Object Files> ;
# Replaces the actions for the default Jam Link rule with one that handles spaces
# in application names.
actions Link bind NEEDLIBS
{
$(LINK) $(LINKFLAGS) -o "$(<)" $(UNDEFS) $(>) $(NEEDLIBS) $(LINKLIBS)
}
# make sure header scanning works
SubDirHdrs $(SRC_DIR) ;
# ensure our object directory exists
MkObjectDirs $(BASIC_SRCS) ;
# build our base Launcher binary
BuildStub $(BASIC_STUB) : $(BASIC_SRCS) ;