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
28 CheckOptions noinstall console independent : $(3) : $(<) ;
30 local target = [ ConstructApplicationTarget $(<) : $(3) ] ;
31 local sources = [ DoSourceGrist $(>) ] ;
32 local objects = [ CompileObjects $(sources) ] ;
34 $(<)_TYPE = application ;
35 $(<)_OBJECTS = $(objects) ;
36 $(<)_SOURCES = $(sources) ;
37 $(<)_TARGET = $(target) ;
39 $(<)_INSTALLTARGET = ;
41 # create target clean rule
44 Clean $(<)clean : $(objects) ; # create target clean rule
45 Depends clean : $(<)clean ;
47 # so 'jam foo' works when it's really foo.exe (Windows) or foo.app (MacOS/X)
50 Depends $(<) : $(target) ;
54 # make dependency on apps target
55 if ! [ IsElem independent : $(3) ]
60 # construct Install target
61 if ! [ IsElem noinstall : $(3) ]
63 $(<)_INSTALLTARGET = [
64 DoInstall $(target) : $(bindir) : $(INSTALL_PROGRAM) : nopackage
66 Depends install_bin : $($(<)_INSTALLTARGET) ;
70 MakeLocate $(target) : $(LOCATE_TARGETS) ;
71 SystemLinkApplication $(<) : $(objects) : $(3) ;
73 # Import default flags
74 CppFlags $(<) : $(CPPFLAGS) $(APPLICTION_CPPFLAGS) ;
75 CFlags $(<) : $(CFLAGS) $(APPLICATION_CFLAGS) ;
76 C++Flags $(<) : $(C++FLAGS) $(APPLICATION_C++FLAGS) ;
77 LFlags $(<) : $(LFLAGS) $(APPLICATION_LFLAGS) ;
79 # Sources are part of the package
80 if ! [ IsElem nopackage : $(3) ]
86 #----------------------------------------------------------------------------
89 # Construct pseudo target apps