1 #============================================================================
2 # Rules for compiling applications
3 #============================================================================
5 ## Application appname : sources [ : options ]
6 ## Build an application out of sourcefiles. All sourcefiles will be passed
7 ## to the Objects rule which tries to compile them into object-files. You
8 ## can create rules for your own filetypes with the UserObject rule. Header
9 ## files will just be ignored. They are only used for MSVC projectfile
11 ## Possible options are "noinstall" if you don't want a default install
12 ## target to be created and "console" if you're building a console
13 ## application (an application without any graphical output which is
14 ## intended to be used on commandline)
15 ## Some notes: You should not add the .exe extension to the appname - jam
16 ## will do that on win32.
17 ## If you have sourcefiles in subdirectories, then you'll need to use the
18 ## SearchSubdir rule. Never specify sourcefiles with paths, only specify
21 ## console: Create a console application
22 ## noinstall: Don't setup a default installation target.
23 ## independent: The target will not be made a dependency of the apps and
25 ## linkerfile: Store a list of objects in a file and link using that
26 ## file. Use this to get around Jam's 10240 character argument limit.
30 CheckOptions noinstall console independent linkerfile : $(3) : $(<) ;
32 local target = [ ConstructApplicationTarget $(<) : $(3) ] ;
33 local sources = [ SearchSource $(>) ] ;
34 local objects = [ CompileObjects $(sources) ] ;
36 $(<)_TYPE = application ;
37 $(<)_OBJECTS = $(objects) ;
38 $(<)_SOURCES = $(sources) ;
39 $(<)_TARGET = $(target) ;
41 $(<)_INSTALLTARGET = ;
43 # create target clean rule
46 Clean $(<)clean : $(objects) ; # create target clean rule
47 Depends clean : $(<)clean ;
49 # so 'jam foo' works when it's really foo.exe (Windows) or foo.app (MacOS/X)
52 Depends $(<) : $(target) ;
56 # make dependency on apps target
57 if ! [ IsElem independent : $(3) ]
62 # construct Install target
63 if ! [ IsElem noinstall : $(3) ]
65 $(<)_INSTALLTARGET = [
66 DoInstall $(target) : $(bindir) : $(INSTALL_PROGRAM) : nopackage
68 Depends install_bin : $($(<)_INSTALLTARGET) ;
72 MakeLocate $(target) : $(LOCATE_TARGETS) ;
73 SystemLinkApplication $(<) : $(objects) : $(3) ;
75 # Import default flags
76 CppFlags $(<) : $(APPLICTION_CPPFLAGS) ;
77 CFlags $(<) : $(APPLICATION_CFLAGS) ;
78 C++Flags $(<) : $(APPLICATION_CXXFLAGS) ;
79 LFlags $(<) : $(APPLICATION_LIBS) ;
81 # Sources are part of the package
82 if ! [ IsElem nopackage : $(3) ]
90 #----------------------------------------------------------------------------
93 # Construct pseudo target apps