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.
There are many uses of such toggling switches in unix programs. Lets see, curl:
--tcp-nodelay Turn on the TCP_NODELAY option. See the curl_easy_setopt(3) man page for details about this option. (Added in 7.11.2)
If this option is used several times, each occurrence toggles this on/off.
(and many other curl options)
That was the only one I could easily find by searching man pages for "toggle", but I'm sure there are others with different words in their man pages. As I said, toggling options are not without precedence - whether it is a good idea or not, I leave to someone else to decide.
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 ?
Actually, you're right, there is something a bit funky going on for the explicitly specified file in the gp command line. I'll try to remember to take a look at some point. Interestingly, it only affects the directly specified unit, ie, if you have a tree like:
lowunit, medunit, highunit, then the sequence:
gp -c lowunit.p will compile lowunit.p
gp -c medunit.p will compile lowunit and medunit.
gp -c highunit.p will compile medunit and highunit, but will not recompile lowunit (it having been compiled as a secondary unit from the second command).
The affects my highly patched version of gp, so I expect it also behaves this way in the unpathced version, though I did not try that. I presume something in the way the primary file gpd is saved is subtely different to what is expected.
Ahh, I see, at least for me,
gp -c lowunit.p results in the gpd including the line:
g /Users/peter/Interarchy/Project/Build/IAObjects/.gpi
when it should have the line
g /Users/peter/Interarchy/Project/Build/IAObjects/lowunit.gpi
I haven't looked in to why.
The issue I raised is still valid either way though. Peter.