fix for older sed versions
[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 = [ DoObjectGrist _resource.o ] ;
26     LOCATE on $(rcobject) = $(LOCATE_TARGET) ;
27     SEARCH on $(rcobject) = $(LOCATE_TARGET) ;
28     
29     # only add 1 resource object per target
30     if ! $($(<)_HASWIN32RESOURCE)
31     {
32         $(<)_HASWIN32RESOURCE = yes ;
33         ExtraObjects $(<) : $(rcobject) ;
34     }
35
36     CompileResources $(rcobject) : $(>) ;
37 }
38
39 #----------------------------------------------------------------------------
40 # linking part
41
42 ##  ConstructApplicationTarget target : options
43 ##    Constructs the application atrget name (ie. foo.exe for foo)
44 rule ConstructApplicationTarget
45 {
46   return $(<).exe ;
47 }
48 rule ConstructLibraryTarget
49 {
50   return lib$(<).a ;
51 }
52 rule ConstructPluginTarget
53 {
54   return $(<).dll ;
55 }
56
57 # SystemLinkApplication target : objects : options
58 rule SystemLinkApplication
59 {
60   local target = $($(<)_TARGET) ;
61
62   Depends $(target) : $(>) ;
63   LinkApplication $(target) : $(>) ;
64   # setup clean rules
65   Clean clean : $(target) ;
66   Clean $(<)clean : $(target) ;
67 }
68
69 actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
70 {
71   $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LFLAGS)
72 }
73