Skip to content

Commit

Permalink
build: fold dtrace targets into actions
Browse files Browse the repository at this point in the history
  • Loading branch information
refack committed Apr 11, 2019
1 parent 655c90b commit 2d25fcf
Show file tree
Hide file tree
Showing 2 changed files with 208 additions and 212 deletions.
185 changes: 185 additions & 0 deletions dtrace.gypi
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
{
'defines': ['HAVE_DTRACE=1'],
'variables': {
'generated_node_dtrace_header': '<(INTERMEDIATE_DIR)/node_dtrace_header',
},
'include_dirs': [
'<(generated_node_dtrace_header)'
],
#
# DTrace is supported on linux, solaris, mac, and bsd. There are
# three object files associated with DTrace support, but they're
# not all used all the time:
#
# node_dtrace.o all configurations
# node_dtrace_ustack.o not supported on mac and linux
# node_dtrace_provider.o All except OS X. "dtrace -G" is not
# used on OS X.
#
# Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not
# actually exist. They're listed here to trick GYP into linking the
# corresponding object files into the final "node" executable. These
# object files are generated by "dtrace -G" using custom actions
# below, and the GYP-generated Makefiles will properly build them when
# needed.
#
'sources': [
'src/node_dtrace.h',
'src/node_dtrace.cc',
],
'conditions': [
['OS=="linux"', {
'actions': [
{
'action_name': 'node_dtrace_header',
'process_outputs_as_sources': 1,
'inputs': [
'src/node_provider.d'
],
'outputs': [
'<(generated_node_dtrace_header)/node_provider.h'
],
'action': [
'dtrace', '-h',
'-s', '<@(_inputs)',
'-o', '<@(_outputs)',
]
},
{
'action_name': 'node_dtrace_provider_o',
'process_outputs_as_sources': 1,
'inputs': [
'src/node_provider.d'
],
'outputs': [
'<(generated_node_dtrace_header)/node_dtrace_provider.o'
],
'action': [
'dtrace', '-C', '-G',
'-s', '<@(_inputs)',
'-o', '<@(_outputs)',
],
},
],
}],
['node_use_dtrace=="true" and OS!="linux"', {
'actions': [
{
'action_name': 'node_dtrace_header',
'process_outputs_as_sources': 1,
'inputs': ['src/node_provider.d'],
'outputs': ['<(generated_node_dtrace_header)/node_provider.h'],
'action': ['dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)',
'-o', '<@(_outputs)']
}
]
}],
['node_use_dtrace=="true" and OS=="linux"', {
'actions': [
{
'action_name': 'node_dtrace_header',
'process_outputs_as_sources': 1,
'inputs': ['src/node_provider.d'],
'outputs': ['<(generated_node_dtrace_header)/node_provider.h'],
'action': ['dtrace', '-h', '-s', '<@(_inputs)',
'-o', '<@(_outputs)']
}
]
}],
['node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
'actions': [
{
'action_name': 'node_dtrace_provider_o',
'process_outputs_as_sources': 1,
'inputs': [
'<(obj_dir)/<(node_lib_target_name)/src/node_dtrace.o',
],
'outputs': [
'<(obj_dir)/<(node_lib_target_name)/src/node_dtrace_provider.o'
],
'action': ['dtrace', '-G', '-xnolibs', '-s', 'src/node_provider.d',
'<@(_inputs)', '-o', '<@(_outputs)']
}
]
}],
['node_use_dtrace=="true" and OS=="linux"', {
'actions': [
{
'action_name': 'node_dtrace_provider_o',
'process_outputs_as_sources': 1,
'inputs': ['src/node_provider.d'],
'outputs': [
'<(generated_node_dtrace_header)/node_dtrace_provider.o'
],
'action': [
'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)'
],
}
],
}],
['node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
'actions': [
{
'action_name': 'node_dtrace_ustack_constants',
'process_outputs_as_sources': 1,
'inputs': [
'<(v8_base)'
],
'outputs': [
'<(generated_node_dtrace_header)/v8constants.h'
],
'action': [
'tools/genv8constants.py',
'<@(_outputs)',
'<@(_inputs)'
]
},
{
'action_name': 'node_dtrace_ustack',
'process_outputs_as_sources': 1,
'inputs': [
'src/v8ustack.d',
'<(generated_node_dtrace_header)/v8constants.h'
],
'outputs': [
'<(obj_dir)/<(node_lib_target_name)/src/node_dtrace_ustack.o'
],
'conditions': [
['target_arch=="ia32" or target_arch=="arm"', {
'action': [
'dtrace', '-32', '-I<(generated_node_dtrace_header)', '-Isrc',
'-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
]
}],
['target_arch=="x64"', {
'action': [
'dtrace', '-64', '-I<(generated_node_dtrace_header)', '-Isrc',
'-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
]
}],
]
},
]
}],
['node_use_dtrace=="true"', {
'actions': [
{
'action_name': 'specialize_node_d',
'inputs': [
'src/node.d'
],
'outputs': [
'<(PRODUCT_DIR)/node.d',
],
'action': [
'tools/specialize_node_d.py',
'<@(_outputs)',
'<@(_inputs)',
'<@(OS)',
'<@(target_arch)',
],
},
],
}],
],
}
Loading

0 comments on commit 2d25fcf

Please sign in to comment.