From f6e73393afbe7ce8d1a5c5fc55565582cb8906cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Fri, 24 Jul 2009 20:09:29 +0200
Subject: Update the build system.

Coverage now works better.
Some files are cleaned by default (without the need of CLEANFILES).

diff --git a/.gitignore b/.gitignore
index 8a6563e..697ca06 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 .DS_Store
 *.dep
+*.gcov
 *.gcda
 *.gcno
 *.app
diff --git a/3rdParty/Boost/Makefile.inc b/3rdParty/Boost/Makefile.inc
index 27aed09..d28bbcb 100644
--- a/3rdParty/Boost/Makefile.inc
+++ b/3rdParty/Boost/Makefile.inc
@@ -57,6 +57,3 @@ endif
 
 BOOST_OBJECTS = \
 	$(BOOST_SOURCES:.cpp=.o)
-
-CLEANFILES += \
-	$(BOOST_OBJECTS)
diff --git a/3rdParty/CppUnit/Makefile.inc b/3rdParty/CppUnit/Makefile.inc
index 27aadc2..3749144 100644
--- a/3rdParty/CppUnit/Makefile.inc
+++ b/3rdParty/CppUnit/Makefile.inc
@@ -39,9 +39,5 @@ CPPUNIT_SOURCES = \
 CPPUNIT_OBJECTS = \
 	$(CPPUNIT_SOURCES:.cpp=.o)
 
-CLEANFILES += \
-	$(CPPUNIT_OBJECTS) \
-	$(CPPUNIT_TARGET)
-
 $(CPPUNIT_TARGET): $(CPPUNIT_OBJECTS)
 	$(QUIET_AR)$(AR) $(ARFLAGS) $@ $(CPPUNIT_OBJECTS)
diff --git a/3rdParty/Expat/Makefile.inc b/3rdParty/Expat/Makefile.inc
index c143263..a241cf1 100644
--- a/3rdParty/Expat/Makefile.inc
+++ b/3rdParty/Expat/Makefile.inc
@@ -8,10 +8,6 @@ EXPAT_SOURCES = \
 EXPAT_OBJECTS = \
 	$(EXPAT_SOURCES:.c=.o)
 
-CLEANFILES += \
-	$(EXPAT_OBJECTS) \
-	$(EXPAT_TARGET)
-
 $(EXPAT_TARGET): $(EXPAT_OBJECTS)
 	$(QUIET_AR)$(AR) $(ARFLAGS) $@ $(EXPAT_OBJECTS)
 
diff --git a/3rdParty/LibIDN/Makefile.inc b/3rdParty/LibIDN/Makefile.inc
index f0f64ac..2aeb34b 100644
--- a/3rdParty/LibIDN/Makefile.inc
+++ b/3rdParty/LibIDN/Makefile.inc
@@ -18,8 +18,3 @@ LIBIDN_SOURCES += \
 
 LIBIDN_OBJECTS = \
 	$(LIBIDN_SOURCES:.c=.o)
-
-CLEANFILES += \
-	$(LIBIDN_OBJECTS)
-
-
diff --git a/3rdParty/SQLite/Makefile.inc b/3rdParty/SQLite/Makefile.inc
index 339e7a0..141cfca 100644
--- a/3rdParty/SQLite/Makefile.inc
+++ b/3rdParty/SQLite/Makefile.inc
@@ -5,7 +5,3 @@ SQLITE_SOURCES = \
 
 SQLITE_OBJECTS = \
 	$(SQLITE_SOURCES:.c=.o)
-
-CLEANFILES += \
-	$(SQLITE_OBJECTS) \
-	$(SQLITE_TARGET)
diff --git a/3rdParty/ZLib/Makefile.inc b/3rdParty/ZLib/Makefile.inc
index dccfcf4..a30f65d 100644
--- a/3rdParty/ZLib/Makefile.inc
+++ b/3rdParty/ZLib/Makefile.inc
@@ -17,6 +17,3 @@ ZLIB_SOURCES += \
 
 ZLIB_OBJECTS = \
 	$(ZLIB_SOURCES:.c=.o)
-
-CLEANFILES += \
-	$(ZLIB_OBJECTS)
diff --git a/Limber/Makefile.inc b/Limber/Makefile.inc
index ea0d288..fe0e7d2 100644
--- a/Limber/Makefile.inc
+++ b/Limber/Makefile.inc
@@ -11,6 +11,5 @@ $(LIMBER_TARGET): $(SWIFTEN_TARGET) $(LIMBER_OBJECTS)
 	$(QUIET_LINK)$(CXX) -o $(LIMBER_TARGET) $(LIMBER_OBJECTS) $(LDFLAGS) $(SWIFTEN_TARGET) $(LIBS)
 
 #TARGETS += $(LIMBER_TARGET)
-CLEANFILES += $(LIMBER_OBJECTS)
 DEPS += \
 	$(LIMBER_SOURCES:.cpp=.dep) \
diff --git a/Makefile b/Makefile
index 8ea2c13..b93c85f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 include Makefile.config
 
-CXXFLAGS += -I.
-CFLAGS += -I.
+CXXFLAGS += -I$(PWD)
+CFLAGS += -I$(PWD)
 ARFLAGS = rcs
 
 .DEFAULT_GOAL = all
@@ -66,16 +66,9 @@ coverage:
 	tools/coverage/GenerateCoverageResults.sh
 
 .PHONY: clean
-clean: clean-deps $(CLEAN_TARGETS)
-
-	-$(RM) $(CLEANFILES) *.gcov
-	-find . -name "*.gcda" -exec rm {} \;
-	-find . -name "*.gcno" -exec rm {} \;
-
-.PHONY: clean-deps
-clean-deps:
-		-$(RM) $(DEPS)
-
+clean: $(CLEAN_TARGETS)
+	-rm -rf $(CLEANFILES)
+	-find . \( -name "*.dep" -or -name "*.a" -or -name "*.o" -or -name "*.obj" -or -name "*.gcda" -or -name "*.gcno" -or -name "*.gcov" \) -exec rm {} \;
 
 ################################################################################
 # Automatic dependency detection
diff --git a/QA/UnitTest/Makefile.inc b/QA/UnitTest/Makefile.inc
index 531f616..f51828e 100644
--- a/QA/UnitTest/Makefile.inc
+++ b/QA/UnitTest/Makefile.inc
@@ -6,7 +6,7 @@ UNITTEST_OBJECTS = \
 
 TEST_TARGETS += check
 
-CLEANFILES += $(UNITTEST_OBJECTS) $(UNITTEST_TARGET)
+CLEANFILES += $(UNITTEST_TARGET)
 DEPS += $(UNITTEST_SOURCES:.cpp=.dep)
 
 .PHONY: check
diff --git a/Slimber/CLI/Makefile.inc b/Slimber/CLI/Makefile.inc
index 601929c..974b835 100644
--- a/Slimber/CLI/Makefile.inc
+++ b/Slimber/CLI/Makefile.inc
@@ -7,10 +7,9 @@ SLIMBER_CLI_OBJECTS = \
 $(SLIMBER_CLI_TARGET): $(SWIFTEN_TARGET) $(SLIMBER_TARGET) $(SLIMBER_CLI_OBJECTS)
 	$(QUIET_LINK)$(CXX) -o $(SLIMBER_CLI_TARGET) $(SLIMBER_CLI_OBJECTS) $(LDFLAGS) $(SLIMBER_TARGET) $(SWIFTEN_TARGET) $(LIBS)
 
-TARGETS += $(SLIMBER_CLI_TARGET)
+#TARGETS += $(SLIMBER_CLI_TARGET)
 SLIMBER_TARGETS += $(SLIMBER_CLI_TARGET)
 CLEANFILES += \
-	$(SLIMBER_CLI_OBJECTS) \
 	$(SLIMBER_CLI_TARGET)
 DEPS += \
 	$(SLIMBER_CLI_SOURCES:.cpp=.dep) \
diff --git a/Slimber/Cocoa/Makefile.inc b/Slimber/Cocoa/Makefile.inc
index 73b0f5d..28495f7 100644
--- a/Slimber/Cocoa/Makefile.inc
+++ b/Slimber/Cocoa/Makefile.inc
@@ -25,7 +25,6 @@ SLIMBER_COCOA_OBJECTS = \
 	$(patsubst %.m,%.o,$(patsubst %.mm,%.o,$(patsubst %.cpp,%.o, $(SLIMBER_COCOA_SOURCES))))
 CLEANFILES += \
 	Slimber/Cocoa/PkgInfo \
-	$(SLIMBER_COCOA_OBJECTS) \
 	$(SLIMBER_COCOA_NIBS) \
 	$(SLIMBER_COCOA_TARGET) \
 	$(SLIMBER_COCOA_BINARY)
diff --git a/Slimber/Makefile.inc b/Slimber/Makefile.inc
index 539646c..fea164f 100644
--- a/Slimber/Makefile.inc
+++ b/Slimber/Makefile.inc
@@ -6,9 +6,6 @@ SLIMBER_SOURCES = \
 SLIMBER_OBJECTS = \
 	$(SLIMBER_SOURCES:.cpp=.o)
 
-CLEANFILES += \
-	$(SLIMBER_OBJECTS) \
-	$(SLIMBER_TARGET)
 DEPS += \
 	$(SLIMBER_SOURCES:.cpp=.dep) \
 
diff --git a/Swift/Controllers/Makefile.inc b/Swift/Controllers/Makefile.inc
index 4c69e34..b145c54 100644
--- a/Swift/Controllers/Makefile.inc
+++ b/Swift/Controllers/Makefile.inc
@@ -18,7 +18,6 @@ SWIFT_CONTROLLERS_OBJECTS = \
 
 TARGETS += $(SWIFT_CONTROLLERS_TARGET)
 UNITTEST_LIBS += $(SWIFT_CONTROLLERS_TARGET)
-CLEANFILES += $(SWIFT_CONTROLLERS_TARGET) $(SWIFT_CONTROLLERS_OBJECTS)
 DEPS += $(SWIFT_CONTROLLERS_SOURCES:.cpp=.dep)
 
 $(SWIFT_CONTROLLERS_TARGET): $(SWIFT_CONTROLLERS_OBJECTS)
diff --git a/Swiften/Examples/EchoBot/Makefile.inc b/Swiften/Examples/EchoBot/Makefile.inc
index 09c63d5..beab023 100644
--- a/Swiften/Examples/EchoBot/Makefile.inc
+++ b/Swiften/Examples/EchoBot/Makefile.inc
@@ -4,7 +4,7 @@ ECHOBOT_SOURCES += \
 ECHOBOT_OBJECTS = \
 	$(ECHOBOT_SOURCES:.cpp=.o)
 
-CLEANFILES += $(ECHOBOT_OBJECTS) $(ECHOBOT_TARGET)
+CLEANFILES += $(ECHOBOT_TARGET)
 DEPS += $(ECHOBOT_SOURCES:.cpp=.dep)
 EXAMPLES_TARGETS += $(ECHOBOT_TARGET)
 
diff --git a/Swiften/LinkLocal/Makefile.inc b/Swiften/LinkLocal/Makefile.inc
index 093ac70..902fa7a 100644
--- a/Swiften/LinkLocal/Makefile.inc
+++ b/Swiften/LinkLocal/Makefile.inc
@@ -1,9 +1,7 @@
 SWIFTEN_SOURCES += \
-	Swiften/LinkLocal/BonjourQuery.cpp \
 	Swiften/LinkLocal/DNSSDBrowseQuery.cpp \
 	Swiften/LinkLocal/DNSSDPublishQuery.cpp \
 	Swiften/LinkLocal/DNSSDServiceFactory.cpp \
-	Swiften/LinkLocal/BonjourQuerier.cpp \
 	Swiften/LinkLocal/PlatformDNSSDServiceFactory.cpp \
 	Swiften/LinkLocal/DNSSDService.cpp \
 	Swiften/LinkLocal/LinkLocalRoster.cpp \
@@ -16,6 +14,8 @@ SWIFTEN_SOURCES += \
 
 ifeq ($(HAVE_BONJOUR),yes)
 SWIFTEN_SOURCES += \
+	Swiften/LinkLocal/BonjourQuery.cpp \
+	Swiften/LinkLocal/BonjourQuerier.cpp \
 	Swiften/LinkLocal/AppleDNSSDService.cpp
 endif
 ifeq ($(HAVE_AVAHI),yes)
diff --git a/Swiften/Makefile.inc b/Swiften/Makefile.inc
index 57ff329..d7c3340 100644
--- a/Swiften/Makefile.inc
+++ b/Swiften/Makefile.inc
@@ -41,7 +41,6 @@ SWIFTEN_HEADERS += \
 TARGETS += $(SWIFTEN_TARGET)
 INSTALL_TARGETS += install-swiften
 UNITTEST_LIBS += $(SWIFTEN_TARGET)
-CLEANFILES += $(SWIFTEN_TARGET) $(SWIFTEN_OBJECTS)
 DEPS += \
 	$(SWIFTEN_SOURCES:.cpp=.dep) 
 //TODO: Add objective stuff
diff --git a/Swiften/QA/ClientTest/Makefile.inc b/Swiften/QA/ClientTest/Makefile.inc
index 16a87cf..b9ab167 100644
--- a/Swiften/QA/ClientTest/Makefile.inc
+++ b/Swiften/QA/ClientTest/Makefile.inc
@@ -6,7 +6,7 @@ CLIENTTEST_OBJECTS = \
 
 TEST_TARGETS += ClientTest
 
-CLEANFILES += $(CLIENTTEST_OBJECTS) $(CLIENTTEST_TARGET)
+CLEANFILES += $(CLIENTTEST_TARGET)
 DEPS += $(CLIENTTEST_SOURCES:.cpp=.dep)
 
 $(CLIENTTEST_TARGET): $(SWIFTEN_TARGET) $(CLIENTTEST_OBJECTS) $(BUNDLED_LIBS)
diff --git a/Swiften/QA/NetworkTest/Makefile.inc b/Swiften/QA/NetworkTest/Makefile.inc
index 5ac14c0..b263cdb 100644
--- a/Swiften/QA/NetworkTest/Makefile.inc
+++ b/Swiften/QA/NetworkTest/Makefile.inc
@@ -8,7 +8,7 @@ NETWORKTEST_OBJECTS = \
 
 TEST_TARGETS += NetworkTest
 
-CLEANFILES += $(NETWORKTEST_OBJECTS) $(NETWORKTEST_TARGET)
+CLEANFILES += $(NETWORKTEST_TARGET)
 DEPS += $(NETWORKTEST_SOURCES:.cpp=.dep)
 
 $(NETWORKTEST_TARGET): $(SWIFTEN_TARGET) $(CPPUNIT_TARGET) $(NETWORKTEST_OBJECTS) $(BUNDLED_LIBS)
diff --git a/tools/coverage/FilterLCovData.py b/tools/coverage/FilterLCovData.py
index 8b8d24e..b1dd74e 100755
--- a/tools/coverage/FilterLCovData.py
+++ b/tools/coverage/FilterLCovData.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-import sys, re
+import sys, re, os.path
 
 assert(len(sys.argv) == 2)
 
@@ -15,8 +15,9 @@ for line in inputFile.readlines() :
     if line.startswith("SF:") and (line.find("/Swiften/") == -1 or line.find("/UnitTest/") != -1 or line.find("/QA/") != -1 or line.find("/3rdParty/") != -1):
       inIgnoredFile = True
     else :
-      if line.startswith("SF:") :
-        line = line.replace("/./Swiften/", "/Swiften/")
+      m = re.match("SF:(.*)", line)
+      if m :
+        line = "SF:" + os.path.realpath(m.group(1)) + "\n"
       output.append(line)
 inputFile.close()
 
-- 
cgit v0.10.2-6-g49f6