File: application.jam

package info (click to toggle)
glest 3.1.2-1
  • links: PTS, VCS
  • area: contrib
  • in suites: lenny
  • size: 3,496 kB
  • ctags: 6,107
  • sloc: cpp: 30,065; sh: 8,293; makefile: 48
file content (94 lines) | stat: -rw-r--r-- 3,102 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#============================================================================
# Rules for compiling applications
#============================================================================

##  Application appname : sources [ : options ]
##    Build an application out of sourcefiles. All sourcefiles will be passed
##    to the Objects rule which tries to compile them into object-files. You
##    can create rules for your own filetypes with the UserObject rule. Header
##    files will just be ignored. They are only used for MSVC projectfile
##    generation.
##    Possible options are "noinstall" if you don't want a default install
##    target to be created and "console" if you're building a console
##    application (an application without any graphical output which is
##    intended to be used on commandline)
##    Some notes: You should not add the .exe extension to the appname - jam
##    will do that on win32.
##    If you have sourcefiles in subdirectories, then you'll need to use the
##    SearchSubdir rule. Never specify sourcefiles with paths, only specify
##    the filenames.
##    Options:
##	console: Create a console application
##	noinstall: Don't setup a default installation target.
##	independent: The target will not be made a dependency of the apps and
##		     all target.
rule Application
{
    # check options
    CheckOptions noinstall console independent : $(3) : $(<) ;

    local target = [ ConstructApplicationTarget $(<) : $(3) ] ;
    local sources = [ SearchSource $(>) ] ;
    local objects = [ CompileObjects $(sources) ] ;

    $(<)_TYPE = application ;
    $(<)_OBJECTS = $(objects) ;
    $(<)_SOURCES = $(sources) ;
    $(<)_TARGET = $(target) ;
    $(<)_OPTIONS = $(3) ;
    $(<)_INSTALLTARGET = ;

    # create target clean rule
    Always $(<)clean ;
    NotFile $(<)clean ;
    Clean $(<)clean : $(objects) ; # create target clean rule 
        Depends clean : $(<)clean ;

    # so 'jam foo' works when it's really foo.exe (Windows) or foo.app (MacOS/X)
    if $(target) != $(<)
    {
        Depends $(<) : $(target) ;
        NotFile $(<) ;
    }

    # make dependency on apps target
    if ! [ IsElem independent : $(3) ]
    {
        Depends apps : $(<) ;
    }

    # construct Install target
    if ! [ IsElem noinstall : $(3) ]
    {
        $(<)_INSTALLTARGET = [ 
            DoInstall $(target) : $(bindir) : $(INSTALL_PROGRAM) : nopackage
        ] ;
        Depends install_bin : $($(<)_INSTALLTARGET) ;
    }

    # Link
    MakeLocate $(target) : $(LOCATE_TARGETS) ;
    SystemLinkApplication $(<) : $(objects) : $(3) ;

    # Import default flags
    CppFlags $(<) : $(APPLICTION_CPPFLAGS) ;
    CFlags $(<) : $(APPLICATION_CFLAGS) ;
    C++Flags $(<) : $(APPLICATION_CXXFLAGS) ;
    LFlags $(<) : $(APPLICATION_LIBS) ;

    # Sources are part of the package
    if ! [ IsElem nopackage : $(3) ]
    {
        Package $(sources) ;
    }

    return $(target) ;
}

#----------------------------------------------------------------------------
# private part

# Construct pseudo target apps
Depends all : apps ;
NotFile apps ;