[matroska] r942 - trunk/libmatroska/make/linux

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: mosu
Date: 2004-11-13 14:29:04 +0300 (Sat, 13 Nov 2004)
New Revision: 942

Modified:
   trunk/libmatroska/make/linux/Makefile
Log:
Improved the dependency calculation to be more portable (makedepend doesn't exist everywhere, and it doesn't necessarily use the compiler we want).


Modified: trunk/libmatroska/make/linux/Makefile
===================================================================
--- trunk/libmatroska/make/linux/Makefile	2004-11-13 11:27:12 UTC (rev 941)
+++ trunk/libmatroska/make/linux/Makefile	2004-11-13 11:29:04 UTC (rev 942)
@@ -22,8 +22,6 @@
 # Programs
 CXX=g++
 LD=$(CXX)
-DEP=$(CXX) -MM
-DEPEND = makedepend
 AR = ar rcvu
 RANLIB = ranlib
 INSTALL = install
@@ -61,9 +59,6 @@
 # header files; replace .cxx extension with .h
 headers:=$(patsubst %$(EXTENSION),%.h,$(sources))
 
-# files holding dependency information; replace .cxx extension with .dep
-dependencies:=$(patsubst %$(EXTENSION),%.dep,$(sources))
-
 # object files; replace .cxx extension with .o
 objects:=$(patsubst %$(EXTENSION),%.o,$(sources))
 
@@ -71,7 +66,7 @@
 		-Wshadow
 COMPILEFLAGS=$(DEBUGFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(WARNINGFLAGS) $(INCLUDE)
 LINKFLAGS=-L. -L$(LIBEBML_LIB_DIR) $(LDFLAGS)
-DEPENDFLAGS  = ${CXXFLAGS} ${INCLUDE}
+DEPENDFLAGS  = $(CXXFLAGS) $(INCLUDE)
 
 all: $(LIBRARY)
 
@@ -94,9 +89,15 @@
 cleantest:
 	rm -f test6 test8 test9 test6.o test8.o test9.o
 
-# what are the source dependencies
-depend: $(sources)
-	$(DEPEND) $(DEPENDFLAGS) $(sources)
+depend:
+	@echo Calculating dependecies:
+	@rm -f .depend
+	@touch .depend
+	@for i in $(sources); do \
+		o="`echo $$i | sed -e 's/\.c$$/.o/' -e 's/\.cpp$$/.o/'`" ; \
+		echo '  ' $$i: $$o ; \
+		$(CXX) $(DEPENDFLAGS) -MM -MT $$o $$i >> .depend ; \
+	done
 
 test: test6 test8 test9
 
@@ -130,4 +131,8 @@
 		$(INSTALL) $(INSTALL_OPTS) $$i $(includedir)/c ; \
 	done
 
+ifneq ($(wildcard .depend),)
+include .depend
+endif
+
 # DO NOT DELETE
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.