Option to jump with up on keyboard.
[supertux.git] / mk / jam / win32.jam
1 #============================================================================
2 # Jam configuration and actions for Win32
3 #============================================================================
4 SHELL ?= "/bin/sh" ;
5
6 #----------------------------------------------------------------------------
7 # resource handling
8 # Unfortunately we can't simply specify resources on the source list, because
9 # Mingw/Cygwin have the limitation that they can only link 1 resource file
10 # in. So we have to concatenate all resourcefiles here before compiling them.
11
12 actions together CompileResources
13 {
14     cat $(>) | $(WINDRES) $(WINDRES_FLAGS) --include-dir=$(>:D) -o $(<)
15 }
16
17 rule CompileResources
18 {
19     Depends $(<) : $(>) ;
20 }
21
22 rule Win32Resource
23 {
24     local target = $($(<)_TARGET) ;
25     local rcobject = [ LocateTarget _resource.o ] ;
26     
27     # only add 1 resource object per target
28     if ! $($(<)_HASWIN32RESOURCE)
29     {
30         $(<)_HASWIN32RESOURCE = yes ;
31         ExtraObjects $(<) : $(rcobject) ;
32     }
33
34     CompileResources $(rcobject) : $(>) ;
35 }
36
37 #----------------------------------------------------------------------------
38 # linking part
39
40 ##  ConstructApplicationTarget target : options
41 ##    Constructs the application atrget name (ie. foo.exe for foo)
42 rule ConstructApplicationTarget
43 {
44   return $(<).exe ;
45 }
46 rule ConstructLibraryTarget
47 {
48   return lib$(<).a ;
49 }
50 rule ConstructPluginTarget
51 {
52   return $(<).dll ;
53 }
54
55 # SystemLinkApplication target : objects : options
56 rule SystemLinkApplication
57 {
58   local target = $($(<)_TARGET) ;
59
60   Depends $(target) : $(>) ;
61
62   if [ IsElem linkerfile : $(3) ]
63   {
64     RemoveLinkerInputFile $(target) ;
65     local i ;
66     for i in $(>) { AppendLinkerInputFile $(target) : $(i) ; }
67     LinkApplicationFromFile $(target) : $(target) ;
68     RemoveLinkerInputFile $(target) ;
69   }
70   else
71   {
72     LinkApplication $(target) : $(>) ;
73   }
74
75   LIBS on $(target) = $(LIBS) ;
76   # setup clean rules
77   Clean clean : $(target) ;
78   Clean $(<)clean : $(target) ;
79 }
80
81 actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
82 {
83   $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
84 }
85
86 actions quietly RemoveLinkerInputFile
87 {
88   $(RM) $(<).opt
89 }
90
91 actions quietly together piecemeal AppendLinkerInputFile
92 {
93   echo $(>) >> $(<).opt
94 }
95
96 actions LinkApplicationFromFile bind NEEDLIBS bind EXTRAOBJECTS
97 {
98   $(LINK) -o $(<) `cat $(>).opt` $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
99 #  $(LINK) -o $(<) -Xlinker @$(>).opt $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
100 }
101