3 messages in com.perforce.jammingBuilding two targets from the same so...| From | Sent On | Attachments |
|---|---|---|
| Dian...@whistle.com | 09 Aug 1996 12:38 | |
| Laur...@sybase.com | 09 Aug 1996 13:39 | |
| Dian...@whistle.com | 09 Aug 1996 14:58 |
| Subject: | Building two targets from the same source![]() |
|---|---|
| From: | Dian...@whistle.com (Dian...@whistle.com) |
| Date: | 08/09/1996 02:58:44 PM |
| List: | com.perforce.jamming |
Well, as Christopher can tell you, whenever I decide to give up and send mail asking how to do something, five minutes later I finally figure it out.
So far, it's a perfect record.
So here's how I've gotten it to work:
# Jamfile for src/ia/whistle/blow
SubDir TOP src ia whistle blow ; SubDirCcFlags -DDEFAULT_PORT=$(DEFAULT_PORT) ;
DUALEXE blow : main.c ;
# Rules file rule DUALEXE { for d in $(TOOLSBINDIR) $(WHISTLEBINDIR) { if $(d) = $(WHISTLEBINDIR) { CCFLAGS = -I$(PWD) ; Main $(d)/$(<) : $(>) ; } else { SEARCH_SOURCE = $(d) ; SOURCE_GRIST = $((d):D) ; ObjectCcFlags $(>:D=$(d):S=.o) : -g -I$(PWD) ; Object $(>:D=$(d):S=.o) : $(>) ; MainFromObjects $(d)/$(<) : $(d)/$(>:S=.o) ; } } }
I had to add the -I's because jam wants to have a -I for the directory that Main is putting its target into, rather than the current working directory (don't know why).
I also end up having the .o that belongs to the tools executable living in the tools bin, but I can live with that, since that bin is only for in-house use, and no one should really care. I'd rather not have to have it there, but I can't see any way not to, since the .o compiled for the executable that goes to the release area gets compiled into the source directory.
If it turns out my solution is the laughing-stock of this list, and someone has a simpler solution, I'll be more than happy to hear about it.
This is what a 'jam clean' looks like now:
Clean clean
rm -f /usr/root/bin/main.o /usr/root/bin/blow
/usr/root/image/whistle/bin/blow /usr/root/src/ia/whistle/blow/main.o
which is exactly right. Build output looks like:
...updating 4 target(s)... Cc /usr/root/bin/main.o Cc /usr/root/src/ia/whistle/blow/main.o Link /usr/root/bin/blow Chmod /usr/root/bin/blow Link /usr/root/image/whistle/bin/blow Chmod /usr/root/image/whistle/bin/blow ...updated 4 target(s)...
which is also exactly right (the long output shows the right compiler flags, too).
Well, if anyone else runs into this, I hope all this helps.
Onward to dual libraries...
Thanks,
Diane




