mirror of
https://github.com/scummvm/scummex.git
synced 2026-05-21 05:40:51 +00:00
added a new build rule (stolen from ScummVM) which does proper dependency tracking
This commit is contained in:
@@ -26,5 +26,6 @@ _$*
|
||||
*.ln
|
||||
core
|
||||
# CVS default ignores end
|
||||
.deps
|
||||
.gdb_history
|
||||
scummex
|
||||
|
||||
@@ -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 := -DOSUNIX -g -O -Wall -Wuninitialized -Wshadow -Wstrict-prototypes -W
|
||||
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)
|
||||
|
||||
|
||||
# Default build rule
|
||||
all: scummex
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) ${CXXFLAGS} -c $< -o $@
|
||||
|
||||
# Main executable build rule
|
||||
scummex: ${OBJS}
|
||||
$(CXX) $+ ${LIBS} -o $@
|
||||
|
||||
@@ -22,6 +34,23 @@ mac: scummex
|
||||
$(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
|
||||
|
||||
Reference in New Issue
Block a user