## noinstall: Don't setup a default installation target.
## independent: The target will not be made a dependency of the apps and
## all target.
+## linkerfile: Store a list of objects in a file and link using that
+## file. Use this to get around Jam's 10240 character argument limit.
rule Application
{
# check options
- CheckOptions noinstall console independent : $(3) : $(<) ;
+ CheckOptions noinstall console independent linkerfile : $(3) : $(<) ;
local target = [ ConstructApplicationTarget $(<) : $(3) ] ;
local sources = [ SearchSource $(>) ] ;
}
}
-rule LinkWithWholeArchive
-{
- local i libs sharedlib ;
-
- for i in $(>) {
- if $($(i)_TYPE) = "library" {
- if [ IsElem shared : $($(i)_OPTIONS) ] {
- libs += $(i) ;
- sharedlib = true ;
- } else {
- # for non shared libs add inherit the compile flags and libs
- libs += $(i) $($(i)_LIBRARIES) ;
- # inherit the exported flags
- CppFlags $(<) : $($(i)_CPPFLAGS) : $(3) ;
- CFlags $(<) : $($(i)_CFLAGS) : $(3) ;
- C++Flags $(<) : $($(i)_CXXFLAGS) : $(3) ;
- LFlags $(<) : $($(i)_LIBS) : $(3) ;
- }
- } else {
- echo "WARNING: Trying to link" $(i)
- "with" $(<) "which is not a library." ;
- }
- }
- # resolve library dependencies
- libs = [ RemoveDups $(libs) ] ;
- $(<)_LIBRARIES = $(libs) ;
-
- local libfiles ;
- for i in $(libs) {
- libfiles += $($(i)_TARGET) ;
- }
-
- DEPENDS $($(<)_TARGET) : $(libfiles) ;
- NEEDLIBS_WHOLE on $($(<)_TARGET) += $(libfiles) ;
- $(<)_WHOLE_ARCHIVE = true ;
- # the usual libtool hack...
- if $(sharedlib) {
- LINK on $($(<)_TARGET) = "$(LIBTOOL) $(LINK)" ;
- INSTALL on $($(<)_INSTALLTARGET) = "$(LIBTOOL) --mode=install $(INSTALL)" ;
- }
-}
-
rule CppFlags
{
CPPFLAGS on $($(<)_OBJECTS) += $(>) ;
{
local target = $($(<)_TARGET) ;
Depends $(target) : $(>) ;
-
- if $(<)_WHOLE_ARCHIVE
+
+ if [ IsElem linkerfile : $(3) ]
+ {
+ RemoveLinkerInputFile $(target) ;
+ local i ;
+ for i in $(>) { AppendLinkerInputFile $(target) : $(i) ; }
+ LinkApplicationFromFile $(target) : $(target) ;
+ RemoveLinkerInputFile $(target) ;
+ }
+ else
{
- WHOLE_ARCH_BEGIN on $(target) = -Wl,--whole-archive ;
- WHOLE_ARCH_END on $(target) = -Wl,--no-whole-archive ;
+ LinkApplication $(target) : $(>) ;
}
- LinkApplication $(target) : $(>) ;
LIBS on $(target) = $(LIBS) ;
Clean clean : $(target) ;
Clean $(<)clean : $(target) ;
# LinkApplicationConsole exe : objects
# Link a console (non-GUI) appliation from a set of object files.
-actions LinkApplication bind NEEDLIBS bind NEEDLIBS_WHOLE bind EXTRAOBJECTS
+actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
+{
+ $(MACOSX.ENVIRON)
+ $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
+}
+
+actions quietly RemoveLinkerInputFile
+{
+ $(RM) $(<).opt
+}
+
+actions quietly together piecemeal AppendLinkerInputFile
+{
+ echo $(>) >> $(<).opt
+}
+
+actions LinkApplicationFromFile bind NEEDLIBS bind EXTRAOBJECTS
{
$(MACOSX.ENVIRON)
- $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(WHOLE_ARCH_BEGIN) \
- $(NEEDLIBS_WHOLE) $(WHOLE_ARCH_END) $(LIBS)
+ $(LINK) -o $(<) `cat $(>).opt` $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
+# $(LINK) -o $(<) -Xlinker @$(>).opt $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
}
# correct clean targets.
rule SystemLinkApplication
{
+ # check options
+ CheckOptions linkerfile : $(3) : $(<) ;
+
local target = $($(<)_TARGET) ;
Depends $(target) : $(>) ;
- if $(<)_WHOLE_ARCHIVE
+ if [ IsElem linkerfile : $(3) ]
+ {
+ RemoveLinkerInputFile $(target) ;
+ local i ;
+ for i in $(>) { AppendLinkerInputFile $(target) : $(i) ; }
+ LinkApplicationFromFile $(target) : $(target) ;
+ RemoveLinkerInputFile $(target) ;
+ }
+ else
{
- WHOLE_ARCH_BEGIN on $(target) = -Wl,--whole-archive ;
- WHOLE_ARCH_END on $(target) = -Wl,--no-whole-archive ;
+ LinkApplication $(target) : $(>) ;
}
- LinkApplication $(target) : $(>) ;
LIBS on $(target) = $(LIBS) ;
# setup clean rules
Clean clean : $(target) ;
Clean $(<)clean : $(target) ;
}
-actions LinkApplication bind NEEDLIBS bind NEEDLIBS_WHOLE bind EXTRAOBJECTS
+actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
+{
+ $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
+}
+
+actions quietly RemoveLinkerInputFile
+{
+ $(RM) $(<).opt
+}
+
+actions quietly together piecemeal AppendLinkerInputFile
+{
+ echo $(>) >> $(<).opt
+}
+
+actions LinkApplicationFromFile bind NEEDLIBS bind EXTRAOBJECTS
{
- $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(WHOLE_ARCH_BEGIN) \
- $(NEEDLIBS_WHOLE) $(WHOLE_ARCH_END) $(LIBS)
+ $(LINK) -o $(<) `cat $(>).opt` $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
+# $(LINK) -o $(<) -Xlinker @$(>).opt $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
}
Depends $(target) : $(>) ;
- if $(<)_WHOLE_ARCHIVE
+ if [ IsElem linkerfile : $(3) ]
{
- WHOLE_ARCH_BEGIN on $(target) = -Wl,--whole-archive ;
- WHOLE_ARCH_END on $(target) = -Wl,--no-whole-archive ;
+ RemoveLinkerInputFile $(target) ;
+ local i ;
+ for i in $(>) { AppendLinkerInputFile $(target) : $(i) ; }
+ LinkApplicationFromFile $(target) : $(target) ;
+ RemoveLinkerInputFile $(target) ;
+ }
+ else
+ {
+ LinkApplication $(target) : $(>) ;
}
- LinkApplication $(target) : $(>) ;
LIBS on $(target) = $(LIBS) ;
# setup clean rules
Clean clean : $(target) ;
Clean $(<)clean : $(target) ;
}
-actions LinkApplication bind NEEDLIBS bind NEEDLIBS_WHOLE bind EXTRAOBJECTS
+actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
+{
+ $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
+}
+
+actions quietly RemoveLinkerInputFile
+{
+ $(RM) $(<).opt
+}
+
+actions quietly together piecemeal AppendLinkerInputFile
+{
+ echo $(>) >> $(<).opt
+}
+
+actions LinkApplicationFromFile bind NEEDLIBS bind EXTRAOBJECTS
{
- $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(WHOLE_ARCH_BEGIN) \
- $(NEEDLIBS_WHOLE) $(WHOLE_ARCH_END) $(LIBS)
+ $(LINK) -o $(<) `cat $(>).opt` $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
+# $(LINK) -o $(<) -Xlinker @$(>).opt $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
}
SubInclude TOP src squirrel ;
SubInclude TOP src scripting ;
-#------------------------
-# SuperTux ARCHIVE FILES:
-#------------------------
-# the following keeps the .o files after an archive file (.a) is created
-NOARUPDATE = true ;
-
-for i in audio badguy control gui lisp math object physfs sprite
- tinygettext trigger video worldmap
-{
- sources = [ Wildcard $(i) : *.cpp *.hpp ] ;
- Library $(i) : $(sources) : noinstall ;
- TRANSLATABLE_SOURCES += [ SearchSource $(sources) ] ;
-}
-
-ExternalLibs audio badguy control gui lisp math object physfs sprite
- tinygettext trigger video worldmap
- : SDL SDLIMAGE GL OPENAL VORBIS VORBISFILE OGG ICONV PHYSFS BINRELOC ;
-IncludeDir audio badguy control gui lisp math object physfs sprite
- tinygettext trigger video worldmap
- : squirrel/include squirrel ;
-
-#----------------------
-# SuperTux Application:
-#----------------------
-sources = [ Wildcard *.cpp *.hpp ] ;
+sources =
+ [ Wildcard *.cpp *.hpp ]
+ [ Wildcard audio : *.cpp *.hpp ]
+ [ Wildcard audio/newapi : *.cpp *.hpp ]
+ [ Wildcard badguy : *.cpp *.hpp ]
+ [ Wildcard control : *.cpp *.hpp ]
+ [ Wildcard gui : *.cpp *.hpp ]
+ [ Wildcard lisp : *.cpp *.hpp ]
+ [ Wildcard math : *.cpp *.hpp ]
+ [ Wildcard object : *.cpp *.hpp ]
+ [ Wildcard physfs : *.cpp *.hpp ]
+ [ Wildcard sprite : *.cpp *.hpp ]
+ [ Wildcard tinygettext : *.cpp *.hpp ]
+ [ Wildcard trigger : *.cpp *.hpp ]
+ [ Wildcard video : *.cpp *.hpp ]
+ [ Wildcard worldmap : *.cpp *.hpp ]
+;
TRANSLATABLE_SOURCES += [ SearchSource $(sources) ] ;
-Application supertux : $(sources) $(wrapper_objects) ;
+#Application supertux : $(sources) $(wrapper_objects) ;
+Application supertux : $(sources) $(wrapper_objects) : linkerfile ;
C++Flags supertux : -DAPPDATADIR='\"$(appdatadir)\"' ;
LinkWith supertux : squirrel ;
ExternalLibs supertux : SDL SDLIMAGE GL OPENAL VORBIS VORBISFILE OGG ICONV PHYSFS BINRELOC ;
Help supertux : "Build the supertux executable" ;
IncludeDir supertux : squirrel/include squirrel ;
-LinkWithWholeArchive supertux : audio badguy control gui lisp math object physfs sprite
- tinygettext trigger video worldmap ;