[Scummvm-cvs-logs] CVS: scummex Makefile,1.4,1.5 .cvsignore,1.1,1.2

Max Horn fingolfin at users.sourceforge.net
Fri Sep 19 14:04:02 CEST 2003


Update of /cvsroot/scummvm/scummex
In directory sc8-pr-cvs1:/tmp/cvs-serv16987

Modified Files:
	Makefile .cvsignore 
Log Message:
added a new build rule (stolen from ScummVM) which does proper dependency tracking

Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/scummex/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Makefile	19 Sep 2003 19:57:07 -0000	1.4
+++ Makefile	19 Sep 2003 21:01:26 -0000	1.5
@@ -1,4 +1,14 @@
-CXX      := g++
+CXX     := c++
+AR      := ar cru
+RANLIB  := ranlib
+MKDIR   := mkdir -p
+ECHO    := echo -n
+CAT     := cat
+RM      := rm -f
+RM_REC  := $(RM) -r
+ZIP     := zip -q
+CP      := cp
+
 RESSW    := --define __WIN32__ --define __WIN95__ --define __GNUWIN32__
 REZ_CMD  := `wx-config --rezflags`
 OBJS     := file.o scummex.o resource.o mixer.o image.o sound.o wxwindows.o descumm.o descumm6.o
@@ -6,13 +16,15 @@
 CXXFLAGS += `wx-config --cxxflags` `sdl-config --cflags`
 LIBS     := `wx-config --libs` `sdl-config --libs` -lSDL_mixer
 
-.SUFFIXES: .o .cpp
+# The name for the directory used for depenency tracking
+DEPDIR  := .deps
+DEPDIRS := $(DEPDIR)
 
-all: scummex
 
-.cpp.o: 
-	$(CXX) ${CXXFLAGS} -c $< -o $@
+# Default build rule
+all: scummex
 
+# Main executable build rule
 scummex: ${OBJS}
 	$(CXX) $+ ${LIBS} -o $@
 
@@ -22,6 +34,23 @@
 	$(REZ_CMD) scummex
 
 clean:
-	rm -f scummex file.o scummex.o resource.o mixer.o image.o sound.o wxwindows.o descumm.o descumm6.o
+	rm -f scummex $(OBJS)
 
-.PHONY: all clean mac
+distclean: clean
+	$(RM_REC) $(DEPDIRS)
+
+.PHONY: all clean distclean mac
+.SUFFIXES: .o .cpp
+
+
+# C++ build rule with dependency tracking (requires GCC)
+.cpp.o:
+	$(MKDIR) $(*D)/$(DEPDIR)
+	$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d2" $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
+	$(ECHO) "$(*D)/" > $(*D)/$(DEPDIR)/$(*F).d
+	$(CAT) "$(*D)/$(DEPDIR)/$(*F).d2" >> "$(*D)/$(DEPDIR)/$(*F).d"
+	$(RM) "$(*D)/$(DEPDIR)/$(*F).d2"
+
+# Include the dependency tracking files. We add /dev/null at the end
+# of the list to avoid a warning/error if no .d file exist
+-include $(wildcard $(addsuffix /*.d,$(DEPDIRS))) /dev/null

Index: .cvsignore
===================================================================
RCS file: /cvsroot/scummvm/scummex/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- .cvsignore	18 Sep 2003 19:35:32 -0000	1.1
+++ .cvsignore	19 Sep 2003 21:01:27 -0000	1.2
@@ -1,2 +1,3 @@
+.deps
 .gdb_history
 scummex





More information about the Scummvm-git-logs mailing list