Skip to content

Commit 2d25fcf

Browse files
committed
build: fold dtrace targets into actions
1 parent 655c90b commit 2d25fcf

File tree

2 files changed

+208
-212
lines changed

2 files changed

+208
-212
lines changed

dtrace.gypi

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
{
2+
'defines': ['HAVE_DTRACE=1'],
3+
'variables': {
4+
'generated_node_dtrace_header': '<(INTERMEDIATE_DIR)/node_dtrace_header',
5+
},
6+
'include_dirs': [
7+
'<(generated_node_dtrace_header)'
8+
],
9+
#
10+
# DTrace is supported on linux, solaris, mac, and bsd. There are
11+
# three object files associated with DTrace support, but they're
12+
# not all used all the time:
13+
#
14+
# node_dtrace.o all configurations
15+
# node_dtrace_ustack.o not supported on mac and linux
16+
# node_dtrace_provider.o All except OS X. "dtrace -G" is not
17+
# used on OS X.
18+
#
19+
# Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not
20+
# actually exist. They're listed here to trick GYP into linking the
21+
# corresponding object files into the final "node" executable. These
22+
# object files are generated by "dtrace -G" using custom actions
23+
# below, and the GYP-generated Makefiles will properly build them when
24+
# needed.
25+
#
26+
'sources': [
27+
'src/node_dtrace.h',
28+
'src/node_dtrace.cc',
29+
],
30+
'conditions': [
31+
['OS=="linux"', {
32+
'actions': [
33+
{
34+
'action_name': 'node_dtrace_header',
35+
'process_outputs_as_sources': 1,
36+
'inputs': [
37+
'src/node_provider.d'
38+
],
39+
'outputs': [
40+
'<(generated_node_dtrace_header)/node_provider.h'
41+
],
42+
'action': [
43+
'dtrace', '-h',
44+
'-s', '<@(_inputs)',
45+
'-o', '<@(_outputs)',
46+
]
47+
},
48+
{
49+
'action_name': 'node_dtrace_provider_o',
50+
'process_outputs_as_sources': 1,
51+
'inputs': [
52+
'src/node_provider.d'
53+
],
54+
'outputs': [
55+
'<(generated_node_dtrace_header)/node_dtrace_provider.o'
56+
],
57+
'action': [
58+
'dtrace', '-C', '-G',
59+
'-s', '<@(_inputs)',
60+
'-o', '<@(_outputs)',
61+
],
62+
},
63+
],
64+
}],
65+
['node_use_dtrace=="true" and OS!="linux"', {
66+
'actions': [
67+
{
68+
'action_name': 'node_dtrace_header',
69+
'process_outputs_as_sources': 1,
70+
'inputs': ['src/node_provider.d'],
71+
'outputs': ['<(generated_node_dtrace_header)/node_provider.h'],
72+
'action': ['dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)',
73+
'-o', '<@(_outputs)']
74+
}
75+
]
76+
}],
77+
['node_use_dtrace=="true" and OS=="linux"', {
78+
'actions': [
79+
{
80+
'action_name': 'node_dtrace_header',
81+
'process_outputs_as_sources': 1,
82+
'inputs': ['src/node_provider.d'],
83+
'outputs': ['<(generated_node_dtrace_header)/node_provider.h'],
84+
'action': ['dtrace', '-h', '-s', '<@(_inputs)',
85+
'-o', '<@(_outputs)']
86+
}
87+
]
88+
}],
89+
['node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
90+
'actions': [
91+
{
92+
'action_name': 'node_dtrace_provider_o',
93+
'process_outputs_as_sources': 1,
94+
'inputs': [
95+
'<(obj_dir)/<(node_lib_target_name)/src/node_dtrace.o',
96+
],
97+
'outputs': [
98+
'<(obj_dir)/<(node_lib_target_name)/src/node_dtrace_provider.o'
99+
],
100+
'action': ['dtrace', '-G', '-xnolibs', '-s', 'src/node_provider.d',
101+
'<@(_inputs)', '-o', '<@(_outputs)']
102+
}
103+
]
104+
}],
105+
['node_use_dtrace=="true" and OS=="linux"', {
106+
'actions': [
107+
{
108+
'action_name': 'node_dtrace_provider_o',
109+
'process_outputs_as_sources': 1,
110+
'inputs': ['src/node_provider.d'],
111+
'outputs': [
112+
'<(generated_node_dtrace_header)/node_dtrace_provider.o'
113+
],
114+
'action': [
115+
'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)'
116+
],
117+
}
118+
],
119+
}],
120+
['node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
121+
'actions': [
122+
{
123+
'action_name': 'node_dtrace_ustack_constants',
124+
'process_outputs_as_sources': 1,
125+
'inputs': [
126+
'<(v8_base)'
127+
],
128+
'outputs': [
129+
'<(generated_node_dtrace_header)/v8constants.h'
130+
],
131+
'action': [
132+
'tools/genv8constants.py',
133+
'<@(_outputs)',
134+
'<@(_inputs)'
135+
]
136+
},
137+
{
138+
'action_name': 'node_dtrace_ustack',
139+
'process_outputs_as_sources': 1,
140+
'inputs': [
141+
'src/v8ustack.d',
142+
'<(generated_node_dtrace_header)/v8constants.h'
143+
],
144+
'outputs': [
145+
'<(obj_dir)/<(node_lib_target_name)/src/node_dtrace_ustack.o'
146+
],
147+
'conditions': [
148+
['target_arch=="ia32" or target_arch=="arm"', {
149+
'action': [
150+
'dtrace', '-32', '-I<(generated_node_dtrace_header)', '-Isrc',
151+
'-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
152+
]
153+
}],
154+
['target_arch=="x64"', {
155+
'action': [
156+
'dtrace', '-64', '-I<(generated_node_dtrace_header)', '-Isrc',
157+
'-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
158+
]
159+
}],
160+
]
161+
},
162+
]
163+
}],
164+
['node_use_dtrace=="true"', {
165+
'actions': [
166+
{
167+
'action_name': 'specialize_node_d',
168+
'inputs': [
169+
'src/node.d'
170+
],
171+
'outputs': [
172+
'<(PRODUCT_DIR)/node.d',
173+
],
174+
'action': [
175+
'tools/specialize_node_d.py',
176+
'<@(_outputs)',
177+
'<@(_inputs)',
178+
'<@(OS)',
179+
'<@(target_arch)',
180+
],
181+
},
182+
],
183+
}],
184+
],
185+
}

0 commit comments

Comments
 (0)