summaryrefslogtreecommitdiffstats
path: root/Jamrules
blob: a82ee7a7aadf1ae258c3bcaa0c9b06be83043ea6 (plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Compilers & flags
CC    = gcc ;
C++   = g++ ;
AS    = nasm -f elf ;
LINK  = g++ ;
OPTIM = -O3 -funroll-loops ;

HB_VERSION = 0.6.1 ;
DEFINES    = HB_$(OS) HB_VERSION=\\\"$(HB_VERSION)\\\" ;
LANGUAGES  = fr de it pl ru nl es pt ;

NotFile clean-contrib clean-all ;
Always  clean-contrib ;
Depends clean-all : clean clean-contrib ;

# _Object: same as Jambase's Object, except
#  * those aren't cleaned by 'jam clean' (to prevent from deleting
#    every contrib library by accident)
#  * it handles *.asm files
rule _Object
{
    MakeLocate $(<) : $(LOCATE_TARGET) ;
    SEARCH on $(>) = $(SEARCH_SOURCE) ;
    HDRS on $(<) = $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) ;
    HDRRULE on $(>) = HdrRule ;
    HDRSCAN on $(>) = $(HDRPATTERN) ;
    HDRSEARCH on $(>) =
            $(SEARCH_SOURCE:E) $(SUBDIRHDRS) $(HDRS) $(STDHDRS) ;
    HDRGRIST on $(>) = $(HDRGRIST) ;
    DEFINES on $(<) += $(DEFINES) ;
    switch $(>:S)
    {   
        case .asm : As $(<) : $(>) ;
        case .nas : As $(<) : $(>) ;
        case .c :   Cc $(<) : $(>) ;
        case .cpp : C++ $(<) : $(>) ;
    }
}
# _Objects: use _Object
rule _Objects
{
    local _i ;
    for _i in [ FGristFiles $(<) ]
    {
        _Object $(_i:S=$(SUFOBJ)) : $(_i) ;
        Depends obj : $(_i:S=$(SUFOBJ)) ;
    }
}

# Simplified LibraryFromObjects which doesn't clean the target library
# nor the temporary .o files
rule _Library
{
    local _l _s ;
    _s = [ FGristFiles $(>:S=$(SUFOBJ)) ] ;
    _l = $(<:S=$(SUFLIB)) ;
    _Objects $(>) ;
    Depends obj : $(_s) ;
    MakeLocate $(_l) $(_l)($(_s:BS)) : $(LOCATE_TARGET) ;
    Depends $(_l) : $(_s) ;
    Archive $(_l) : $(_s) ;
    if $(RANLIB) { Ranlib $(_l) ; }
    Depends lib : $(_l) ;
}

# ContribLibrary: library cleaned by 'jam clean-contrib'
rule ContribLibrary
{
    _Library $(<) : $(>) ;
    Clean clean-contrib : [ FGristFiles $(>:S=$(SUFOBJ)) ] ;
    Clean clean-contrib : $(<:S=$(SUFLIB)) ;
}

# Library: library cleaned by 'jam clean'
rule Library
{
    _Library $(<) : $(>) ;
    Clean clean : [ FGristFiles $(>:S=$(SUFOBJ)) ] ;
    Clean clean : $(<:S=$(SUFLIB)) ;
}

# Build HandBrake.app using Xcode
rule OSXApp
{
    Depends     exe   : $(<) ;
    Depends     $(<)  : $(>) ;
    Clean       clean : $(1) macosx/build ;
    BuildOSXApp $(<) ;
}
actions BuildOSXApp
{
    $(RM) $(<) && \
      ( cd macosx && xcodebuild ) && \
      cp -r macosx/build/HandBrake.app $(<) && \
      for i in $(LANGUAGES) ; do \
        ( cd $(<)/Contents/Resources && \
          cp -r English.lproj $i.lproj && \
          cp ../../../macosx/i18n/$i.strings \
            $i.lproj/Localizable.strings ) \
      done ;
}
rule OSXPackage 
{
    Depends         $(<) : $(>) ;
    BuildOSXPackage $(<) ;
}   
actions BuildOSXPackage
{                 
    rm -rf $(<) "HandBrake $(HB_VERSION)" && \
      mkdir "HandBrake $(HB_VERSION)" && \
      cp AUTHORS "HandBrake $(HB_VERSION)/AUTHORS.txt" && \
      cp COPYING "HandBrake $(HB_VERSION)/COPYING.txt" && \
      cp CREDITS "HandBrake $(HB_VERSION)/CREDITS.txt" && \
      cp THANKS "HandBrake $(HB_VERSION)/THANKS.txt" && \
      ( cd doc && ./genhtml.sh ) && \
      cp doc/faq.html "HandBrake $(HB_VERSION)/FAQ.html" && \
      cp -r HandBrake.app "HandBrake $(HB_VERSION)" && \
      zip -9 -r $(<) "HandBrake $(HB_VERSION)" && \
      rm -rf "HandBrake $(HB_VERSION)"
}

rule SystemLibraries
{
    LINKLIBS on [ FAppendSuffix $(<) : $(SUFEXE) ] +=  $(>) ;
}

# Jambase's ObjectHdrs doesn't seem to work when ObjectHdrs is called
# several times on a file, and it doesn't works for asm files. Fixed
# here.
rule ObjectHdrs
{
    local s = [ FGristFiles $(<:S=$(SUFOBJ)) ] ;
    HDRS   on $(s) += $(>) ;
    ASHDRS on $(s) += [ FIncludes $(>) ] ;
    CCHDRS on $(s) += [ FIncludes $(>) ] ;
}