CCC = g++ -pipe @OPT@ CPPFLAGS = -ffast-math -D_REENTRANT -Wall -Wno-long-long @CPPFLAGS@ LIBS = @LIBS@ LDFLAGS = @LDFLAGS@ ########################################################## PLATFORM = $(shell uname) ifeq ($(findstring Linux,$(PLATFORM)), Linux) LIBS += -ldl endif ifeq ($(findstring SunOS,$(PLATFORM)), SunOS) LIBS += -lsocket -lnsl -ldl -lrt endif ifeq ($(findstring FreeBSD,$(PLATFORM)), FreeBSD) MAKE = gmake endif ifeq ($(findstring NetBSD,$(PLATFORM)), NetBSD) MAKE = gmake OS_TYPE = -D__NetBSD__ endif ifeq ($(findstring OpenBSD,$(PLATFORM)), OpenBSD) MAKE = gmake OS_TYPE = -D__OpenBSD__ endif ifeq ($(findstring CYGWIN,$(PLATFORM)), CYGWIN) OS_TYPE = -DCYGWIN endif ifeq ($(findstring MINGW32,$(PLATFORM)), MINGW32) LIBS += -lws2_32 endif ########################################################## # set some path variables for convenience RETURN_PATH = ../.. BASICS_PATH = src/basics COMMON_PATH = src/common ########################################################## CPPFLAGS += -I$(RETURN_PATH)/$(COMMON_PATH) -I$(RETURN_PATH)/$(BASICS_PATH) $(OS_TYPE) ########################################################## ifeq ($(findstring -DWITH_MYSQL,$(CPPFLAGS)), -DWITH_MYSQL) # my defaults for mysql libs MYSQL_INCLUDE = -I../../../mysql/include/ MYSQL_LIB = -L../../../mysql/lib -lmysqlclient -lposix4 -lcrypt -lgen -lnsl -lm MYSQL_CONFIG = $(shell which mysql_config) ifeq ($(findstring /mysql_config,$(MYSQL_CONFIG)), /mysql_config) MYSQL_VERSION = $(shell $(MYSQL_CONFIG) --version | sed s:\\..*::) MYSQL_CONFIG_ARGUMENT = --cflags ifeq ($(findstring 5,$(MYSQL_VERSION)), 5) MYSQL_CONFIG_ARGUMENT = --include endif MYSQL_INCLUDE = $(shell $(MYSQL_CONFIG) $(MYSQL_CONFIG_ARGUMENT)) MYSQL_LIB = $(shell $(MYSQL_CONFIG) --libs) endif endif MKDEF = CCC="$(CCC)" CPPFLAGS="$(CPPFLAGS) $(MYSQL_INCLUDE)" LIBS="$(MYSQL_LIB) $(LDFLAGS) $(LIBS)" RETURN_PATH="$(RETURN_PATH)" BASICS_PATH="$(BASICS_PATH)" COMMON_PATH="$(COMMON_PATH)" all: conf basics common login char map ladmin scriptchk scriptconv .PHONY : txt txt: @echo "there is no target 'txt'" @echo "run './configure --enable-txt [other options]' to activate txt support" .PHONY : sql sql: @echo "there is no target 'sql'" @echo "run './configure --enable-sql [other options]' to activate sql support" .PHONY : options options: @echo "@MESSAGE@" .PHONY : help help: options @echo "possible targets are 'login' 'char' 'map' 'ladmin' 'scriptchk' 'scriptconv' 'help' 'all' 'clean' 'confclean'" @echo "'login' - login server" @echo "'char' - char server" @echo "'map' - map server" @echo "'ladmin' - remote administration tool" @echo "'scriptchk' - script checker (new ea script syntax)" @echo "'scriptconv' - script converter (old ea syntax and aegis syntax," @echo " can also be used for syntax check of those scripts" @echo "'help' - outputs this message" @echo "'option' - displays the current configure options" @echo "'all' - builds all above targets" @echo "'clean' - cleans builds and objects" @echo "'confclean' - same as clean and additionally cleans previous configuration" conf: cp -r conf-tmpl conf rm -rf conf/.svn conf/*/.svn cp -r save-tmpl save rm -rf save/.svn save/*/.svn .PHONY : basics basics: options cd $(BASICS_PATH) ; $(MAKE) $(MKDEF) ; cd $(RETURN_PATH) .PHONY : common common: options basics cd $(COMMON_PATH) ; $(MAKE) $(MKDEF) ; cd $(RETURN_PATH) login: options basics common cd src/login ; $(MAKE) $(MKDEF) ; cd $(RETURN_PATH) char: options basics common cd src/char ; $(MAKE) $(MKDEF) ; cd $(RETURN_PATH) map: options basics common cd src/map ; $(MAKE) $(MKDEF) ; cd $(RETURN_PATH) ladmin: options basics common cd src/ladmin ; $(MAKE) $(MKDEF) ; cd $(RETURN_PATH) scriptchk: options basics cd src/scriptchk ; $(MAKE) $(MKDEF) ; cd $(RETURN_PATH) scriptconv: options basics cd src/scriptconv ; $(MAKE) $(MKDEF) ; cd $(RETURN_PATH) clean: cd src/basics ; $(MAKE) $(MKDEF) $@ ; cd $(RETURN_PATH) cd src/common ; $(MAKE) $(MKDEF) $@ ; cd $(RETURN_PATH) cd src/login ; $(MAKE) $(MKDEF) $@ ; cd $(RETURN_PATH) cd src/char ; $(MAKE) $(MKDEF) $@ ; cd $(RETURN_PATH) cd src/map ; $(MAKE) $(MKDEF) $@ ; cd $(RETURN_PATH) cd src/ladmin ; $(MAKE) $(MKDEF) $@ ; cd $(RETURN_PATH) cd src/scriptchk ; $(MAKE) $(MKDEF) $@ ; cd $(RETURN_PATH) cd src/scriptconv ; $(MAKE) $(MKDEF) $@ ; cd $(RETURN_PATH) confclean: clean rm -f config.log config.cache config.status Makefile cp Makefile.default Makefile