# # A very simple example Jam project. Compiles a variant of the timeless # classic, "hello world". Illustrates one way in which you can use jam # to (a) compile a simple executable (b) place generated files in # separate subdirectories and (c) use the InstallBin rule to install # the executable. # # # Tell Jam to place the output of compilation in the "obj" directory. # This keeps our source directory relatively clean. # LOCATE_TARGET = obj ; # # Tell Jam that the executable "hello" is made from the file "hello.c". # This is what causes the actual compilation. # # Note that on Windows NT the executable is actually "hello.exe"; on # Unix-ish operating systems it will be simply "hello", etc. Jam will # figure out the appropriate suffix. # Main hello : hello.c ; # # For the sake of illustration, we do something slightly more sophisticated # for the "install" target: We install the "hello" executable into a # directory specified by the variable $(INSTALL_DIR). # # INSTALL_DIR may be set in the user's environment, or on the jam command # line (using the -s option). # # If INSTALL_DIR is not set, we cause it to be set to a default by using # the "?=" operator. Also (for the sake of illustration), we base the # default name of the install directory on the $(OS) variable, which is # set by Jam to the name of the operating system on which we are compiling. # In this example, we use it with the ":L" modifier, which returns an # all-lowercase version of the contents of $(OS). # # See the Jam manual at http://public.perforce.com/public/jam/src/Jam.html # under the topic "Variables" for more information on varibles and modifiers. # # Finally, we use the FDirName rule to construct a directory name in a # portable way. The square braces ('[' and ']') tell Jam to use the result # of calling the FDirName rule, rather than treating "FDirName" as the # name of the directory. # INSTALL_DIR ?= shipit $(OS:L) ; InstallBin [ FDirName $(INSTALL_DIR) ] : hello ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 4438 | Chris Comparini |
Sample jam projects. "rootless" documentation still needs work. |