简体   繁体   中英

How can I use the GCC -frandom-seed=<file name> option with the waf build system?

According to the GCC documentation the -frandom-seed=string should have a unique string for each compiled file, see GCC Developer Options . One common approach is to use the source file path. How can I teach the waf build system to use the source file path for the option? I tried to use -frandom-seed=${SRC[0].abspath()} in bld.objects(cflags=...) .

You can change the command used by waf to compile file:

from waflib.Tools.c import c

class modified_(c):
    run_str = '${CC} -frandom-seed=${SRC[0].abspath()} ${ARCH_ST:ARCH} ${CFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CC_SRC_F}${SRC} ${CC_TGT_F}$

from waflib.Task import classes
classes['c'] = modified_c

You put that at the beginning of yout wscript. You can also put it oin a file you load à a plugin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM