diff --git a/configure b/configure index ea85df38..f710546c 100755 --- a/configure +++ b/configure @@ -51,6 +51,9 @@ unix98_flag="" # mmap mmap_flag="" +# function tracing +func_flag="" + #Functions set_melang_default_paths() { @@ -108,6 +111,7 @@ get_params() { echo -e "\t--olevel=O|O1|O2|O3" echo -e "\t--select=[all|module1,module2,...]" echo -e "\t--disable-macro=[macro1,macro2,...]" + echo -e "\t--func" exit 0 fi param_prefix=`echo $param|cut -d '=' -f 1` @@ -124,6 +128,8 @@ get_params() { wasm=1 elif [ $param_prefix == "--debug" ]; then debug=1 + elif [ $param_prefix == "--func" ]; then + func_flag='-DMLN_FUNC_FLAG' elif [ $param_prefix == "--select" ]; then select_files=$param_suffix elif [ $param_prefix == "--disable-macro" ]; then @@ -441,7 +447,7 @@ generate_Makefile() { if [ $wasm -eq 1 ]; then echo -e "FLAGS\t\t= -Iinclude -c $debug $olevel $llvm_flag -s -mmutable-globals -mnontrapping-fptoint -msign-ext -Wemcc" >> Makefile else - echo -e "FLAGS\t\t= -Iinclude -c -Wall $debug -Werror $olevel -fPIC $event_flag $sendfile_flag $writev_flag $unix98_flag $mmap_flag" >> Makefile + echo -e "FLAGS\t\t= -Iinclude -c -Wall $debug -Werror $olevel -fPIC $event_flag $sendfile_flag $writev_flag $unix98_flag $mmap_flag $func_flag" >> Makefile fi if ! case $sysname in MINGW*) false;; esac; then if [ $wasm -eq 0 ]; then diff --git a/docs/book/cn/install.md b/docs/book/cn/install.md index 7673c56f..f7ae9a2c 100644 --- a/docs/book/cn/install.md +++ b/docs/book/cn/install.md @@ -41,8 +41,9 @@ $ sudo make install - `--prefix` 设置Melon的安装路径。 - `--melang-prefix` 设置Melon库中使用到的Melang脚本的安装路径。 - `--cc` 设置Melon组件编译时所使用的C编译器。 -- `--enable-wasm` 启用webassembly模式,会编译安装webassembly格式的Melon库。 -- `--debug` 开启debug模式,若不开启,则生成的库不包含符号信息,也不会启用`__DEBUG__`宏。 +- `--enable-wasm` 启用`webassembly`模式,会编译安装webassembly格式的Melon库。 +- `--debug` 开启`debug`模式,若不开启,则生成的库不包含符号信息,也不会启用`__DEBUG__`宏。 +- `--func` 开启`func`模式,开启后会将`MLN_FUNC`和`MLN_FUNC_VOID`定义的函数在调用时启用入口和出口回调。 - `--olevel=[O|O1|O2|O3|...]` 编译优化的级别,默认是`O3`。如果`=`后不写内容则为不开启优化。 - `--select=[all | module1,module2,...]` 选择性编译部分模块,默认为`all`表示编译全部模块。模块名称可在各模块文档中给出。 - `--disable-macro=[macro1,macro2,...]` 禁用`configure`检测到的当前操作系统支持的系统调用或宏,目前仅支持如下内容: diff --git a/docs/book/en/install.md b/docs/book/en/install.md index 98f879b2..c170218d 100644 --- a/docs/book/en/install.md +++ b/docs/book/en/install.md @@ -36,8 +36,9 @@ Shell script `configure` has the following parameters: - `--prefix` The installation path of Melon library - `--melang-prefix` The installation path of the Melang script files that Melon used - `--cc` Set the C compiler that used to compile Melon -- `--enable-wasm` Enable webassembly mode to generate webassembly format library -- `--debug` Enable debug mode. If omited the generated library will not contain symbol information and macro `__DEBUG__` +- `--enable-wasm` Enable `webassembly` mode to generate webassembly format library +- `--debug` Enable `debug` mode. If omited the generated library will not contain symbol information and macro `__DEBUG__` +- `--func` Enable `func` mode. When enabled, the functions defined by `MLN_FUNC` and `MLN_FUNC_VOID` will enable entry and exit callbacks when called. - `--olevel=[O|O1|O2|O3|...]` The level of compilation optimization, the default is `O3`. The optimization is disabled if no content after `=`. - `--select=[all | module1,module2,...]` Selectively compile some modules. The default is `all` which means compiling all modules. Module names can be given in the document for each module. - `--disable-macro=[macro1,macro2,...]` disables the system calls or macros supported by the current operating system detected by `configure`. Currently, only the following is supported: