2 # 'force_load' means to include the static libs into the shared lib or
3 # executable. Therefore, it is enabled when building:
4 # 1. The executable and it uses static lib (cctest and node)
6 # Linker optimizes out functions that are not used. When force_load=true,
7 # --whole-archive,force_load and /WHOLEARCHIVE are used to include
8 # all obj files in static libs into the executable or shared lib.
12 'force_load%': 'true',
13 'current_type%': '<(_type)',
15 'force_load%': '<(force_load)',
17 ['current_type=="static_library"', {
18 'force_load': 'false',
20 [ 'current_type=="executable" and node_target_type=="shared_library"', {
21 'force_load': 'false',
25 'force_load%': '<(force_load)',
26 'lwnode_jsengine_path%': 'deps/v8',
31 'cflags': [ '-Werror=undefined-inline', ]
33 [ 'node_shared=="false" and "<(_type)"=="executable"', {
36 'EmbedManifest': 'true',
37 'AdditionalManifestFiles': 'src/res/node.exe.extra.manifest'
41 [ 'node_shared=="true"', {
48 'NODE_PLATFORM="win"',
52 # we need to use node's preferred "win32" rather than gyp's preferred "win"
53 'NODE_PLATFORM="win32"',
54 # Stop <windows.h> from defining macros that conflict with
55 # std::min() and std::max(). We don't use <windows.h> (much)
56 # but we still inherit it from uv.h.
60 'msvs_precompiled_header': 'tools/msvs/pch/node_pch.h',
61 'msvs_precompiled_source': 'tools/msvs/pch/node_pch.cc',
63 '<(_msvs_precompiled_header)',
64 '<(_msvs_precompiled_source)',
67 'defines': [ '__POSIX__' ],
69 [ 'node_enable_d8=="true"', {
70 'dependencies': [ 'tools/v8_gypfiles/d8.gyp:d8' ],
72 [ 'node_use_bundled_v8=="true"', {
74 'tools/v8_gypfiles/v8.gyp:v8_snapshot',
75 'tools/v8_gypfiles/v8.gyp:v8_libplatform',
78 [ 'node_use_v8_platform=="true"', {
80 'NODE_USE_V8_PLATFORM=1',
84 'NODE_USE_V8_PLATFORM=0',
88 'defines': [ 'NODE_TAG="<(node_tag)"' ],
90 [ 'node_v8_options!=""', {
91 'defines': [ 'NODE_V8_OPTIONS="<(node_v8_options)"'],
93 [ 'node_release_urlbase!=""', {
95 'NODE_RELEASE_URLBASE="<(node_release_urlbase)"',
98 [ 'v8_enable_i18n_support==1', {
99 'defines': [ 'NODE_HAVE_I18N_SUPPORT=1' ],
101 '<(icu_gyp_path):icui18n',
102 '<(icu_gyp_path):icuuc',
105 [ 'icu_small=="true"', {
106 'defines': [ 'NODE_HAVE_SMALL_ICU=1' ],
108 [ 'icu_default_data!=""', {
110 'NODE_ICU_DEFAULT_DATA_DIR="<(icu_default_data)"',
116 [ 'node_no_browser_globals=="true"', {
117 'defines': [ 'NODE_NO_BROWSER_GLOBALS' ],
119 [ 'node_shared_zlib=="false"', {
120 'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
122 [ 'force_load=="true"', {
125 '-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)zlib<(STATIC_LIB_SUFFIX)',
130 'AdditionalOptions': [
131 '/WHOLEARCHIVE:zlib<(STATIC_LIB_SUFFIX)',
136 ['OS!="aix" and node_shared=="false"', {
138 '-Wl,--whole-archive',
139 '<(obj_dir)/deps/zlib/<(STATIC_LIB_PREFIX)zlib<(STATIC_LIB_SUFFIX)',
140 '-Wl,--no-whole-archive',
148 [ 'node_shared_http_parser=="false"', {
150 'deps/llhttp/llhttp.gyp:llhttp'
154 [ 'node_shared_cares=="false"', {
155 'dependencies': [ 'deps/cares/cares.gyp:cares' ],
158 [ 'node_shared_libuv=="false"', {
159 'dependencies': [ 'deps/uv/uv.gyp:libuv' ],
161 [ 'force_load=="true"', {
164 '-Wl,-force_load,<(PRODUCT_DIR)/libuv<(STATIC_LIB_SUFFIX)',
169 'AdditionalOptions': [
170 '/WHOLEARCHIVE:libuv<(STATIC_LIB_SUFFIX)',
175 ['OS!="aix" and node_shared=="false"', {
177 '-Wl,--whole-archive',
178 '<(obj_dir)/deps/uv/<(STATIC_LIB_PREFIX)uv<(STATIC_LIB_SUFFIX)',
179 '-Wl,--no-whole-archive',
187 [ 'node_shared_nghttp2=="false"', {
188 'dependencies': [ 'deps/nghttp2/nghttp2.gyp:nghttp2' ],
191 [ 'node_shared_brotli=="false"', {
192 'dependencies': [ 'deps/brotli/brotli.gyp:brotli' ],
196 # linking Corefoundation is needed since certain OSX debugging tools
197 # like Instruments require it for some features
198 'libraries': [ '-framework CoreFoundation' ],
200 'NODE_PLATFORM="mac"',
203 # we need to use node's preferred "darwin" rather than gyp's preferred "mac"
204 'NODE_PLATFORM="darwin"',
215 '_LINUX_SOURCE_COMPAT',
216 '__STDC_FORMAT_MACROS',
219 [ 'force_load=="true"', {
221 'exp_filename': '<(PRODUCT_DIR)/<(_target_name).exp',
225 'action_name': 'expfile',
233 'sh', 'tools/create_expfile.sh',
240 '-Wl,-bE:<(exp_filename)',
252 'NODE_PLATFORM="solaris"',
255 # we need to use node's preferred "sunos"
256 # rather than gyp's preferred "solaris"
257 'NODE_PLATFORM="sunos"',
260 [ 'lwnode=="false" and (OS=="freebsd" or OS=="linux") and node_shared=="false"'
261 ' and force_load=="true"', {
263 '-Wl,-z,noexecstack',
264 '-Wl,--whole-archive <(v8_base)',
265 '-Wl,--no-whole-archive',
268 [ 'node_use_bundled_v8=="true" and v8_postmortem_support==1 and force_load=="true"', {
271 '-Wl,-force_load,<(v8_base)',
275 [ 'debug_node=="true"', {
276 'cflags!': [ '-O3' ],
277 'cflags': [ '-g', '-O0' ],
278 'defines': [ 'DEBUG' ],
285 [ 'coverage=="true" and node_shared=="false" and OS in "mac freebsd linux"', {
286 'cflags!': [ '-O3' ],
287 'ldflags': [ '--coverage',
290 'cflags': [ '--coverage',
301 [ '_type=="executable"', {
303 'OTHER_LDFLAGS': [ '--coverage', ],
309 'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ],
316 [ 'OS in "freebsd linux"', {
317 'ldflags': [ '-Wl,-z,relro',
320 [ 'node_use_openssl=="true"', {
321 'defines': [ 'HAVE_OPENSSL=1' ],
323 ['openssl_fips != "" or openssl_is_fips=="true"', {
324 'defines': [ 'NODE_FIPS_MODE' ],
326 [ 'node_shared_openssl=="false"', {
328 './deps/openssl/openssl.gyp:openssl',
331 './deps/openssl/openssl.gyp:openssl-cli',
334 # -force_load or --whole-archive are not applicable for
336 [ 'force_load=="true"', {
339 '-Wl,-force_load,<(PRODUCT_DIR)/<(openssl_product)',
344 'AdditionalOptions': [
345 '/WHOLEARCHIVE:<(openssl_product)',
350 ['OS in "linux freebsd" and node_shared=="false"', {
352 '-Wl,--whole-archive,'
353 '<(obj_dir)/deps/openssl/<(openssl_product)',
354 '-Wl,--no-whole-archive',
357 # openssl.def is based on zlib.def, zlib symbols
358 # are always exported.
359 ['use_openssl_def==1', {
360 'sources': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'],
362 ['OS=="win" and use_openssl_def==0', {
363 'sources': ['deps/zlib/win32/zlib.def'],
371 'defines': [ 'HAVE_OPENSSL=0' ]