aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in44
-rw-r--r--xbmc/Makefile.in4
-rw-r--r--xbmc/main/Makefile7
-rw-r--r--xbmc/main/main.cpp (renamed from xbmc/main.cpp)0
-rw-r--r--xbmc/test/Makefile9
-rw-r--r--xbmc/test/xbmc-test.cpp (renamed from xbmc/threads/test/TestMain.cpp)7
-rw-r--r--xbmc/threads/test/Makefile20
-rw-r--r--xbmc/utils/test/Makefile17
-rw-r--r--xbmc/utils/test/TestMain.cpp29
9 files changed, 53 insertions, 84 deletions
diff --git a/Makefile.in b/Makefile.in
index 2b25695a01..dfe5c7b209 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -90,8 +90,8 @@ DIRECTORY_ARCHIVES=$(DVDPLAYER_ARCHIVES) \
xbmc/xbmc.a \
-NWAOBJSXBMC= xbmc/commons/commons.a \
- xbmc/threads/threads.a \
+NWAOBJSXBMC= xbmc/threads/threads.a \
+ xbmc/commons/commons.a
ifeq (@USE_WEB_SERVER@,1)
@@ -242,8 +242,18 @@ endif
FINAL_TARGETS+=Makefile externals
GTEST_DIR = lib/gtest
+GTEST_INCLUDES = -I$(GTEST_DIR)/include
+GTEST_LIBS = $(GTEST_DIR)/lib/.libs/libgtest.a
+
CHECK_DIRS = xbmc/utils/test \
- xbmc/threads/test
+ xbmc/threads/test \
+ xbmc/test
+CHECK_LIBS = xbmc/utils/test/utilsTest.a \
+ xbmc/threads/test/threadTest.a \
+ xbmc/test/xbmc-test.a
+CHECK_PROGRAMS = xbmc-test
+
+CLEAN_FILES += $(CHECK_PROGRAMS)
all : $(FINAL_TARGETS)
@echo '-----------------------'
@@ -417,14 +427,17 @@ else
$(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ -Wl,--whole-archive $(DYNOBJSXBMC) $(OBJSXBMC) -Wl,--no-whole-archive -Wl,--no-undefined $(NWAOBJSXBMC) $(LIBS)
endif
-xbmc.bin: $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC)
+xbmc.bin: xbmc/main/main.a $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC)
ifeq ($(findstring osx,@ARCH@), osx)
- $(SILENT_LD) $(CXX) $(LDFLAGS) -o xbmc.bin -Wl,-all_load,-ObjC $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) $(LIBS) -rdynamic
+ $(SILENT_LD) $(CXX) $(LDFLAGS) -o xbmc.bin -Wl,-all_load,-ObjC $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) xbmc/main/main.a $(LIBS) -rdynamic
else
- $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o xbmc.bin -Wl,--whole-archive $(DYNOBJSXBMC) $(OBJSXBMC) -Wl,--no-whole-archive $(NWAOBJSXBMC) $(LIBS) -rdynamic
+ $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o xbmc.bin -Wl,--whole-archive $(DYNOBJSXBMC) $(OBJSXBMC) xbmc/main/main.a -Wl,--no-whole-archive $(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
@@ -577,17 +590,26 @@ clean-externals: clean-codecs clean-eventclients clean-xbmctex clean-libs \
ifeq (1,@GTEST_CONFIGURED@)
check: testsuite
- for d in $(CHECK_DIRS); do if test -f $$d/Makefile; then $(MAKE) -C $$d $@; fi; done
+ for check_program in $(CHECK_PROGRAMS); do $(CURDIR)/$$check_program; done
-testsuite: testframework
- for d in $(CHECK_DIRS); do if test -f $$d/Makefile; then $(MAKE) -C $$d $@; fi; done
+testsuite: $(CHECK_PROGRAMS)
-testframework: $(GTEST_DIR)/lib/.libs/libgtest.a $(GTEST_DIR)/lib/.libs/libgtest_main.a
+testframework: $(GTEST_LIBS)
-$(GTEST_DIR)/lib/.libs/libgtest.a $(GTEST_DIR)/lib/.libs/libgtest_main.a: $(GTEST_DIR)/Makefile
+$(GTEST_LIBS): $(GTEST_DIR)/Makefile
$(GTEST_DIR)/Makefile: force
$(MAKE) -C $(GTEST_DIR)
+
+$(CHECK_LIBS): force
+ @$(MAKE) $(if $(V),,-s) -C $(@D)
+
+xbmc-test: $(CHECK_LIBS) $(OBJSXBMC) $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(GTEST_LIBS)
+ifeq ($(findstring osx,@ARCH@), osx)
+ $(SILENT_LD) $(CXX) $(LDFLAGS) $(GTEST_INCLUDES) -o $@ -Wl,-all_load,-ObjC $(CHECK_LIBS) $(DYNOBJSXBMC) $(NWAOBJSXBMC) $(OBJSXBMC) $(GTEST_LIBS) $(LIBS) -rdynamic
+else
+ $(SILENT_LD) $(CXX) $(CXXFLAGS) $(LDFLAGS) $(GTEST_INCLUDES) -o $@ -Wl,--whole-archive $(CHECK_LIBS) $(DYNOBJSXBMC) $(OBJSXBMC) -Wl,--no-whole-archive $(NWAOBJSXBMC) $(GTEST_LIBS) $(LIBS) -rdynamic
+endif
else
# Give a message that the framework is not configured, but don't fail.
check testsuite testframework:
diff --git a/xbmc/Makefile.in b/xbmc/Makefile.in
index f0d2bae73e..ebae796c29 100644
--- a/xbmc/Makefile.in
+++ b/xbmc/Makefile.in
@@ -38,10 +38,6 @@ SRCS=Application.cpp \
LIB=xbmc.a
-ifneq (@USE_LIBXBMC@,1)
-SRCS += main.cpp
-endif
-
DISTCLEAN_FILES=DllPaths_generated.h
include @abs_top_srcdir@/Makefile.include
diff --git a/xbmc/main/Makefile b/xbmc/main/Makefile
new file mode 100644
index 0000000000..4bf3b2acb9
--- /dev/null
+++ b/xbmc/main/Makefile
@@ -0,0 +1,7 @@
+SRCS= \
+ main.cpp
+
+LIB=main.a
+
+include ../../Makefile.include
+-include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS)))
diff --git a/xbmc/main.cpp b/xbmc/main/main.cpp
index b9b2d587ff..b9b2d587ff 100644
--- a/xbmc/main.cpp
+++ b/xbmc/main/main.cpp
diff --git a/xbmc/test/Makefile b/xbmc/test/Makefile
new file mode 100644
index 0000000000..60a0b58df1
--- /dev/null
+++ b/xbmc/test/Makefile
@@ -0,0 +1,9 @@
+SRCS= \
+ xbmc-test.cpp
+
+LIB=xbmc-test.a
+
+INCLUDES += -I../../lib/gtest/include
+
+include ../../Makefile.include
+-include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS)))
diff --git a/xbmc/threads/test/TestMain.cpp b/xbmc/test/xbmc-test.cpp
index efb5b2531a..fd17aedf50 100644
--- a/xbmc/threads/test/TestMain.cpp
+++ b/xbmc/test/xbmc-test.cpp
@@ -19,13 +19,11 @@
*
*/
-#include "TestHelpers.h"
+#include "gtest/gtest.h"
#include "threads/Thread.h"
#include "commons/ilog.h"
-using ::testing::InitGoogleTest;
-
class NullLogger : public XbmcCommons::ILogger
{
public:
@@ -34,7 +32,7 @@ public:
int main(int argc, char **argv)
{
- InitGoogleTest(&argc, argv);
+ testing::InitGoogleTest(&argc, argv);
// we need to configure CThread to use a dummy logger
NullLogger* nullLogger = new NullLogger();
@@ -46,4 +44,3 @@ int main(int argc, char **argv)
return ret;
}
-
diff --git a/xbmc/threads/test/Makefile b/xbmc/threads/test/Makefile
index 81d33c72be..d41a2abc07 100644
--- a/xbmc/threads/test/Makefile
+++ b/xbmc/threads/test/Makefile
@@ -1,30 +1,12 @@
SRCS= \
- TestMain.cpp \
TestEvent.cpp \
TestSharedSection.cpp \
TestAtomics.cpp \
TestThreadLocal.cpp
-
LIB=threadTest.a
-CLEAN_FILES=testMain
-
-GTEST_INCLUDES = -I../../../lib/gtest/include
-GTEST_LIBS = ../../../lib/gtest/lib/.libs/libgtest.a \
- ../../../lib/gtest/lib/.libs/libgtest_main.a
-
-INCLUDES += $(GTEST_INCLUDES)
-
-check: testsuite
- ./testMain
-
-testsuite: testMain
+INCLUDES += -I../../../lib/gtest/include
include ../../../Makefile.include
-include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS)))
-
-testMain: $(LIB) ../threads.a $(GTEST_LIBS)
- $(CXX) $(CXXFLAGS) $(LDFLAGS) $(GTEST_INCLUDES) -o testMain $(OBJS) ../threads.a ../../commons/commons.a $(GTEST_LIBS) -lpthread -lrt
-
-
diff --git a/xbmc/utils/test/Makefile b/xbmc/utils/test/Makefile
index 679b657e9c..c4b6e16ee8 100644
--- a/xbmc/utils/test/Makefile
+++ b/xbmc/utils/test/Makefile
@@ -1,24 +1,9 @@
SRCS= \
- TestMain.cpp \
TestGlobalsHandling.cpp
LIB=utilsTest.a
-CLEAN_FILES=testMain
-
-GTEST_INCLUDES = -I../../../lib/gtest/include
-GTEST_LIBS = ../../../lib/gtest/lib/.libs/libgtest.a \
- ../../../lib/gtest/lib/.libs/libgtest_main.a
-
-INCLUDES += $(GTEST_INCLUDES)
-
-check: testsuite
- ./testMain
-
-testsuite: testMain
+INCLUDES += -I../../../lib/gtest/include
include ../../../Makefile.include
-include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS)))
-
-testMain: $(LIB) $(GTEST_LIBS)
- $(CXX) $(CXXFLAGS) $(LDFLAGS) $(GTEST_INCLUDES) -o testMain -Wl,--whole-archive $(LIB) -Wl,--no-whole-archive $(GTEST_LIBS) -lpthread
diff --git a/xbmc/utils/test/TestMain.cpp b/xbmc/utils/test/TestMain.cpp
deleted file mode 100644
index bc04ff83f9..0000000000
--- a/xbmc/utils/test/TestMain.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2005-2011 Team XBMC
- * http://www.xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-#include "gtest/gtest.h"
-
-using ::testing::InitGoogleTest;
-
-int main(int argc, char **argv) {
- InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}