777cb7715fb7ebd3743e1e9e107027e3711628de
[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     build_options['MULTIPLE_OWNER'] = 1
512     call_scons(build_options, build_extra_options)
513
514
515 def build_tizen_secured(flag, scons_options):
516     build_tizen(flag, scons_options + " SECURED=1")
517
518
519 def build_tizen_unsecured(flag, scons_options):
520     build_tizen(flag, scons_options + " SECURED=0")
521
522
523 # Mac OS and iOS
524 def build_darwin(flag, scons_options):
525     print ("*********** Build for OSX *************")
526     build_options = {
527         'TARGET_OS': 'darwin',
528         'SYS_VERSION': '10.9',
529         'RELEASE': flag,
530     }
531     call_scons(build_options, scons_options)
532
533     print ("*********** Build for IOS i386 *************")
534     build_options = {
535         'TARGET_OS': 'ios',
536         'TARGET_ARCH': 'i386',
537         'SYS_VERSION': '7.0',
538         'RELEASE': flag,
539     }
540     call_scons(build_options, scons_options)
541
542     print ("*********** Build for IOS x86_64 *************")
543     build_options['TARGET_ARCH'] = 'x86_64'
544     call_scons(build_options, scons_options)
545
546     print ("*********** Build for IOS armv7 *************")
547     build_options['TARGET_ARCH'] = 'armv7'
548     call_scons(build_options, scons_options)
549
550     print ("*********** Build for IOS armv7s *************")
551     build_options['TARGET_ARCH'] = 'armv7s'
552     call_scons(build_options, scons_options)
553
554     print ("*********** Build for IOS arm64 *************")
555     build_options['TARGET_ARCH'] = 'arm64'
556     call_scons(build_options, scons_options)
557
558
559 # Windows
560 def build_windows(flag, scons_options):
561     print ("*********** Build for Windows *************")
562     os.environ["SCONSFLAGS"] = ""
563     build_options = {
564         'TARGET_OS': 'windows',
565         'TARGET_ARCH': 'amd64',
566         'RELEASE': flag,
567         'TARGET_TRANSPORT': 'IP',
568         'WITH_TCP': 0,
569         'BUILD_SAMPLE': 'ON',
570         'LOGGING': 'off',
571         'TEST': 1,
572         'RD_MODE': 'all',
573     }
574     call_scons(build_options, scons_options)
575
576
577 # Windows msys
578 def build_msys(flag, scons_options):
579     print ("*********** Build for msys_nt *************")
580     os.environ["SCONSFLAGS"] = ""
581     build_options = {
582         'TARGET_OS': 'msys_nt',
583         'TARGET_ARCH': 'x86_64',
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 def build_simulator(flag, scons_options):
596     print ("*********** Build for simulator plugin *************")
597     build_options = {
598         'SIMULATOR': 1,
599         'RELEASE': flag,
600         'SECURED': 0,
601         'TARGET_TRANSPORT': 'IP',
602     }
603     call_scons(build_options, scons_options)
604
605
606 def do_unit_tests(secured=True, memcheck=False):
607     """ build full stack and run unit tests in selected mode.
608
609     All the unit test builders have to run in test (non-release) mode.
610     This option is used by the CI system, which is a virtual machine -
611     thus it should be built with only the IP transport to avoid timeouts
612     setting up infrastructure that is not present (i.e. BT and NFC).
613
614     Args:
615         secured (bool): build in secured mode.
616         memcheck (bool): run tests under control of memory checker.
617     """
618
619     build_options = {
620         'TEST': 1,
621         'RELEASE': 'false',
622         'TARGET_TRANSPORT': 'IP',
623         'SECURED': secured,
624         'VALGRIND_CHECKS': memcheck,
625     }
626     print ("*********** Unit test Start *************")
627     call_scons(build_options, "-c")  # clean first
628     call_scons(build_options, "")
629     print ("*********** Unit test Stop *************")
630
631
632 def unit_tests_secured():
633     do_unit_tests(secured=1)
634
635
636 def unit_tests_unsecured():
637     do_unit_tests(secured=0)
638
639
640 def unit_tests_memcheck_secured():
641     do_unit_tests(secured=1, memcheck=True)
642
643
644 def unit_tests_memcheck_unsecured():
645     do_unit_tests(secured=0, memcheck=True)
646
647
648 def unit_tests():
649     unit_tests_secured()
650     unit_tests_unsecured()
651
652
653 # Main module starts here
654 if os.getenv("SCONSFLAGS", "") == "":
655     os.environ["SCONSFLAGS"] = "-Q -j " + str(multiprocessing.cpu_count())
656
657 arg_num = len(sys.argv)
658 script_name = sys.argv[0]
659
660 # May be overridden in user's shell
661 VERBOSE = os.getenv("VERBOSE", "1")
662 EXEC_MODE = os.getenv("EXEC_MODE", True)
663 if EXEC_MODE in ['false', 'False', '0']:
664     EXEC_MODE = False
665
666 if arg_num == 1:
667     build_all("true", "")
668     build_all("false", "")
669     unit_tests()
670
671 elif arg_num == 2:
672     if str(sys.argv[1]) == '-c':
673         build_all("true", "-c")
674         build_all("false", "-c")
675
676     elif str(sys.argv[1]) == "all":
677         build_all("true", "")
678         build_all("false", "")
679         unit_tests()
680
681     elif str(sys.argv[1]) == "linux":
682         build_linux("true", "")
683         build_linux("false", "")
684
685     elif str(sys.argv[1]) == "linux_unsecured":
686         build_linux_unsecured("true", "")
687         build_linux_unsecured("false", "")
688         build_linux_unsecured_with_rm("true", "")
689         build_linux_unsecured_with_rm("false", "")
690
691     elif str(sys.argv[1]) == "linux_secured":
692         build_linux_secured("true", "")
693         build_linux_secured("false", "")
694
695     elif str(sys.argv[1]) == "linux_full":
696         build_linux_full("true", "")
697         build_linux_full("false", "")
698
699     elif str(sys.argv[1]) == "linux_unsecured_with_rd":
700         build_linux_unsecured_with_rd("true", "")
701         build_linux_unsecured_with_rd("false", "")
702
703     elif str(sys.argv[1]) == "linux_secured_with_rd":
704         build_linux_secured_with_rd("true", "")
705         build_linux_secured_with_rd("false", "")
706
707     elif str(sys.argv[1]) == "linux_unsecured_with_mq":
708         build_linux_unsecured_with_mq("true", "")
709         build_linux_unsecured_with_mq("false", "")
710
711     elif str(sys.argv[1]) == "linux_unsecured_with_tcp":
712         build_linux_unsecured_with_tcp("true", "")
713         build_linux_unsecured_with_tcp("false", "")
714
715     elif str(sys.argv[1]) == "linux_secured_with_tcp":
716         build_linux_secured_with_tcp("false", "")
717         build_linux_secured_with_tcp("true", "")
718
719     elif str(sys.argv[1]) == "linux_unsecured_with_java":
720         build_linux_unsecured_with_java("false", "")
721         build_linux_unsecured_with_java("true", "")
722
723     elif str(sys.argv[1]) == "linux_secured_with_java":
724         build_linux_secured_with_java("false", "")
725         build_linux_secured_with_java("true", "")
726
727     elif str(sys.argv[1]) == "android":
728         build_android("true", "")
729         build_android("false", "")
730
731     elif str(sys.argv[1]) == "android_universal":
732         # only build the release version due to long amount of time to build.
733         build_android_universal("true", "")
734
735     elif str(sys.argv[1]) == "android_universal_unsecured":
736         # only build the release version due to long amount of time to build.
737         build_android_universal("true", "SECURED=0")
738
739     elif str(sys.argv[1]) == "android_unsecured":
740         build_android_unsecured("true", "")
741         build_android_unsecured("false", "")
742
743     elif str(sys.argv[1]) == "android_secured":
744         build_android_secured("true", "")
745         build_android_secured("false", "")
746
747     elif str(sys.argv[1]) == "android_x86":
748         build_android_x86("true", "")
749         build_android_x86("false", "")
750         build_android_x86_with_rm("true", "")
751         build_android_x86_with_rm("false", "")
752
753     elif str(sys.argv[1]) == "android_x86_with_ip":
754         build_android_x86_with_ip("true", "")
755         build_android_x86_with_ip("false", "")
756
757     elif str(sys.argv[1]) == "android_x86_with_bt":
758         build_android_x86_with_bt("true", "")
759         build_android_x86_with_bt("false", "")
760
761     elif str(sys.argv[1]) == "android_x86_with_ble":
762         build_android_x86_with_ble("true", "")
763         build_android_x86_with_ble("false", "")
764
765     elif str(sys.argv[1]) == "android_x86_with_rm_and_ip":
766         build_android_x86_with_rm_and_ip("true", "")
767         build_android_x86_with_rm_and_ip("false", "")
768
769     elif str(sys.argv[1]) == "android_x86_with_rm_and_bt":
770         build_android_x86_with_rm_and_bt("true", "")
771         build_android_x86_with_rm_and_bt("false", "")
772
773     elif str(sys.argv[1]) == "android_x86_with_rm_and_ble":
774         build_android_x86_with_rm_and_ble("true", "")
775         build_android_x86_with_rm_and_ble("false", "")
776
777     elif str(sys.argv[1]) == "android_armeabi":
778         build_android_armeabi("true", "")
779         build_android_armeabi("false", "")
780         build_android_armeabi_with_rm("true", "")
781         build_android_armeabi_with_rm("false", "")
782
783     elif str(sys.argv[1]) == "android_armeabi_with_ip":
784         build_android_armeabi_with_ip("true", "")
785         build_android_armeabi_with_ip("false", "")
786
787     elif str(sys.argv[1]) == "android_armeabi_with_bt":
788         build_android_armeabi_with_bt("true", "")
789         build_android_armeabi_with_bt("false", "")
790
791     elif str(sys.argv[1]) == "android_armeabi_with_ble":
792         build_android_armeabi_with_ble("true", "")
793         build_android_armeabi_with_ble("false", "")
794
795     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_ip":
796         build_android_armeabi_with_rm_and_ip("true", "")
797         build_android_armeabi_with_rm_and_ip("false", "")
798
799     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_bt":
800         build_android_armeabi_with_rm_and_bt("true", "")
801         build_android_armeabi_with_rm_and_bt("false", "")
802
803     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_ble":
804         build_android_armeabi_with_rm_and_ble("true", "")
805         build_android_armeabi_with_rm_and_ble("false", "")
806
807     elif str(sys.argv[1]) == "windows":
808         build_windows("true", "")
809         build_windows("false", "")
810
811     elif str(sys.argv[1]) == "msys":
812         build_msys("true", "")
813         build_msys("false", "")
814
815     elif str(sys.argv[1]) == "tizen":
816         build_tizen("true", "")
817         build_tizen("false", "")
818
819     elif str(sys.argv[1]) == "tizen_unsecured":
820         build_tizen_unsecured("true", "")
821         build_tizen_unsecured("false", "")
822
823     elif str(sys.argv[1]) == "tizen_secured":
824         build_tizen_secured("true", "")
825         build_tizen_secured("false", "")
826
827     elif str(sys.argv[1]) == "simulator":
828         build_simulator("true", "")
829         build_simulator("false", "")
830
831     elif str(sys.argv[1]) == "darwin":
832         build_darwin("true", "")
833         build_darwin("false", "")
834
835     elif str(sys.argv[1]) == "unit_tests_secured":
836         unit_tests_secured()
837
838     elif str(sys.argv[1]) == "unit_tests_unsecured":
839         unit_tests_unsecured()
840
841     elif str(sys.argv[1]) == "unit_tests_memcheck_secured":
842         unit_tests_memcheck_secured()
843
844     elif str(sys.argv[1]) == "unit_tests_memcheck_unsecured":
845         unit_tests_memcheck_unsecured()
846
847     elif str(sys.argv[1]) == "unit_tests":
848         unit_tests()
849
850     else:
851         helpmsg(script_name)
852 else:
853     helpmsg(script_name)
854
855 print ("===================== done =====================")