doc: mention `binary` as deafult for Hash strings
[platform/upstream/nodejs.git] / common.gypi
1 {
2   'variables': {
3     'visibility%': 'hidden',         # V8's visibility setting
4     'target_arch%': 'ia32',          # set v8's target architecture
5     'host_arch%': 'ia32',            # set v8's host architecture
6     'want_separate_host_toolset': 0, # V8 should not build target and host
7     'library%': 'static_library',    # allow override to 'shared_library' for DLL/.so builds
8     'component%': 'static_library',  # NB. these names match with what V8 expects
9     'msvs_multi_core_compile': '0',  # we do enable multicore compiles, but not using the V8 way
10     'gcc_version%': 'unknown',
11     'clang%': 0,
12     'python%': 'python',
13
14     # Turn on optimizations that may trigger compiler bugs.
15     # Use at your own risk. Do *NOT* report bugs if this option is enabled.
16     'node_unsafe_optimizations%': 0,
17
18     # Enable V8's post-mortem debugging only on unix flavors.
19     'conditions': [
20       ['OS != "win"', {
21         'v8_postmortem_support': 'true'
22       }]
23     ],
24   },
25
26   'target_defaults': {
27     'default_configuration': 'Release',
28     'configurations': {
29       'Debug': {
30         'defines': [ 'DEBUG', '_DEBUG' ],
31         'cflags': [ '-g', '-O0' ],
32         'conditions': [
33           ['target_arch=="x64"', {
34             'msvs_configuration_platform': 'x64',
35           }],
36         ],
37         'msvs_settings': {
38           'VCCLCompilerTool': {
39             'RuntimeLibrary': 1, # static debug
40             'Optimization': 0, # /Od, no optimization
41             'MinimalRebuild': 'false',
42             'OmitFramePointers': 'false',
43             'BasicRuntimeChecks': 3, # /RTC1
44           },
45           'VCLinkerTool': {
46             'LinkIncremental': 2, # enable incremental linking
47           },
48         },
49         'xcode_settings': {
50           'GCC_OPTIMIZATION_LEVEL': '0', # stop gyp from defaulting to -Os
51         },
52       },
53       'Release': {
54         'conditions': [
55           ['target_arch=="x64"', {
56             'msvs_configuration_platform': 'x64',
57           }],
58           ['node_unsafe_optimizations==1', {
59             'cflags': [ '-O3', '-ffunction-sections', '-fdata-sections' ],
60             'ldflags': [ '-Wl,--gc-sections' ],
61           }, {
62             'cflags': [ '-O2', '-fno-strict-aliasing' ],
63             'cflags!': [ '-O3', '-fstrict-aliasing' ],
64             'conditions': [
65               # Required by the dtrace post-processor. Unfortunately,
66               # some gcc/binutils combos generate bad code when
67               # -ffunction-sections is enabled. Let's hope for the best.
68               ['OS=="solaris"', {
69                 'cflags': [ '-ffunction-sections', '-fdata-sections' ],
70               }, {
71                 'cflags!': [ '-ffunction-sections', '-fdata-sections' ],
72               }],
73               ['clang == 0 and gcc_version >= 40', {
74                 'cflags': [ '-fno-tree-vrp' ],
75               }],
76               ['clang == 0 and gcc_version <= 44', {
77                 'cflags': [ '-fno-tree-sink' ],
78               }],
79             ],
80           }],
81           ['OS=="solaris"', {
82             # pull in V8's postmortem metadata
83             'ldflags': [ '-Wl,-z,allextract' ]
84           }],
85           ['OS!="mac" and OS!="win"', {
86             'cflags': [ '-fno-omit-frame-pointer' ],
87           }],
88         ],
89         'msvs_settings': {
90           'VCCLCompilerTool': {
91             'RuntimeLibrary': 0, # static release
92             'Optimization': 3, # /Ox, full optimization
93             'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
94             'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
95             'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
96             'OmitFramePointers': 'true',
97             'EnableFunctionLevelLinking': 'true',
98             'EnableIntrinsicFunctions': 'true',
99             'RuntimeTypeInfo': 'false',
100             'ExceptionHandling': '0',
101             'AdditionalOptions': [
102               '/MP', # compile across multiple CPUs
103             ],
104           },
105           'VCLibrarianTool': {
106             'AdditionalOptions': [
107               '/LTCG', # link time code generation
108             ],
109           },
110           'VCLinkerTool': {
111             'LinkTimeCodeGeneration': 1, # link-time code generation
112             'OptimizeReferences': 2, # /OPT:REF
113             'EnableCOMDATFolding': 2, # /OPT:ICF
114             'LinkIncremental': 1, # disable incremental linking
115           },
116         },
117       }
118     },
119     'msvs_settings': {
120       'VCCLCompilerTool': {
121         'StringPooling': 'true', # pool string literals
122         'DebugInformationFormat': 3, # Generate a PDB
123         'WarningLevel': 3,
124         'BufferSecurityCheck': 'true',
125         'ExceptionHandling': 1, # /EHsc
126         'SuppressStartupBanner': 'true',
127         'WarnAsError': 'false',
128       },
129       'VCLibrarianTool': {
130       },
131       'VCLinkerTool': {
132         'conditions': [
133           ['target_arch=="x64"', {
134             'TargetMachine' : 17 # /MACHINE:X64
135           }],
136         ],
137         'GenerateDebugInformation': 'true',
138         'RandomizedBaseAddress': 2, # enable ASLR
139         'DataExecutionPrevention': 2, # enable DEP
140         'AllowIsolation': 'true',
141         'SuppressStartupBanner': 'true',
142         'target_conditions': [
143           ['_type=="executable"', {
144             'SubSystem': 1, # console executable
145           }],
146         ],
147       },
148     },
149     'conditions': [
150       ['OS == "win"', {
151         'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
152         'defines': [
153           'WIN32',
154           # we don't really want VC++ warning us about
155           # how dangerous C functions are...
156           '_CRT_SECURE_NO_DEPRECATE',
157           # ... or that C implementations shouldn't use
158           # POSIX names
159           '_CRT_NONSTDC_NO_DEPRECATE',
160           'BUILDING_V8_SHARED=1',
161           'BUILDING_UV_SHARED=1',
162         ],
163       }],
164       [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
165         'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', '-pthread', ],
166         'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
167         'ldflags': [ '-pthread', '-rdynamic' ],
168         'target_conditions': [
169           ['_type=="static_library"', {
170             'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19
171           }],
172         ],
173         'conditions': [
174           [ 'target_arch=="ia32"', {
175             'cflags': [ '-m32' ],
176             'ldflags': [ '-m32' ],
177           }],
178           [ 'target_arch=="x64"', {
179             'cflags': [ '-m64' ],
180             'ldflags': [ '-m64' ],
181           }],
182           [ 'OS=="solaris"', {
183             'cflags': [ '-pthreads' ],
184             'ldflags': [ '-pthreads' ],
185             'cflags!': [ '-pthread' ],
186             'ldflags!': [ '-pthread' ],
187           }],
188         ],
189       }],
190       ['OS=="mac"', {
191         'defines': ['_DARWIN_USE_64_BIT_INODE=1'],
192         'xcode_settings': {
193           'ALWAYS_SEARCH_USER_PATHS': 'NO',
194           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
195           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
196                                                     # (Equivalent to -fPIC)
197           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
198           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
199           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
200           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
201           'PREBINDING': 'NO',                       # No -Wl,-prebind
202           'MACOSX_DEPLOYMENT_TARGET': '10.5',       # -mmacosx-version-min=10.5
203           'USE_HEADERMAP': 'NO',
204           'OTHER_CFLAGS': [
205             '-fno-strict-aliasing',
206           ],
207           'WARNING_CFLAGS': [
208             '-Wall',
209             '-Wendif-labels',
210             '-W',
211             '-Wno-unused-parameter',
212           ],
213         },
214         'target_conditions': [
215           ['_type!="static_library"', {
216             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
217           }],
218         ],
219         'conditions': [
220           ['target_arch=="ia32"', {
221             'xcode_settings': {'ARCHS': ['i386']},
222           }],
223           ['target_arch=="x64"', {
224             'xcode_settings': {'ARCHS': ['x86_64']},
225           }],
226         ],
227       }],
228       ['OS=="freebsd" and node_use_dtrace=="true"', {
229         'libraries': [ '-lelf' ],
230       }]
231     ],
232   }
233 }