diff --git a/src/dist/engine/Makefile b/src/dist/engine/Makefile index 2914164f2b..5e696bd951 100644 --- a/src/dist/engine/Makefile +++ b/src/dist/engine/Makefile @@ -22,20 +22,16 @@ ifndef FHEROES2_WITH_SYSTEM_SMACKER CCFLAGS := $(CCFLAGS) -I../../thirdparty/libsmacker endif -SOURCEROOT := ../../engine -SOURCEDIRS := $(SOURCEROOT) -SOURCES := $(wildcard $(SOURCEDIRS)/*.cpp) +SOURCEDIR := ../../engine .PHONY: all clean all: libengine.a -libengine.a: $(notdir $(patsubst %.cpp, %.o, $(SOURCES))) +libengine.a: $(notdir $(patsubst %.cpp, %.o, $(wildcard $(SOURCEDIR)/*.cpp))) $(AR) crvs $@ $^ -VPATH := $(SOURCEDIRS) - -%.o: %.cpp +%.o: $(SOURCEDIR)/%.cpp $(CXX) -c -MD $< $(CCFLAGS) $(CXXFLAGS) $(CPPFLAGS) include $(wildcard *.d) diff --git a/src/dist/fheroes2/Makefile b/src/dist/fheroes2/Makefile index 19082a8302..8e6ce3d151 100644 --- a/src/dist/fheroes2/Makefile +++ b/src/dist/fheroes2/Makefile @@ -18,11 +18,11 @@ # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ########################################################################### -LIBENGINE := ../engine/libengine.a +DEPLIBS := ../engine/libengine.a CCFLAGS := $(CCFLAGS) -I../../engine ifndef FHEROES2_WITH_SYSTEM_SMACKER -LIBENGINE := $(LIBENGINE) ../thirdparty/libsmacker/libsmacker.a +DEPLIBS := $(DEPLIBS) ../thirdparty/libsmacker/libsmacker.a CCFLAGS := $(CCFLAGS) -I../../thirdparty/libsmacker endif @@ -30,23 +30,23 @@ SOURCEROOT := ../../fheroes2 SOURCEDIRS := $(filter %/,$(wildcard $(SOURCEROOT)/*/)) SOURCES := $(wildcard $(SOURCEROOT)/*/*.cpp) +VPATH := $(SOURCEDIRS) + .PHONY: all pot clean all: fheroes2 pot pot: fheroes2.pot -fheroes2: $(notdir $(patsubst %.cpp, %.o, $(SOURCES))) $(LIBENGINE) +fheroes2: $(notdir $(patsubst %.cpp, %.o, $(SOURCES))) $(DEPLIBS) $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) fheroes2.pot: $(SOURCES) xgettext -d fheroes2 -C -F -k_ -k_n:1,2 -o fheroes2.pot $(sort $(SOURCES)) sed -i~ -e 's/, c-format//' fheroes2.pot -VPATH := $(SOURCEDIRS) - %.o: %.cpp - $(CXX) -c -MD $(addprefix -I, $(SOURCEDIRS)) $< $(CCFLAGS) $(CXXFLAGS) $(CPPFLAGS) + $(CXX) -c -MD $< $(addprefix -I, $(SOURCEDIRS)) $(CCFLAGS) $(CXXFLAGS) $(CPPFLAGS) include $(wildcard *.d) diff --git a/src/dist/thirdparty/libsmacker/Makefile b/src/dist/thirdparty/libsmacker/Makefile index 3a5786b254..7ab8f0503a 100644 --- a/src/dist/thirdparty/libsmacker/Makefile +++ b/src/dist/thirdparty/libsmacker/Makefile @@ -18,9 +18,6 @@ # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ########################################################################### -SOURCEROOT := ../../../thirdparty/libsmacker -SOURCEDIRS := $(SOURCEROOT) - .PHONY: all clean all: libsmacker.a @@ -28,9 +25,7 @@ all: libsmacker.a libsmacker.a: smacker.o $(AR) crvs $@ $^ -VPATH := $(SOURCEDIRS) - -smacker.o: smacker.c +smacker.o: ../../../thirdparty/libsmacker/smacker.c $(CC) -c -MD $< $(CCFLAGS) $(CFLAGS) $(CPPFLAGS) include $(wildcard *.d) diff --git a/src/dist/tools/Makefile b/src/dist/tools/Makefile index 403aced02c..1179485f57 100644 --- a/src/dist/tools/Makefile +++ b/src/dist/tools/Makefile @@ -20,23 +20,15 @@ TARGETS := 82m2wav bin2txt extractor h2dmgr icn2img pal2img til2img xmi2midi -LIBENGINE := ../engine/libengine.a -CCFLAGS := $(CCFLAGS) -I../../engine - -SOURCEROOT := ../../tools -SOURCEDIRS := $(SOURCEROOT) - .PHONY: all clean all: $(TARGETS) -$(TARGETS): %: %.o $(LIBENGINE) +$(TARGETS): %: %.o ../engine/libengine.a $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) -VPATH := $(SOURCEDIRS) - -%.o: %.cpp - $(CXX) -c -MD $< $(CCFLAGS) $(CXXFLAGS) $(CPPFLAGS) +%.o: ../../tools/%.cpp + $(CXX) -c -MD $< -I../../engine $(CCFLAGS) $(CXXFLAGS) $(CPPFLAGS) include $(wildcard *.d)