Adriaan van Os wrote:
Peter N Lewis wrote:
Of course, I can write a patch for gp to add this feature. Any suggestions for the switch to use ?
Could you make -c a toggle switch? So
no -c is compile only for main program, compile and link for program -c is compile only -c -c is compile and link
It's not without president for switches to toggle...?
It's without precedent and against the conventions I know of.
It's not without precedent, but IMHO too confusing in this case. And more confusion is just what we need WRT gcc/gpc/gp options. ;-)
And your second suggestion (which is not exactly toggling) is also quite nonobvious IMHO.
Still, with the current patch --compile-and-link doesn't overrule -c, so
gp ... -c ... --compile-and-link ...
doesn't link. If that's important, I have to rewrite the patch.
If it's not very much effort, this might be useful. Or a warning about nonsensical options.
Otherwise, perhaps --compile=auto/only/link or --compile-and-link
Just a thought.
For gp you'll also need to be careful that you can do:
gp subunit.p gp --compile-and-link mainunit.p
and not have gp decide that the options have changed and so it needs to recompile subunit.p.
gp seems to recompile subunit.p in this situation anyway, independent of the --compile-and-link switch. I tried it with an unpatched gp-0.60. Can you confirm that this happens when you test it yourself ?
gp has a mechanism to decide which options are relavant for recompiling or only relinking (see RecompileRelevant). Adriaan's patch doesn't make the option recompile-relevant, so it *should* work. But of course, there may be bugs in gp (outside of the patch). I haven't tested this situation very much, since I usually only compile complete programs with gp.
Frank