FW: [jamming] Newbie question

Abbate, Joseph M Joseph.Abbate at ca.com
Fri Nov 19 08:06:32 PST 2004


Hi Mihai,

I just worked out on something similar, because my project Library rules
weren't creating the directories where the libraries were supposed to be
located. Let me provide with a simplified version. The structure is very
similar to yours, but without an obj/ directory or multiple src
subdirectories.

Directories and files:
     TOP -> Jamfile
     TOP / bin   -> (destination of executable)
     TOP / lib   -> (destination of library)
     TOP / src   -> Jamfile prog.c func1.c func2.c

TOP Jamfile:
------------
BINDIR = [ FDirName $(TOP) bin ] ;
LIBDIR = [ FDirName $(TOP) lib ] ;
SubDir TOP ;
SubInclude TOP src ;

TOP/src Jamfile:
----------------
SubDir TOP src ;
Main prog : prog.c ;
MakeLocate prog$(SUFEXE) : $(BINDIR) ;
LinkLibraries prog : libx ;
Library libx : func1.c func2.c ;
MakeLocate libx$(SUFLIB) : $(LIBDIR) ;

This will create the TOP/bin and TOP/lib directories, create and archive
libx in TOP/lib, and then link the prog executable in TOP/bin. It runs
correctly on Unix, Windows and VMS. Note that I put everything in the
Jamfiles only for simplicity in the example.

Joe Abbate
Senior Software Engineer
Computer Associates
joseph.abbate at ca.com
 

> -----Original Message-----
> From: jamming-admin at perforce.com 
> [mailto:jamming-admin at perforce.com] On Behalf Of Mihai Christodorescu
> Sent: Thursday, November 18, 2004 3:33 PM
> To: jamming at perforce.com
> Subject: [jamming] Newbie question
> 
> 
> I have the following directory structure:
> 
> src/ - source files and subdirectories with source files
> obj/ - object files
> lib/ - library file
> bin/ - executable file
> 
> What I want to do is to compile files from src/ (and 
> subdirectories), put 
> the resulting object files under obj/ (and under corresponding 
> subdirectories), and create a library from those object files 
> and an executable.
> 
> src/dir1/a.cpp -> obj/dir1/a.o
> src/dir2/a.cpp -> obj/dir2/a.o
> src/c.cpp -> obj/c.o
> src/main/b.cpp -> obj/main/b.cpp
> 
> obj/dir1/a.o + obj/dir2/a.o + obj/c.o -> lib/libx.a
> 
> lib/libx.a + obj/main/b.cpp -> bin/main
> 
> I managed to put all object files in obj/ by using 
> LOCATE_TARGET. I also 
> managed to put the resulting executable (main) in bin/ by 
> using LOCATE on 
> ... . Unfortunately, the resulting library (libx.a) is put in 
> obj/ (as 
> specified by LOCATE_TARGET).
> 
> My questions:
> 
> 1. Can I achieve the directory layout shown above with the 
> Jambase rules?
> 
> 2. How can I replace a substring in a string?
>     (regexp not needed, I just want to say replace "blah" 
> with "foo" in
>     "AblahC", to obtain "AfooC").
> 
> Thanks,
> 
> Mihai
> 
> -- 
>   - mihai at cs.wisc.edu - http://www.cs.wisc.edu/~mihai -
> -------------------------------------------------------
>    The man of knowledge must be able not only to love
>   his enemies but also to hate his friends.
>                                   - Friedrich Nietzsche
> -------------------------------------------------------
>      -- Feed the machine that burns in your head. --
> _______________________________________________
> jamming mailing list  -  jamming at perforce.com
> http://maillist.perforce.com/mailman/listinfo/jamming
> 
> 




More information about the jamming mailing list