windows syntax error C2059 fix
[iotivity.git] / auto_build.py
1 #!/usr/bin/python
2
3 import os
4 import sys
5 import platform
6 import subprocess
7 import multiprocessing
8
9
10 # help message
11 def helpmsg(script):
12     helpstr = '''
13 Usage:
14
15 To build:
16     python %s <targetbuild>
17 To clean:
18     python %s -c
19
20 EXEC_MODE=True/False (default false) to suppress running the commands.
21 VERBOSE=0/1 (default 1) to tell scons to print more information.
22
23 Allowed values for <target_build>: 
24     all linux linux_unsecured linux_secured linux_full linux_unsecured_with_tcp
25     linux_unsecured_with_rd linux_secured_with_rd linux_unsecured_with_mq
26     linux_secured_with_tcp linux_unsecured_with_java linux_secured_with_java
27     android android_universal android_universal_unsecured
28     android_unsecured android_secured android_x86 android_x86_with_ip
29     android_x86_with_bt android_x86_with_ble android_x86_with_rm_and_ip
30     android_x86_with_rm_and_bt android_x86_with_rm_and_ble android_armeabi
31     android_armeabi_with_ip android_armeabi_with_bt android_armeabi_with_ble
32     android_armeabi_with_rm_and_ip android_armeabi_with_rm_and_bt
33     android_armeabi_with_rm_and_ble
34     windows msys simulator darwin tizen tizen_unsecured tizen_secured
35     tizen_extra tizen_extra_unsecured tizen_extra_secured
36     unit_tests unit_tests_secured unit_tests_unsecured
37     unit_tests_memcheck_secured unit_tests_memcheck_unsecured
38
39     Note: nearly all of these are combination builds, which means they
40     are not useful to get a specific build to work on, rather they are
41     useful for "make sure all these build" tests as used by the Jenkins CI.
42     Any selection will build both debug and release versions of all available
43     targets in the scope you've selected except for unit tests, which by
44     their nature are debug only.
45     To choose any specific command, please use the SCons commandline directly.
46     Use \"EXEC_MODE=False %s <targetbuild>\"  to see commands to run.
47     '''
48     print (helpstr % (script, script, script))
49     sys.exit(1)
50
51
52 def call_scons(build_options, scons_options):
53     """
54     Format and run a single scons command.
55
56     Args:
57         build_options (dict): build flags with values.
58         scons_options (str): additional flags to scons.
59     """
60     cmd_line = "scons VERBOSE=" + VERBOSE
61     for key in build_options:
62         cmd_line += " " + key + "=" + str(build_options[key])
63
64     cmd_line += " " + str(scons_options)
65
66     if not EXEC_MODE:
67         print ("Would run : " + cmd_line)
68     else:
69         print ("Running : " + cmd_line)
70         sys.stdout.flush()
71         exit_code = subprocess.Popen(cmd_line, shell=True).wait()
72         if exit_code != 0:
73             sys.exit(exit_code)
74
75
76 def build_all(flag, scons_options):
77     """
78     Build all the variants appropriate for the host platform.
79
80     Args:
81         flag (bool): if True, build in Release mode.
82         scons_options (dict): additional flags to scons.
83     """
84     if platform.system() == "Linux":
85         build_linux_unsecured(flag, scons_options)
86         build_linux_secured(flag, scons_options)
87         build_linux_unsecured_with_rm(flag, scons_options)
88         build_linux_unsecured_with_rd(flag, scons_options)
89         build_linux_secured_with_rd(flag, scons_options)
90         build_linux_unsecured_with_mq(flag, scons_options)
91         build_linux_unsecured_with_tcp(flag, scons_options)
92         build_linux_secured_with_tcp(flag, scons_options)
93         build_linux_unsecured_with_java(flag, scons_options)
94         build_linux_secured_with_java(flag, scons_options)
95         build_simulator(flag, scons_options)
96
97         build_android_unsecured(flag, scons_options)
98         build_android_secured(flag, scons_options)
99         build_tizen(flag, scons_options)
100
101     # Note: supported Windows mode is to use run.bat instead
102     if platform.system() == "Windows":
103         build_windows(flag, scons_options)
104
105     if platform.system() == "Darwin":
106         build_darwin(flag, scons_options)
107
108
109 def build_linux(flag, scons_options):
110     build_linux_unsecured(flag, scons_options)
111     build_linux_secured(flag, scons_options)
112
113
114 def build_linux_secured(flag, scons_options):
115     print ("*********** Build for linux with Security *************")
116     build_options = {
117         'RELEASE': flag,
118         'ERROR_ON_WARN': 1,
119     }
120     call_scons(build_options, scons_options)
121
122
123 def build_linux_unsecured(flag, scons_options):
124     print ("*********** Build for linux ************")
125     build_options = {
126         'RELEASE': flag,
127         'SECURED': 0,
128         'ERROR_ON_WARN': 1,
129     }
130     call_scons(build_options, scons_options)
131
132
133 def build_linux_secured_with_tcp(flag, scons_options):
134     print ("*********** Build for linux with Secured TCP ************")
135     build_options = {
136         'RELEASE': flag,
137         'WITH_TCP': 1,
138         'WITH_CLOUD': 1,
139         'ERROR_ON_WARN': 1,
140     }
141     call_scons(build_options, scons_options)
142
143
144 def build_linux_unsecured_with_tcp(flag, scons_options):
145     print ("*********** Build for linux with TCP ************")
146     build_options = {
147         'RELEASE': flag,
148         'WITH_TCP': 1,
149         'TARGET_TRANSPORT': 'IP',
150         'SECURED': 0,
151         'ERROR_ON_WARN': 1,
152     }
153     call_scons(build_options, scons_options)
154
155
156 def build_linux_unsecured_with_java(flag, scons_options):
157     print ("*********** Build for linux with Java support ************")
158     build_options = {
159         'RELEASE': flag,
160         'BUILD_JAVA': 1,
161         'TARGET_TRANSPORT': 'IP',
162         'SECURED': 0,
163         'ERROR_ON_WARN': 1,
164     }
165     call_scons(build_options, scons_options)
166
167
168 def build_linux_secured_with_java(flag, scons_options):
169     print ("*********** Build for linux with Java support and secured ************")
170     build_options = {
171         'RELEASE': flag,
172         'BUILD_JAVA': 1,
173         'TARGET_TRANSPORT': 'IP',
174         'SECURED': 1,
175         'ERROR_ON_WARN': 1,
176     }
177     call_scons(build_options, scons_options)
178
179
180 def build_linux_unsecured_with_rm(flag, scons_options):
181     print ("*********** Build for linux with RoutingManager************")
182     build_options = {
183         'ROUTING': 'GW',
184         'RELEASE': flag,
185         'SECURED': 0,
186         'ERROR_ON_WARN': 1,
187     }
188     call_scons(build_options, scons_options)
189
190
191 def build_linux_full(flag, scons_options):
192     """
193     Secured build with as many options selected as possible.
194     """
195     print ("*********** Build for linux with full features *************")
196     build_options = {
197         'BUILD_JAVA': 1,
198         'MULTIPLE_OWNER': 1,
199         'RELEASE': flag,
200         'SECURED': 1,
201         'WITH_CLOUD': 1,
202         'WITH_PROXY': 1,
203         'WITH_RA': 1,
204         'WITH_RA_IBB': 1,
205         'WITH_TCP': 1,
206         'ERROR_ON_WARN': 1,
207     }
208     call_scons(build_options, scons_options)
209
210
211 def build_linux_unsecured_with_rd(flag, scons_options):
212     print ("*********** Build for linux With Resource Directory *************")
213     build_options = {
214         'RELEASE': flag,
215         'RD_MODE': 'all',
216         'SECURED': 0,
217         'ERROR_ON_WARN': 1,
218     }
219     call_scons(build_options, scons_options)
220
221
222 def build_linux_secured_with_rd(flag, scons_options):
223     print ("*********** Build for linux With Resource Directory & Security ************")
224     build_options = {
225         'RELEASE': flag,
226         'RD_MODE': 'all',
227         'ERROR_ON_WARN': 1,
228     }
229     call_scons(build_options, scons_options)
230
231
232 def build_linux_unsecured_with_mq(flag, scons_options):
233     print ("*********** Build for linux With Message Queue ************")
234     build_options = {
235         'RELEASE': flag,
236         'WITH_MQ': 'PUB,SUB,BROKER',
237         'SECURED': 0,
238         'ERROR_ON_WARN': 1,
239     }
240     call_scons(build_options, scons_options)
241
242
243 def build_android(flag, scons_options):
244     # Note: for android, as oic-resource uses C++11 feature stoi and to_string,
245     # it requires gcc-4.9, currently only android-ndk-r10(for linux)
246     # and windows android-ndk-r10(64bit target version) support these features.
247     print ("*********** Build for android armeabi *************")
248     build_options = {
249         'TARGET_OS': 'android',
250         'TARGET_ARCH': 'armeabi',
251         'RELEASE': flag,
252     }
253     call_scons(build_options, scons_options)
254
255
256 def build_android_universal(flag, scons_options):
257     print('''
258 *******************************************************************************
259     Starting Android Universal build
260     This Will take a very long time to complete. It will build the android
261     build for the following architectures.
262        - armeabi
263        - armeabi-v7a
264        - arm64-v8a
265        - x86
266        - x86_64
267     If you do not need to build a universal APK or you can target a specific
268     architecture we recommend you build android for that specific target. 
269 *******************************************************************************
270 ''')
271     print ("*********** Build for android armeabi *************")
272     build_options = {
273         'TARGET_OS': 'android',
274         'TARGET_ARCH': 'armeabi',
275         'RELEASE': flag,
276     }
277     call_scons(build_options, scons_options)
278     print ("*********** Build for android x86 *************")
279     build_options = {
280         'TARGET_OS': 'android',
281         'TARGET_ARCH': 'x86',
282         'RELEASE': flag,
283     }
284     call_scons(build_options, scons_options)
285     print ("*********** Build for android armeabi-v7a *************")
286     build_options = {
287         'TARGET_OS': 'android',
288         'TARGET_ARCH': 'armeabi-v7a',
289         'RELEASE': flag,
290     }
291     call_scons(build_options, scons_options)
292     print ("*********** Build for android x86_64 *************")
293     build_options = {
294         'TARGET_OS': 'android',
295         'TARGET_ARCH': 'x86_64',
296         'RELEASE': flag,
297     }
298     call_scons(build_options, scons_options)
299     print ("*********** Build for android arm64-v8a *************")
300     build_options = {
301         'TARGET_OS': 'android',
302         'TARGET_ARCH': 'arm64-v8a',
303         'RELEASE': flag,
304     }
305     call_scons(build_options, scons_options)
306     print ("*********** Finishing Android universal build *************")
307
308
309 def build_android_secured(flag, scons_options):
310     build_android(flag, scons_options + " SECURED=1")
311
312
313 def build_android_unsecured(flag, scons_options):
314     build_android(flag, scons_options + " SECURED=0")
315
316
317 def build_android_x86(flag, scons_options):
318     """ Build Android x86 Suite """
319     build_android_x86_with_ip(flag, scons_options)
320     build_android_x86_with_bt(flag, scons_options)
321     build_android_x86_with_ble(flag, scons_options)
322
323
324 def build_android_x86_with_ip(flag, scons_options):
325     print ("*********** Build for android x86 *************")
326     build_options = {
327         'TARGET_OS': 'android',
328         'TARGET_ARCH': 'x86',
329         'RELEASE': flag,
330         'TARGET_TRANSPORT': 'IP',
331     }
332     call_scons(build_options, scons_options)
333
334
335 def build_android_x86_with_bt(flag, scons_options):
336     print ("*********** Build for android x86 with Bluetooth *************")
337     build_options = {
338         'TARGET_OS': 'android',
339         'TARGET_ARCH': 'x86',
340         'RELEASE': flag,
341         'TARGET_TRANSPORT': 'BT',
342     }
343     call_scons(build_options, scons_options)
344
345
346 def build_android_x86_with_ble(flag, scons_options):
347     print ("*********** Build for android x86 with Bluetooth Low Energy *************")
348     build_options = {
349         'TARGET_OS': 'android',
350         'TARGET_ARCH': 'x86',
351         'RELEASE': flag,
352         'TARGET_TRANSPORT': 'BLE',
353     }
354     call_scons(build_options, scons_options)
355
356
357 def build_android_x86_with_rm(flag, scons_options):
358     """ Build Android x86 Routing Manager Suite """
359     build_android_x86_with_rm_and_ip(flag, scons_options)
360     build_android_x86_with_rm_and_bt(flag, scons_options)
361     build_android_x86_with_rm_and_ble(flag, scons_options)
362
363
364 def build_android_x86_with_rm_and_ip(flag, scons_options):
365     print ("*********** Build for android x86 with Routing Manager *************")
366     build_options = {
367         'TARGET_OS': 'android',
368         'TARGET_ARCH': 'x86',
369         'ROUTING': 'GW',
370         'RELEASE': flag,
371         'TARGET_TRANSPORT': 'IP',
372     }
373     call_scons(build_options, scons_options)
374
375
376 def build_android_x86_with_rm_and_bt(flag, scons_options):
377     print ("*********** Build for android x86 with Routing Manager and Bluetooth *************")
378     build_options = {
379         'TARGET_OS': 'android',
380         'TARGET_ARCH': 'x86',
381         'ROUTING': 'GW',
382         'RELEASE': flag,
383         'TARGET_TRANSPORT': 'BT',
384     }
385     call_scons(build_options, scons_options)
386
387
388 def build_android_x86_with_rm_and_ble(flag, scons_options):
389     print ("*********** Build for android x86 with Routing Manager and Bluetooth Low Energy *************")
390     build_options = {
391         'TARGET_OS': 'android',
392         'TARGET_ARCH': 'x86',
393         'ROUTING': 'GW',
394         'RELEASE': flag,
395         'TARGET_TRANSPORT': 'BLE',
396     }
397     call_scons(build_options, scons_options)
398
399
400 def build_android_armeabi(flag, scons_options):
401     """ Build Android Armeabi Suite """
402     build_android_armeabi_with_ip(flag, scons_options)
403     build_android_armeabi_with_bt(flag, scons_options)
404     build_android_armeabi_with_ble(flag, scons_options)
405
406
407 def build_android_armeabi_with_ip(flag, scons_options):
408     print ("*********** Build for android armeabi *************")
409     build_options = {
410         'TARGET_OS': 'android',
411         'TARGET_ARCH': 'armeabi',
412         'RELEASE': flag,
413         'TARGET_TRANSPORT': 'IP',
414     }
415     call_scons(build_options, scons_options)
416
417
418 def build_android_armeabi_with_bt(flag, scons_options):
419     print ("*********** Build for android armeabi with Bluetooth *************")
420     build_options = {
421         'TARGET_OS': 'android',
422         'TARGET_ARCH': 'armeabi',
423         'RELEASE': flag,
424         'TARGET_TRANSPORT': 'BT',
425     }
426     call_scons(build_options, scons_options)
427
428
429 def build_android_armeabi_with_ble(flag, scons_options):
430     print ("*********** Build for android armeabi with Bluetooth Low Energy *************")
431     build_options = {
432         'TARGET_OS': 'android',
433         'TARGET_ARCH': 'armeabi',
434         'RELEASE': flag,
435         'TARGET_TRANSPORT': 'BLE',
436     }
437     call_scons(build_options, scons_options)
438
439
440 def build_android_armeabi_with_rm(flag, scons_options):
441     """ Build Android Armeabi Routing Manager Suite """
442     build_android_armeabi_with_rm_and_ip(flag, scons_options)
443     build_android_armeabi_with_rm_and_bt(flag, scons_options)
444     build_android_armeabi_with_rm_and_ble(flag, scons_options)
445
446
447 def build_android_armeabi_with_rm_and_ip(flag, scons_options):
448     print ("*********** Build for android armeabi with Routing Manager *************")
449     build_options = {
450         'TARGET_OS': 'android',
451         'TARGET_ARCH': 'armeabi',
452         'ROUTING': 'GW',
453         'RELEASE': flag,
454         'TARGET_TRANSPORT': 'IP',
455     }
456     call_scons(build_options, scons_options)
457
458
459 def build_android_armeabi_with_rm_and_bt(flag, scons_options):
460     print ("*********** Build for android armeabi with Routing Manager and Bluetooth *************")
461     build_options = {
462         'TARGET_OS': 'android',
463         'TARGET_ARCH': 'armeabi',
464         'ROUTING': 'GW',
465         'RELEASE': flag,
466         'TARGET_TRANSPORT': 'BT',
467     }
468     call_scons(build_options, scons_options)
469
470
471 def build_android_armeabi_with_rm_and_ble(flag, scons_options):
472     print ("*********** Build for android armeabi with Routing Manager and Bluetooth Low Energy *************")
473     build_options = {
474         'TARGET_OS': 'android',
475         'TARGET_ARCH': 'armeabi',
476         'ROUTING': 'GW',
477         'RELEASE': flag,
478         'TARGET_TRANSPORT': 'BLE',
479     }
480     call_scons(build_options, scons_options)
481
482
483 def build_tizen(flag, scons_options):
484     print ("*********** Build for Tizen with options *************")
485     cmd_line = os.getcwd() + "/gbsbuild.sh" + " " + scons_options
486     if not EXEC_MODE:
487         print ("Would run : " + cmd_line)
488     else:
489         print ("Running : " + cmd_line)
490         exit_code = subprocess.Popen([cmd_line], shell=True).wait()
491         if exit_code != 0:
492             sys.exit(exit_code)
493
494
495 def build_tizen_extra(flag, scons_options):
496     print ("*********** Build for Tizen octbstack lib and sample *************")
497     # make sure the following file as been updated for these builds:
498     # resource/csdk/stack/samples/tizen/build/gbsbuild.sh
499     build_extra_options = "-f resource/csdk/stack/samples/tizen/build/SConscript " + scons_options
500     build_options = {
501         'TARGET_OS': 'tizen',
502         'TARGET_TRANSPORT': 'IP',
503         'LOGGING': 'true',
504         'RELEASE': flag,
505     }
506     call_scons(build_options, build_extra_options)
507
508     print ("*********** Build for Tizen octbstack lib and sample with Routing Manager*************")
509     build_options['ROUTING'] = 'GW'
510     call_scons(build_options, build_extra_options)
511
512     print ("*********** Build for Tizen Easy-Setup sample *************")
513     # make sure the following file has been updated for these builds:
514     # service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh
515     build_options['ROUTING'] = 'EP'
516     build_options['ES_TARGET_ENROLLEE'] = 'tizen'
517     build_extra_options = "-f service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript " + scons_options
518     call_scons(build_options, build_extra_options)
519
520     print ("*********** Build for Tizen Easy-Setup sample with multiple owner *************")
521     build_options['MULTIPLE_OWNER'] = 1
522     call_scons(build_options, build_extra_options)
523
524
525 def build_tizen_secured(flag, scons_options):
526     build_tizen(flag, scons_options + " SECURED=1")
527
528
529 def build_tizen_unsecured(flag, scons_options):
530     build_tizen(flag, scons_options + " SECURED=0")
531
532
533 def build_tizen_extra_secured(flag, scons_options):
534     build_tizen_extra(flag, scons_options + " SECURED=1")
535
536
537 def build_tizen__extraunsecured(flag, scons_options):
538     build_tizen_extra(flag, scons_options + " SECURED=0")
539
540
541 # Mac OS and iOS
542 def build_darwin(flag, scons_options):
543     print ("*********** Build for OSX *************")
544     build_options = {
545         'TARGET_OS': 'darwin',
546         'SYS_VERSION': '10.9',
547         'RELEASE': flag,
548     }
549     call_scons(build_options, scons_options)
550
551     print ("*********** Build for IOS i386 *************")
552     build_options = {
553         'TARGET_OS': 'ios',
554         'TARGET_ARCH': 'i386',
555         'SYS_VERSION': '7.0',
556         'RELEASE': flag,
557     }
558     call_scons(build_options, scons_options)
559
560     print ("*********** Build for IOS x86_64 *************")
561     build_options['TARGET_ARCH'] = 'x86_64'
562     call_scons(build_options, scons_options)
563
564     print ("*********** Build for IOS armv7 *************")
565     build_options['TARGET_ARCH'] = 'armv7'
566     call_scons(build_options, scons_options)
567
568     print ("*********** Build for IOS armv7s *************")
569     build_options['TARGET_ARCH'] = 'armv7s'
570     call_scons(build_options, scons_options)
571
572     print ("*********** Build for IOS arm64 *************")
573     build_options['TARGET_ARCH'] = 'arm64'
574     call_scons(build_options, scons_options)
575
576
577 # Windows
578 def build_windows(flag, scons_options):
579     print ("*********** Build for Windows *************")
580     os.environ["SCONSFLAGS"] = ""
581     build_options = {
582         'TARGET_OS': 'windows',
583         'TARGET_ARCH': 'amd64',
584         'RELEASE': flag,
585         'TARGET_TRANSPORT': 'IP',
586         'WITH_TCP': 0,
587         'BUILD_SAMPLE': 'ON',
588         'LOGGING': 'off',
589         'TEST': 1,
590         'RD_MODE': 'all',
591     }
592     call_scons(build_options, scons_options)
593
594
595 # Windows msys
596 def build_msys(flag, scons_options):
597     print ("*********** Build for msys_nt *************")
598     os.environ["SCONSFLAGS"] = ""
599     build_options = {
600         'TARGET_OS': 'msys_nt',
601         'TARGET_ARCH': 'x86_64',
602         'RELEASE': flag,
603         'TARGET_TRANSPORT': 'IP',
604         'WITH_TCP': 0,
605         'BUILD_SAMPLE': 'ON',
606         'LOGGING': 'off',
607         'TEST': 1,
608         'RD_MODE': 'all',
609     }
610     call_scons(build_options, scons_options)
611
612
613 def build_simulator(flag, scons_options):
614     print ("*********** Build for simulator plugin *************")
615     build_options = {
616         'SIMULATOR': 1,
617         'RELEASE': flag,
618         'SECURED': 0,
619         'TARGET_TRANSPORT': 'IP',
620     }
621     call_scons(build_options, scons_options)
622
623
624 def do_unit_tests(secured=True, memcheck=False):
625     """ build full stack and run unit tests in selected mode.
626
627     All the unit test builders have to run in test (non-release) mode.
628     This option is used by the CI system, which is a virtual machine -
629     thus it should be built with only the IP transport to avoid timeouts
630     setting up infrastructure that is not present (i.e. BT and NFC).
631
632     Args:
633         secured (bool): build in secured mode.
634         memcheck (bool): run tests under control of memory checker.
635     """
636
637     build_options = {
638         'TEST': 1,
639         'RELEASE': 'false',
640         'TARGET_TRANSPORT': 'IP',
641         'SECURED': secured,
642         'VALGRIND_CHECKS': memcheck,
643     }
644     print ("*********** Unit test Start *************")
645     call_scons(build_options, "-c")  # clean first
646     call_scons(build_options, "")
647     print ("*********** Unit test Stop *************")
648
649
650 def unit_tests_secured():
651     do_unit_tests(secured=1)
652
653
654 def unit_tests_unsecured():
655     do_unit_tests(secured=0)
656
657
658 def unit_tests_memcheck_secured():
659     do_unit_tests(secured=1, memcheck=True)
660
661
662 def unit_tests_memcheck_unsecured():
663     do_unit_tests(secured=0, memcheck=True)
664
665
666 def unit_tests():
667     unit_tests_secured()
668     unit_tests_unsecured()
669
670
671 # Main module starts here
672 if os.getenv("SCONSFLAGS", "") == "":
673     os.environ["SCONSFLAGS"] = "-Q -j " + str(multiprocessing.cpu_count())
674
675 arg_num = len(sys.argv)
676 script_name = sys.argv[0]
677
678 # May be overridden in user's shell
679 VERBOSE = os.getenv("VERBOSE", "1")
680 EXEC_MODE = os.getenv("EXEC_MODE", True)
681 if EXEC_MODE in ['false', 'False', '0']:
682     EXEC_MODE = False
683
684 if arg_num == 1:
685     build_all("true", "")
686     build_all("false", "")
687     unit_tests()
688
689 elif arg_num == 2:
690     if str(sys.argv[1]) == '-c':
691         build_all("true", "-c")
692         build_all("false", "-c")
693
694     elif str(sys.argv[1]) == "all":
695         build_all("true", "")
696         build_all("false", "")
697         unit_tests()
698
699     elif str(sys.argv[1]) == "linux":
700         build_linux("true", "")
701         build_linux("false", "")
702
703     elif str(sys.argv[1]) == "linux_unsecured":
704         build_linux_unsecured("true", "")
705         build_linux_unsecured("false", "")
706         build_linux_unsecured_with_rm("true", "")
707         build_linux_unsecured_with_rm("false", "")
708
709     elif str(sys.argv[1]) == "linux_secured":
710         build_linux_secured("true", "")
711         build_linux_secured("false", "")
712
713     elif str(sys.argv[1]) == "linux_full":
714         build_linux_full("true", "")
715         build_linux_full("false", "")
716
717     elif str(sys.argv[1]) == "linux_unsecured_with_rd":
718         build_linux_unsecured_with_rd("true", "")
719         build_linux_unsecured_with_rd("false", "")
720
721     elif str(sys.argv[1]) == "linux_secured_with_rd":
722         build_linux_secured_with_rd("true", "")
723         build_linux_secured_with_rd("false", "")
724
725     elif str(sys.argv[1]) == "linux_unsecured_with_mq":
726         build_linux_unsecured_with_mq("true", "")
727         build_linux_unsecured_with_mq("false", "")
728
729     elif str(sys.argv[1]) == "linux_unsecured_with_tcp":
730         build_linux_unsecured_with_tcp("true", "")
731         build_linux_unsecured_with_tcp("false", "")
732
733     elif str(sys.argv[1]) == "linux_secured_with_tcp":
734         build_linux_secured_with_tcp("false", "")
735         build_linux_secured_with_tcp("true", "")
736
737     elif str(sys.argv[1]) == "linux_unsecured_with_java":
738         build_linux_unsecured_with_java("false", "")
739         build_linux_unsecured_with_java("true", "")
740
741     elif str(sys.argv[1]) == "linux_secured_with_java":
742         build_linux_secured_with_java("false", "")
743         build_linux_secured_with_java("true", "")
744
745     elif str(sys.argv[1]) == "android":
746         build_android("true", "")
747         build_android("false", "")
748
749     elif str(sys.argv[1]) == "android_universal":
750         # only build the release version due to long amount of time to build.
751         build_android_universal("true", "")
752
753     elif str(sys.argv[1]) == "android_universal_unsecured":
754         # only build the release version due to long amount of time to build.
755         build_android_universal("true", "SECURED=0")
756
757     elif str(sys.argv[1]) == "android_unsecured":
758         build_android_unsecured("true", "")
759         build_android_unsecured("false", "")
760
761     elif str(sys.argv[1]) == "android_secured":
762         build_android_secured("true", "")
763         build_android_secured("false", "")
764
765     elif str(sys.argv[1]) == "android_x86":
766         build_android_x86("true", "")
767         build_android_x86("false", "")
768         build_android_x86_with_rm("true", "")
769         build_android_x86_with_rm("false", "")
770
771     elif str(sys.argv[1]) == "android_x86_with_ip":
772         build_android_x86_with_ip("true", "")
773         build_android_x86_with_ip("false", "")
774
775     elif str(sys.argv[1]) == "android_x86_with_bt":
776         build_android_x86_with_bt("true", "")
777         build_android_x86_with_bt("false", "")
778
779     elif str(sys.argv[1]) == "android_x86_with_ble":
780         build_android_x86_with_ble("true", "")
781         build_android_x86_with_ble("false", "")
782
783     elif str(sys.argv[1]) == "android_x86_with_rm_and_ip":
784         build_android_x86_with_rm_and_ip("true", "")
785         build_android_x86_with_rm_and_ip("false", "")
786
787     elif str(sys.argv[1]) == "android_x86_with_rm_and_bt":
788         build_android_x86_with_rm_and_bt("true", "")
789         build_android_x86_with_rm_and_bt("false", "")
790
791     elif str(sys.argv[1]) == "android_x86_with_rm_and_ble":
792         build_android_x86_with_rm_and_ble("true", "")
793         build_android_x86_with_rm_and_ble("false", "")
794
795     elif str(sys.argv[1]) == "android_armeabi":
796         build_android_armeabi("true", "")
797         build_android_armeabi("false", "")
798         build_android_armeabi_with_rm("true", "")
799         build_android_armeabi_with_rm("false", "")
800
801     elif str(sys.argv[1]) == "android_armeabi_with_ip":
802         build_android_armeabi_with_ip("true", "")
803         build_android_armeabi_with_ip("false", "")
804
805     elif str(sys.argv[1]) == "android_armeabi_with_bt":
806         build_android_armeabi_with_bt("true", "")
807         build_android_armeabi_with_bt("false", "")
808
809     elif str(sys.argv[1]) == "android_armeabi_with_ble":
810         build_android_armeabi_with_ble("true", "")
811         build_android_armeabi_with_ble("false", "")
812
813     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_ip":
814         build_android_armeabi_with_rm_and_ip("true", "")
815         build_android_armeabi_with_rm_and_ip("false", "")
816
817     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_bt":
818         build_android_armeabi_with_rm_and_bt("true", "")
819         build_android_armeabi_with_rm_and_bt("false", "")
820
821     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_ble":
822         build_android_armeabi_with_rm_and_ble("true", "")
823         build_android_armeabi_with_rm_and_ble("false", "")
824
825     elif str(sys.argv[1]) == "windows":
826         build_windows("true", "")
827         build_windows("false", "")
828
829     elif str(sys.argv[1]) == "msys":
830         build_msys("true", "")
831         build_msys("false", "")
832
833     elif str(sys.argv[1]) == "tizen":
834         build_tizen("true", "")
835         build_tizen("false", "")
836
837     elif str(sys.argv[1]) == "tizen_extra":
838         build_tizen_extra("true", "")
839         build_tizen_extra("false", "")
840
841     elif str(sys.argv[1]) == "tizen_unsecured":
842         build_tizen_unsecured("true", "")
843         build_tizen_unsecured("false", "")
844
845     elif str(sys.argv[1]) == "tizen_secured":
846         build_tizen_secured("true", "")
847         build_tizen_secured("false", "")
848
849     elif str(sys.argv[1]) == "tizen_extra_unsecured":
850         build_tizen_extra_unsecured("true", "")
851         build_tizen_extra_unsecured("false", "")
852
853     elif str(sys.argv[1]) == "tizen_extra_secured":
854         build_tizen_extra_secured("true", "")
855         build_tizen_extra_secured("false", "")
856
857     elif str(sys.argv[1]) == "simulator":
858         build_simulator("true", "")
859         build_simulator("false", "")
860
861     elif str(sys.argv[1]) == "darwin":
862         build_darwin("true", "")
863         build_darwin("false", "")
864
865     elif str(sys.argv[1]) == "unit_tests_secured":
866         unit_tests_secured()
867
868     elif str(sys.argv[1]) == "unit_tests_unsecured":
869         unit_tests_unsecured()
870
871     elif str(sys.argv[1]) == "unit_tests_memcheck_secured":
872         unit_tests_memcheck_secured()
873
874     elif str(sys.argv[1]) == "unit_tests_memcheck_unsecured":
875         unit_tests_memcheck_unsecured()
876
877     elif str(sys.argv[1]) == "unit_tests":
878         unit_tests()
879
880     else:
881         helpmsg(script_name)
882 else:
883     helpmsg(script_name)
884
885 print ("===================== done =====================")