From e640eda771e0f437837db5da9beac4fbd3934437 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Fri, 6 Dec 2013 20:22:55 +1100 Subject: [PATCH] Moved client scenes to a sub directory, reworked build process --- client/makefile | 12 ++++---- client/{ => scenes}/base_scene.cpp | 0 client/{ => scenes}/base_scene.hpp | 0 client/{ => scenes}/in_combat.cpp | 0 client/{ => scenes}/in_combat.hpp | 0 client/{ => scenes}/in_world.cpp | 0 client/{ => scenes}/in_world.hpp | 0 client/{ => scenes}/lobby_menu.cpp | 0 client/{ => scenes}/lobby_menu.hpp | 0 client/{ => scenes}/main_menu.cpp | 0 client/{ => scenes}/main_menu.hpp | 0 client/scenes/makefile | 43 +++++++++++++++++++++++++++ client/{ => scenes}/options_menu.cpp | 0 client/{ => scenes}/options_menu.hpp | 0 client/{ => scenes}/splash_screen.cpp | 0 client/{ => scenes}/splash_screen.hpp | 0 common/graphics/makefile | 9 +++--- common/makefile | 7 +++-- common/map/makefile | 9 +++--- common/network/makefile | 9 +++--- common/ui/makefile | 9 +++--- editor/makefile | 11 ++++--- server/makefile | 11 ++++--- 23 files changed, 79 insertions(+), 41 deletions(-) rename client/{ => scenes}/base_scene.cpp (100%) rename client/{ => scenes}/base_scene.hpp (100%) rename client/{ => scenes}/in_combat.cpp (100%) rename client/{ => scenes}/in_combat.hpp (100%) rename client/{ => scenes}/in_world.cpp (100%) rename client/{ => scenes}/in_world.hpp (100%) rename client/{ => scenes}/lobby_menu.cpp (100%) rename client/{ => scenes}/lobby_menu.hpp (100%) rename client/{ => scenes}/main_menu.cpp (100%) rename client/{ => scenes}/main_menu.hpp (100%) create mode 100644 client/scenes/makefile rename client/{ => scenes}/options_menu.cpp (100%) rename client/{ => scenes}/options_menu.hpp (100%) rename client/{ => scenes}/splash_screen.cpp (100%) rename client/{ => scenes}/splash_screen.hpp (100%) diff --git a/client/makefile b/client/makefile index 3fcc40e..56a4184 100644 --- a/client/makefile +++ b/client/makefile @@ -1,9 +1,8 @@ #config -COMMONDIR+=../common ../common/graphics ../common/map ../common/network ../common/ui -COMMON+=../libcommon.a -LIB+=$(COMMON) -lSDL_net -lwsock32 -liphlpapi -lmingw32 -lSDLmain -lSDL -CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(COMMONDIR)) -CFLAGS+=-DDEBUG $(addprefix -I,$(COMMONDIR)) +INCLUDES+=. scenes ../common ../common/graphics ../common/map ../common/network ../common/ui +LIBS+=libclient.a ../libcommon.a -lSDL_net -lwsock32 -liphlpapi -lmingw32 -lSDLmain -lSDL -llua -lsqlite3 +CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(INCLUDES)) +CFLAGS+=-DDEBUG $(addprefix -I,$(INCLUDES)) #source CXXSRC=$(wildcard *.cpp) @@ -20,7 +19,8 @@ OUT=$(addprefix $(OUTDIR)/,client) #targets all: $(OBJ) $(OUT) - $(CXX) $(CXXFLAGS) -o $(OUT) $(OBJ) $(LIB) + $(MAKE) -C scenes + $(CXX) $(CXXFLAGS) -o $(OUT) $(OBJ) $(LIBS) $(OBJ): | $(OBJDIR) diff --git a/client/base_scene.cpp b/client/scenes/base_scene.cpp similarity index 100% rename from client/base_scene.cpp rename to client/scenes/base_scene.cpp diff --git a/client/base_scene.hpp b/client/scenes/base_scene.hpp similarity index 100% rename from client/base_scene.hpp rename to client/scenes/base_scene.hpp diff --git a/client/in_combat.cpp b/client/scenes/in_combat.cpp similarity index 100% rename from client/in_combat.cpp rename to client/scenes/in_combat.cpp diff --git a/client/in_combat.hpp b/client/scenes/in_combat.hpp similarity index 100% rename from client/in_combat.hpp rename to client/scenes/in_combat.hpp diff --git a/client/in_world.cpp b/client/scenes/in_world.cpp similarity index 100% rename from client/in_world.cpp rename to client/scenes/in_world.cpp diff --git a/client/in_world.hpp b/client/scenes/in_world.hpp similarity index 100% rename from client/in_world.hpp rename to client/scenes/in_world.hpp diff --git a/client/lobby_menu.cpp b/client/scenes/lobby_menu.cpp similarity index 100% rename from client/lobby_menu.cpp rename to client/scenes/lobby_menu.cpp diff --git a/client/lobby_menu.hpp b/client/scenes/lobby_menu.hpp similarity index 100% rename from client/lobby_menu.hpp rename to client/scenes/lobby_menu.hpp diff --git a/client/main_menu.cpp b/client/scenes/main_menu.cpp similarity index 100% rename from client/main_menu.cpp rename to client/scenes/main_menu.cpp diff --git a/client/main_menu.hpp b/client/scenes/main_menu.hpp similarity index 100% rename from client/main_menu.hpp rename to client/scenes/main_menu.hpp diff --git a/client/scenes/makefile b/client/scenes/makefile new file mode 100644 index 0000000..c0c815b --- /dev/null +++ b/client/scenes/makefile @@ -0,0 +1,43 @@ +#config +INCLUDES+=. .. ../../common ../../common/graphics ../../common/map ../../common/network ../../common/ui +LIBS+= +CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(INCLUDES)) +CFLAGS+=-DDEBUG $(addprefix -I,$(INCLUDES)) + +#source +CXXSRC=$(wildcard *.cpp) +CSRC=$(wildcard *.c) + +#objects +OBJDIR=obj +OBJ+=$(addprefix $(OBJDIR)/,$(CXXSRC:.cpp=.o)) +OBJ+=$(addprefix $(OBJDIR)/,$(CSRC:.c=.o)) + +#output +OUTDIR=.. +OUT=$(addprefix $(OUTDIR)/,libclient.a) + +#targets +all: $(OBJ) $(OUT) + ar -crs $(OUT) $(OBJ) + +$(OBJ): | $(OBJDIR) + +$(OUT): | $(OUTDIR) + +$(OBJDIR): + mkdir $(OBJDIR) + +$(OUTDIR): + mkdir $(OUTDIR) + +$(OBJDIR)/%.o: %.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +$(OBJDIR)/%.o: %.c + $(CC) $(CFLAGS) -c -o $@ $< + +clean: + $(RM) *.o *.a *.exe + +rebuild: clean all diff --git a/client/options_menu.cpp b/client/scenes/options_menu.cpp similarity index 100% rename from client/options_menu.cpp rename to client/scenes/options_menu.cpp diff --git a/client/options_menu.hpp b/client/scenes/options_menu.hpp similarity index 100% rename from client/options_menu.hpp rename to client/scenes/options_menu.hpp diff --git a/client/splash_screen.cpp b/client/scenes/splash_screen.cpp similarity index 100% rename from client/splash_screen.cpp rename to client/scenes/splash_screen.cpp diff --git a/client/splash_screen.hpp b/client/scenes/splash_screen.hpp similarity index 100% rename from client/splash_screen.hpp rename to client/scenes/splash_screen.hpp diff --git a/common/graphics/makefile b/common/graphics/makefile index 85c3910..fb50dee 100644 --- a/common/graphics/makefile +++ b/common/graphics/makefile @@ -1,9 +1,8 @@ #config -COMMONDIR+=.. -COMMON+=../../libcommon.a -LIB+= -CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(COMMONDIR)) -CFLAGS+=-DDEBUG $(addprefix -I,$(COMMONDIR)) +INCLUDES+=. .. +LIBS+= +CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(INCLUDES)) +CFLAGS+=-DDEBUG $(addprefix -I,$(INCLUDES)) #source CXXSRC=$(wildcard *.cpp) diff --git a/common/makefile b/common/makefile index 3cc5ece..c1e25c2 100644 --- a/common/makefile +++ b/common/makefile @@ -1,7 +1,8 @@ #config -LIB+= -CXXFLAGS+=-std=c++11 -DDEBUG -CFLAGS+=-DDEBUG +INCLUDES+=. +LIBS+= +CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(INCLUDES)) +CFLAGS+=-DDEBUG $(addprefix -I,$(INCLUDES)) #source CXXSRC=$(wildcard *.cpp) diff --git a/common/map/makefile b/common/map/makefile index 1dd5910..c2cdfb3 100644 --- a/common/map/makefile +++ b/common/map/makefile @@ -1,9 +1,8 @@ #config -COMMONDIR+=.. ../graphics -COMMON+=../../libcommon.a -LIB+= -CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(COMMONDIR)) -CFLAGS+=-DDEBUG $(addprefix -I,$(COMMONDIR)) +INCLUDES+=. .. ../graphics +LIBS+= +CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(INCLUDES)) +CFLAGS+=-DDEBUG $(addprefix -I,$(INCLUDES)) #source CXXSRC=$(wildcard *.cpp) diff --git a/common/network/makefile b/common/network/makefile index 85c3910..fb50dee 100644 --- a/common/network/makefile +++ b/common/network/makefile @@ -1,9 +1,8 @@ #config -COMMONDIR+=.. -COMMON+=../../libcommon.a -LIB+= -CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(COMMONDIR)) -CFLAGS+=-DDEBUG $(addprefix -I,$(COMMONDIR)) +INCLUDES+=. .. +LIBS+= +CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(INCLUDES)) +CFLAGS+=-DDEBUG $(addprefix -I,$(INCLUDES)) #source CXXSRC=$(wildcard *.cpp) diff --git a/common/ui/makefile b/common/ui/makefile index 1dd5910..c2cdfb3 100644 --- a/common/ui/makefile +++ b/common/ui/makefile @@ -1,9 +1,8 @@ #config -COMMONDIR+=.. ../graphics -COMMON+=../../libcommon.a -LIB+= -CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(COMMONDIR)) -CFLAGS+=-DDEBUG $(addprefix -I,$(COMMONDIR)) +INCLUDES+=. .. ../graphics +LIBS+= +CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(INCLUDES)) +CFLAGS+=-DDEBUG $(addprefix -I,$(INCLUDES)) #source CXXSRC=$(wildcard *.cpp) diff --git a/editor/makefile b/editor/makefile index e10bbe5..7343b2e 100644 --- a/editor/makefile +++ b/editor/makefile @@ -1,9 +1,8 @@ #config -COMMONDIR+=../common ../common/graphics ../common/map ../common/network ../common/ui -COMMON+=../libcommon.a -LIB+=$(COMMON) -lmingw32 -lSDLmain -lSDL -llua -lsqlite3 -CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(COMMONDIR)) -CFLAGS+=-DDEBUG $(addprefix -I,$(COMMONDIR)) +INCLUDES+=../common ../common/graphics ../common/map ../common/ui +LIBS+=../libcommon.a -lmingw32 -lSDLmain -lSDL +CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(INCLUDES)) +CFLAGS+=-DDEBUG $(addprefix -I,$(INCLUDES)) #source CXXSRC=$(wildcard *.cpp) @@ -20,7 +19,7 @@ OUT=$(addprefix $(OUTDIR)/,editor) #targets all: $(OBJ) $(OUT) - $(CXX) $(CXXFLAGS) -o $(OUT) $(OBJ) $(LIB) + $(CXX) $(CXXFLAGS) -o $(OUT) $(OBJ) $(LIBS) $(OBJ): | $(OBJDIR) diff --git a/server/makefile b/server/makefile index 809547d..6af6c60 100644 --- a/server/makefile +++ b/server/makefile @@ -1,9 +1,8 @@ #config -COMMONDIR+=../common ../common/map ../common/network -COMMON+=../libcommon.a -LIB+=$(COMMON) -lSDL_net -lwsock32 -liphlpapi -lmingw32 -lSDLmain -lSDL -llua -lsqlite3 -CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(COMMONDIR)) -CFLAGS+=-DDEBUG $(addprefix -I,$(COMMONDIR)) +INCLUDES+=. ../common ../common/map ../common/network +LIBS+=../libcommon.a -lSDL_net -lwsock32 -liphlpapi -lmingw32 -lSDLmain -lSDL -llua -lsqlite3 +CXXFLAGS+=-std=c++11 -DDEBUG $(addprefix -I,$(INCLUDES)) +CFLAGS+=-DDEBUG $(addprefix -I,$(INCLUDES)) #source CXXSRC=$(wildcard *.cpp) @@ -20,7 +19,7 @@ OUT=$(addprefix $(OUTDIR)/,server) #targets all: $(OBJ) $(OUT) - $(CXX) $(CXXFLAGS) -o $(OUT) $(OBJ) $(LIB) + $(CXX) $(CXXFLAGS) -o $(OUT) $(OBJ) $(LIBS) $(OBJ): | $(OBJDIR)