[Scons-users] strange SCons behavior - build vs clean dependencies

Zarko Berberski (Aditi Staffing LLC) v-zaberb at microsoft.com
Fri Jun 16 15:11:00 EDT 2017


I have a set of build scripts carefully connected in the main build file (each has 2 connection aliases, prior and final). One is used twice with different variant_dir  and different env. They do copy final executable to the sam place but that’s kept hidden from Scons (excerpts follow) and it doesn’t complain (and doesn’t remove them during –c, which is good).



The puzzle: while building Scons doesn’t even try to build build first ('ocaml-LKG'), only the last ('ocaml-output') but for –c it only cleans the first (which it hasn’t built :-) and not the last (which it has built).



To force it to build the first as well I add it’s final alias (top_LKG bellow) explicitly to the head of ‘all’ alias



all = env.Alias('all', [top]) ==> all = env.Alias('all', [top_LKG, top])



but then for cleanup it cleans only that and nothing else and I could’t find a way to force it to clean up everything.



Individual builds and cleanups run OK.



Any ideas, related experiences etc. ?



----- Excerpts -----

Make.scons (orchestration)



def Connect_Stages(prior):

    FStar_prior, top_FStar = SConscript('FStar.scons')

    if prior :  env.Depends(FStar_prior, prior)

    env_OCaml  = env.Clone()

    Ocaml_prior, top_Ocaml = SConscript('ocaml-output.scons', exports={'My_env' : env_OCaml}, variant_dir='ocaml-output', duplicate=0)

    env.Depends(Ocaml_prior, top_FStar)

    return top_Ocaml



if 'vs-fstar' in COMMAND_LINE_TARGETS :

    top_NET = SConscript('FStar_NET.scons')

    vs_fstar = env.Alias('vs-fstar', top_NET)

elif 'boot-ocaml' in COMMAND_LINE_TARGETS :  # just LKG ocaml

    no_prior, top_LKG = SConscript('ocaml-output.scons', exports={'My_env' : env}, variant_dir='ocaml-LKG', duplicate=0)

    boot_ocaml = env.Alias('boot-ocaml', top_LKG)

elif 'extract' in COMMAND_LINE_TARGETS :

    top_FStar = SConscript('FStar.scons')

elif 'ocaml' in COMMAND_LINE_TARGETS :  # boot, extract, new ocaml

    top = Connect_Stages(None)

    env.Alias('ocaml', top)

    #env.Default(top)

elif 'all' in COMMAND_LINE_TARGETS :    # LKG ocaml, boot, extract, new ocaml

    env_LKG = env.Clone()

    no_prior, top_LKG = env_LKG.SConscript('ocaml-output.scons', exports={'My_env' : env_LKG}, variant_dir='ocaml-LKG', duplicate=0)

    top = Connect_Stages(top_LKG)

    all = env.Alias('all', [top])



ocaml-output.scons (final steps, hiding copies, final alias)



main_native = env.Command(ResPath + ResFile, '',

                           ['$OCAMLBUILD $OCAMLBUILDARGS ' + ResFile

                            , Copy(File('../../bin/FStar.exe'), File(ResPath + ResFile))

                            , Copy(File('../../bin/FStar.ocaml'), File(ResPath + ResFile))

                           ])



final = env.Alias(this_dir +'-final', main_native)   # ocaml-output-final, ocaml-LKG-final

Return('prior', 'final')






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20170616/e20229d0/attachment-0001.html>


More information about the Scons-users mailing list