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