5 messages in com.perforce.jamming[jamming] Jamming with subdirectories| From | Sent On | Attachments |
|---|---|---|
| Russell | 05 Feb 2003 02:58 | |
| Ingo Weinhold | 05 Feb 2003 04:46 | |
| Russell | 06 Feb 2003 07:37 | |
| Russell | 07 Feb 2003 07:51 | |
| Russell | 07 Feb 2003 23:31 |
| Subject: | [jamming] Jamming with subdirectories![]() |
|---|---|
| From: | Russell (rjs...@iprimus.com.au) |
| Date: | 02/06/2003 07:37:31 AM |
| List: | com.perforce.jamming |
Ingo Weinhold wrote:
On Wed, 5 Feb 2003, Russell wrote:
In the top level Jamfile, i've got:... ... When i run jam from the top directory, i get errors: don't know how to make main.c don't know how to make analog.c don't know how to make serial.c
Supposing that your source files reside in the respective subdirectories, this is not surprising.
As a general remark: The Main rule is intended to compile the source files and link the objects. The Objects rule compiles source files to objects. So in the way you apply these rules, the source files would be compiled twice. So you should either drop the Objects rules or use MainFromObjects instead of Main.
1) Dropping the Objects rules (and, if you like also the then-empty Jamfiles in the subdirectories): The errors jam reports are caused by the fact, that it doesn't know, where the listed source files are located. By default jam searches only the directory of the Jamfile, so you have to tell it explicitly, e.g. by:
SEARCH_SOURCE += [ FDirName $(TOP) main ] [ FDirName $(TOP) analog ] [ FDirName $(TOP) serial ] ;
This must be inserted before the invocation of the Main rule.
2) Using MainFromObjects instead of Main:
MainFromObjects myprog : <main>main.o <analog>analog.o <serial>serial.o ;
The grist (the `<...>' annotation) is needed to make jam find the object files. The concept can be looked up in the documentation.
Hi, I decided to do (2) above. I'm nearly there, but still have a problem. The top jamfile has:
SubDir TOP ; MainFromObjects myprog : <main>main.o <serial>serial.o ; SubInclude TOP main ; SubInclude TOP serial ;
The jamfile in the 'main' subdirectory has:
SubDir TOP main ; Objects main.c ;
The jamfile in the 'serial' subdirectory has:
SubDir TOP serial ; Objects serial.c ;
Running 'jam' at the top level gives errors: don't know how to make main.o don't know how to make serial.o
The .o files get created in the subdirectories, but MainFromObjects doesn't see those. I've tried setting SEARCH_SOURCE += [ FDirName $(TOP) main ], but i think that only works for finding .c source files and not .o files. I couldn't find how to set a search path for intermediate files such as .o.




