applied Daniel Hedlunds patch that works around jam commandline limit
[supertux.git] / mk / jam / unix.jam
1 #============================================================================
2 # Jam configuration and actions for Linux/Unix
3 #============================================================================
4 SHELL ?= "/bin/sh" ;
5
6 #----------------------------------------------------------------------------
7 # platform specific rules
8
9 ##  ConstructApplicationTarget target : options
10 ##    Constructs the application atrget name (ie. foo.exe for foo)
11 rule ConstructApplicationTarget
12 {
13     return $(<) ;
14 }
15 rule ConstructLibraryTarget
16 {
17     if [ IsElem shared : $(2) ] {
18         return lib$(<).la ;
19     } else {
20         return lib$(<).a ;
21     }
22 }
23 rule ConstructPluginTarget
24 {
25     return $(<).so ;
26 }
27
28 # SystemLinkApplication target : objects : options
29 #  do system specific actions needed for linking the application and construct
30 #  correct clean targets.
31 rule SystemLinkApplication
32 {
33     local target = $($(<)_TARGET) ;
34   
35     Depends $(target) : $(>) ;
36
37     if $(<)_WHOLE_ARCHIVE
38     {
39         WHOLE_ARCH_BEGIN on $(target) = -Wl,--whole-archive ;
40         WHOLE_ARCH_END on $(target) = -Wl,--no-whole-archive ;
41     }
42
43     LinkApplication $(target) : $(>) ;
44     LIBS on $(target) = $(LIBS) ;
45     # setup clean rules
46     Clean clean : $(target) ;
47     Clean $(<)clean : $(target) ;
48 }
49
50 actions LinkApplication bind NEEDLIBS bind NEEDLIBS_WHOLE bind EXTRAOBJECTS
51 {
52     $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(WHOLE_ARCH_BEGIN) \
53       $(NEEDLIBS_WHOLE) $(WHOLE_ARCH_END) $(LIBS)
54 }
55