forked from clasp-developers/clasp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbundler.jam
161 lines (124 loc) · 4.27 KB
/
bundler.jam
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
import errors ;
import type ;
import generators ;
import common ;
import os ;
import path ;
import project ;
import feature ;
import toolset ;
local .top ;
local .common ;
local .applib ;
local .appbin ;
local .appinc ;
rule init ( top ? ) {
if $(top) {
.top = $(top) ;
}
else {
errors.error "Please set the project root in your Jamroot file" ;
}
.common = $(top)/src/common ;
.applib = $(APPLIB) ;
local ecl = [ common.get-invocation-command-nodefault clasp : ecl ] ;
# if ! $(ecl) {
# ECHO "WARNING: Command ecl not found." ;
# }
}
type.register P : pmp ; # use pmp so that pump.py dumps output to stdout
type.register L : lisp ;
type.change-generated-target-suffix CPP : : cc ;
generators.register-composing bundler.ptoh : P : H ;
generators.register-composing bundler.ltoh : L : H ;
generators.register-standard bundler.ltocc : L : CPP ;
feature.feature sanitize : asan msan amsan : optional ;
feature.feature changes : 0 1 : incidental ;
rule bundle ( dir : sources * : properties * : opt_props * : dbg_props * )
{
if ( ( mi in [ modules.peek : ARGV ] ) &&
( ( [ path.pwd ] = [ path.root $(dir) [ path.pwd ] ] ) ||
( --mi-all in [ modules.peek : ARGV ] ) ) ) {
echo [ SHELL "cd $(dir); touch symbols_scraped_inc.h; rm symbols_scraped_inc.h; touch symbols_scraped_inc.h" ] ;
}
echo Scraping in $(dir) ;
out = [ SHELL "cd $(dir); export PYTHONPATH=`pwd`:${PYTHONPATH}; $(PYTHON2) $(.common)/symbolScraper.py *.cc *.h" : exit-status ] ;
if $(out[2]) = 0 {
ECHO $(out[1]) ;
} else {
ECHO "No changes found" ;
}
local lib = $(dir:B) ;
make $(lib)_scrape_flag.h : symbols_scraped_inc.h : @bundler.scraped : <changes>$(out[2]) ;
make $(lib)_initClasses_inc.h :
[ path.glob $(dir) : *.h ] :
@bundler.register-classes :
<dependency>$(.common)/registerClasses.py ;
alias mi : $(lib)_initClasses_inc.h $(lib)_scrape_flag.h ;
lib $(lib)_boehm_opt :
$(sources) :
$(properties) $(opt_props) <gc>boehm
<target-os>darwin:<make-bundle>no:<linkflags>"-install_name @executable_path/../Resources/lib/lib$(lib)_opt.dylib" ;
lib $(lib)_boehm_dbg :
$(sources) :
$(properties) $(dbg_props) <gc>boehm
<target-os>darwin:<make-bundle>no:<linkflags>"-install_name @executable_path/../Resources/lib/lib$(lib)_dbg.dylib" ;
lib $(lib)_mps_opt :
$(sources) :
$(properties) $(opt_props) <gc>mps
<target-os>darwin:<make-bundle>no:<linkflags>"-install_name @executable_path/../Resources/lib/lib$(lib)_opt.dylib" ;
lib $(lib)_mps_dbg :
$(sources) :
$(properties) $(dbg_props) <gc>mps
<target-os>darwin:<make-bundle>no:<linkflags>"-install_name @executable_path/../Resources/lib/lib$(lib)_dbg.dylib" ;
lib $(lib)_mps_prep_opt :
$(sources) :
$(properties) $(opt_props) <gc>mps-prep
<target-os>darwin:<make-bundle>no:<linkflags>"-install_name @executable_path/../Resources/lib/lib$(lib)_opt.dylib" ;
lib $(lib)_mps_prep_dbg :
$(sources) :
$(properties) $(dbg_props) <gc>mps-prep
<target-os>darwin:<make-bundle>no:<linkflags>"-install_name @executable_path/../Resources/lib/lib$(lib)_dbg.dylib" ;
alias $(lib) : $(lib)_boehm_opt : <gc>boehm <variant>release ;
alias $(lib) : $(lib)_boehm_dbg : <gc>boehm <variant>debug ;
alias $(lib) : $(lib)_mps_opt : <gc>mps <variant>release ;
alias $(lib) : $(lib)_mps_dbg : <gc>mps <variant>debug ;
alias $(lib) : $(lib)_mps_prep_opt : <gc>mps-prep <variant>release ;
alias $(lib) : $(lib)_mps_prep_dbg : <gc>mps-prep <variant>debug ;
install bundle : $(lib) : <location>$(.applib) ;
}
rule scraped ( target + : sources * : properties * )
{
if "<changes>0" in $(properties) {
ALWAYS $(targets) ;
}
else {
NOUPDATE $(targets) ;
}
}
actions scraped
{
touch $(<)
}
PYTHON2 = [ os.environ PYTHON2 ] ;
actions register-classes
{
cd $(>[1]:D)
bname=`basename $(>[1]:D)`
$(PYTHON2) $(.common)/registerClasses.py $(<) $(<:D)/${bname}_initScripting_inc.h *Package.h otherPackageClasses.h *.h $(<:D)/*.h *.cc $(<:D)/*.cc > registerClasses.log
}
actions ltoh
{
cd $(>[1]:D)
ecl -shell $(>[1]) $(<)
}
actions ptoh
{
cd $(>[1]:D)
$(PYTHON2) $(.common)/pump.py $(>[1]) $(<)
}
actions ltocc
{
cd $(>[1]:D)
ecl -shell $(>[1]) $(<)
}