diff options
author | Cory Fields <theuni-nospam-@xbmc.org> | 2013-05-02 16:45:41 -0400 |
---|---|---|
committer | Cory Fields <theuni-nospam-@xbmc.org> | 2013-05-09 05:36:19 -0400 |
commit | 101fbc2d6869d6f02c4345a232854dbbb3f1a855 (patch) | |
tree | d8c0aac9f484e6b0734ac34cf688b23097f8e6e6 /Makefile.in | |
parent | 06b20663ebf9a59691b6e61e4ac0fa2d46968441 (diff) |
build: stop using whole-archive for our final binary
This nasty hack has been around for ages. By changing, we get the following
benefits:
- We don't link in _every_ object in _every_ archive!
- Builds will no longer fail if a source file has been removed but its object
still exists in the archive
- Filesize reduction
- Ability to use lto, garbage collection, dead-code stripping, etc in a
useful manner
This is achieved by specifying a main object on the link line, and using
start-group/end-group to search through the archives multiple times until each
symbol is found.
Diffstat (limited to 'Makefile.in')
-rw-r--r-- | Makefile.in | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Makefile.in b/Makefile.in index 3cbe1a2357..f0827f2b98 100644 --- a/Makefile.in +++ b/Makefile.in @@ -92,6 +92,9 @@ DIRECTORY_ARCHIVES=$(DVDPLAYER_ARCHIVES) \ xbmc/windows/windows.a \ xbmc/xbmc.a \ +ifneq (@USE_LIBXBMC@,1) +DIRECTORY_ARCHIVES +=xbmc/main/main.a +endif NWAOBJSXBMC= xbmc/threads/threads.a \ xbmc/commons/commons.a @@ -425,24 +428,29 @@ endif OBJSXBMC:=$(filter-out $(DYNOBJSXBMC), $(OBJSXBMC)) -libxbmc.so: $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC) +MAINOBJS=xbmc/xbmc.o +ifeq (@USE_ANDROID@,1) +MAINOBJS+=xbmc/android/activity/android_main.o +endif +ifneq (@USE_LIBXBMC@,1) +MAINOBJS+=xbmc/main/main.o +endif + +libxbmc.so: $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(MAINOBJS) ifeq ($(findstring osx,@ARCH@), osx) $(SILENT_LD) $(CXX) $(LDFLAGS) -bundle -o $@ -Wl,-all_load,-ObjC $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) $(LIBS) else - $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ -Wl,--whole-archive $(DYNOBJSXBMC) $(OBJSXBMC) -Wl,--no-whole-archive -Wl,--no-undefined $(NWAOBJSXBMC) $(LIBS) + $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(MAINOBJS) -Wl,--start-group $(DYNOBJSXBMC) $(OBJSXBMC) -Wl,--end-group -Wl,--no-undefined $(NWAOBJSXBMC) $(LIBS) endif -xbmc.bin: xbmc/main/main.a $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC) +xbmc.bin: $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(MAINOBJS) ifeq ($(findstring osx,@ARCH@), osx) - $(SILENT_LD) $(CXX) $(LDFLAGS) -o xbmc.bin -Wl,-all_load,-ObjC $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) xbmc/main/main.a $(LIBS) -rdynamic + $(SILENT_LD) $(CXX) $(LDFLAGS) -o xbmc.bin -Wl,-all_load,-ObjC $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) $(LIBS) -rdynamic else - $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o xbmc.bin -Wl,--whole-archive $(DYNOBJSXBMC) $(OBJSXBMC) xbmc/main/main.a -Wl,--no-whole-archive $(NWAOBJSXBMC) $(LIBS) -rdynamic + $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o xbmc.bin $(MAINOBJS) -Wl,--start-group $(DYNOBJSXBMC) $(OBJSXBMC) -Wl,--end-group $(NWAOBJSXBMC) $(LIBS) -rdynamic endif -xbmc/main/main.a: force - $(MAKE) -C xbmc/main - xbmc-xrandr: xbmc-xrandr.c ifneq (1,@USE_XRANDR@) # xbmc-xrandr.c gets picked up by the default make rules |