| 895 | # (like --pre-js) do not need to be passed when building |
| 896 | # libraries, for example |
| 897 | def get_cflags(self, main_file=False, compile_only=False, asm_only=False): |
| 898 | def is_ldflag(f): |
| 899 | return f.startswith(('-l', '-sEXPORT_ES6', '-sGL_TESTING', '-sPROXY_TO_PTHREAD', |
| 900 | '-sENVIRONMENT=', '--pre-js=', '--post-js=', '-sPTHREAD_POOL_SIZE=', |
| 901 | '--profiling-funcs')) |
| 902 | |
| 903 | args = self.serialize_settings(compile_only or asm_only) + self.cflags |
| 904 | if asm_only: |
| 905 | args = [a for a in args if not a.startswith('-O')] |
| 906 | if compile_only or asm_only: |
| 907 | args = [a for a in args if not is_ldflag(a)] |
| 908 | else: |
| 909 | args += self.ldflags |
| 910 | if not main_file: |
| 911 | for i, arg in enumerate(args): |
| 912 | if arg in {'--pre-js', '--post-js'}: |
| 913 | args[i] = None |
| 914 | args[i + 1] = None # noqa: B909 |
| 915 | args = [arg for arg in args if arg is not None] |
| 916 | return args |
| 917 | |
| 918 | def verify_es5(self, filename): |
| 919 | es_check = shared.get_npm_cmd('es-check') |