前言
考察下面的脚本:
emcc -o ./dist/test.html --shell-file ./tmp.html --source-map-base dist -O3 -g4 --source-map-base dist -s MODULARIZE=1 -s "EXPORT_NAME=\"Test\"" -s USE_SDL=2 -s LEGACY_GL_EMULATION=1 --pre-js ./pre.js --post-js ./post.js --cpuprofiler --memoryprofiler --threadprofilermain.cpp
这里在调用 emcc 进行 WebAssembly 编译时,组织了很多参数。整个命令都在一行之中,不是很好阅读和维护。
换行
可通过加 \ 的方式来进行换行拆分。
改造后看起来像这样,一个参数占一行:
emcc -o ./dist/test.html\
--shell-file ./tmp.html\
--source-map-base dist\
-O3\
-g4\
--source-map-base dist\
-s MODULARIZE=1\
-s "EXPORT_NAME=\"Test\""\
-s USE_SDL=2\
-s LEGACY_GL_EMULATION=1\
--pre-js ./pre.js\
--post-js ./post.js\
--cpuprofiler\
--memoryprofiler\
--threadprofiler\