}
}
+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
+ {
+ WHOLE_ARCH_BEGIN on $(target) = -Wl,--whole-archive ;
+ WHOLE_ARCH_END on $(target) = -Wl,--no-whole-archive ;
+ }
+
LinkApplication $(target) : $(>) ;
LIBS on $(target) = $(LIBS) ;
Clean clean : $(target) ;
# LinkApplicationConsole exe : objects
# Link a console (non-GUI) appliation from a set of object files.
-actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
+actions LinkApplication bind NEEDLIBS bind NEEDLIBS_WHOLE bind EXTRAOBJECTS
{
$(MACOSX.ENVIRON)
- $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
+ $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(WHOLE_ARCH_BEGIN) \
+ $(NEEDLIBS_WHOLE) $(WHOLE_ARCH_END) $(LIBS)
}
local target = $($(<)_TARGET) ;
Depends $(target) : $(>) ;
+
+ if $(<)_WHOLE_ARCHIVE
+ {
+ WHOLE_ARCH_BEGIN on $(target) = -Wl,--whole-archive ;
+ WHOLE_ARCH_END on $(target) = -Wl,--no-whole-archive ;
+ }
+
LinkApplication $(target) : $(>) ;
LIBS on $(target) = $(LIBS) ;
# setup clean rules
Clean $(<)clean : $(target) ;
}
-actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
+actions LinkApplication bind NEEDLIBS bind NEEDLIBS_WHOLE bind EXTRAOBJECTS
{
- $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
+ $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(WHOLE_ARCH_BEGIN) \
+ $(NEEDLIBS_WHOLE) $(WHOLE_ARCH_END) $(LIBS)
}
-
local target = $($(<)_TARGET) ;
Depends $(target) : $(>) ;
+
+ if $(<)_WHOLE_ARCHIVE
+ {
+ WHOLE_ARCH_BEGIN on $(target) = -Wl,--whole-archive ;
+ WHOLE_ARCH_END on $(target) = -Wl,--no-whole-archive ;
+ }
+
LinkApplication $(target) : $(>) ;
LIBS on $(target) = $(LIBS) ;
# setup clean rules
Clean $(<)clean : $(target) ;
}
-actions LinkApplication bind NEEDLIBS bind EXTRAOBJECTS
+actions LinkApplication bind NEEDLIBS bind NEEDLIBS_WHOLE bind EXTRAOBJECTS
{
- $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(LIBS)
+ $(LINK) -o $(<) $(>) $(EXTRAOBJECTS) $(NEEDLIBS) $(WHOLE_ARCH_BEGIN) \
+ $(NEEDLIBS_WHOLE) $(WHOLE_ARCH_END) $(LIBS)
}
SubInclude TOP src squirrel ;
SubInclude TOP src scripting ;
-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 ]
-;
+#------------------------
+# 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 ] ;
TRANSLATABLE_SOURCES += [ SearchSource $(sources) ] ;
Application supertux : $(sources) $(wrapper_objects) ;
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 ;