summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-09-20 12:23:02 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-09-21 10:32:11 -0700
commita3c885e41bc188051f8918f090be998469018bca (patch)
treeccf891b900a52ed8146732f216c2d091996cb0b2
parent91669aba40ce744f2d759c430537c94f23ec9fc2 (diff)
downloadtmwa-a3c885e41bc188051f8918f090be998469018bca.tar.gz
tmwa-a3c885e41bc188051f8918f090be998469018bca.tar.bz2
tmwa-a3c885e41bc188051f8918f090be998469018bca.tar.xz
tmwa-a3c885e41bc188051f8918f090be998469018bca.zip
Use the One Makefile to build them all
This changes the names of the built binaries: login-server -> tmwa-login char-server -> tmwa-char map-server -> tmwa-map ladmin -> tmwa-admin eathena-monitor -> tmwa-monitor It also gets rid of the 'deps.make' file.
-rw-r--r--.gitignore9
-rw-r--r--Makefile.in141
-rw-r--r--real.make263
-rw-r--r--src/admin/GNUmakefile7
-rw-r--r--src/admin/ladmin.cpp (renamed from src/ladmin/ladmin.cpp)0
-rw-r--r--src/admin/ladmin.hpp1
-rw-r--r--src/admin/main.cpp2
-rw-r--r--src/char/GNUmakefile4
-rw-r--r--src/char/main.cpp2
-rw-r--r--src/common/GNUmakefile2
-rw-r--r--src/ladmin/GNUmakefile7
-rw-r--r--src/login/GNUmakefile4
-rw-r--r--src/login/login.hpp1
-rw-r--r--src/login/main.cpp2
-rw-r--r--src/map/GNUmakefile4
-rw-r--r--src/map/magic-interpreter-base.cpp2
-rw-r--r--src/map/magic-interpreter-base.hpp1
-rw-r--r--src/map/magic-interpreter-lexer.hpp1
-rw-r--r--src/map/magic-interpreter-lexer.lpp2
-rw-r--r--src/map/magic-stmt.cpp2
-rw-r--r--src/map/magic-stmt.hpp1
-rw-r--r--src/map/magic.cpp8
-rw-r--r--src/map/main.cpp2
-rw-r--r--src/map/skill-pools.hpp1
-rw-r--r--src/map/skill.hpp1
-rw-r--r--src/monitor/GNUmakefile7
-rw-r--r--src/monitor/main.cpp (renamed from src/tool/eathena-monitor.cpp)0
-rw-r--r--src/tests/test.cpp (renamed from src/tests/main.cpp)0
-rw-r--r--src/tool/GNUmakefile7
29 files changed, 324 insertions, 160 deletions
diff --git a/.gitignore b/.gitignore
index 19569c2..66c6f06 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,17 +1,10 @@
# files generated during make
/obj/
-# Copied executables
-/char-server
-/ladmin
-/login-server
-/map-server
-/eathena-monitor
+/bin/
# Generated source files
/src/map/magic-interpreter-parser.hpp
/src/map/magic-interpreter-parser.cpp
/src/map/magic-interpreter-lexer.cpp
-# generated header dependencies
-/deps.make
# tags file
/tags
# generated by configure
diff --git a/Makefile.in b/Makefile.in
index ada3921..01592ac 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,132 +1,11 @@
-vpath %.ypp ${SRC_DIR}
-vpath %.lpp ${SRC_DIR}
-vpath %.cpp ${SRC_DIR}
-vpath %.hpp ${SRC_DIR}
-
-SHELL=/bin/bash
-BUILD_DIR = obj
-default: login-server char-server map-server ladmin eathena-monitor
-.DELETE_ON_ERROR:
-
-# this used to be in make.defs
-CXXFLAGS += ${WARNINGS}
-ifeq (${ENABLE_WARNINGS},yes)
-WARNINGS = -include ${SRC_DIR}/src/warnings.hpp
+# This file is reverse included. Don't forward in that case.
+ifeq '${MAKEFILE_LIST}' ' Makefile'
+.DEFAULT_GOAL=.default-target-wrapper
+# The documentation for ${MAKECMDGOALS} says "Note that this variable
+# should be used only in special circumstances."
+# If you do not understand *exactly* why I do this instead of
+# %::;${MAKE}, stay away from this code. You have been warned.
+.default-target-wrapper ${MAKECMDGOALS}: .all-target-wrapper
+.all-target-wrapper:
+ ${MAKE} -rRf ${SRC_DIR}/real.make ${MAKECMDGOALS}
endif
-
-# gdb bug 15801
-ifeq (${ENABLE_ABI6},yes)
-CXX += -fabi-version=6
-endif
-ifeq (${ENABLE_CYGWIN_HACKS},yes)
-override CXX += -std=gnu++0x
-else
-override CXX += -std=c++0x
-endif
-# for linking
-override CC = ${CXX}
-
-override CXXFLAGS += -fstack-protector -fno-strict-aliasing
-override CXXFLAGS += -fvisibility=hidden
-# end what used to be in make.defs
-
-.PHONY: all clean common most
-# With no prerequisites, no target should ever be implicitly deleted.
-# With any prerequisites, those targets won't be (no patterns).
-.SECONDARY:
-# This does the same, but only for its prerequisites.
-# Unlike .SECONDARY, these may be patterns as well as normal prerequisites.
-# .PRECIOUS: %/.
-
-%/.:
- +mkdir -p $@
-
-# The default recipe is suboptimal
-%.cpp: %.lpp
- +mkdir -p ${@D}
- $(FLEX) -o $@ $<
-%.cpp %.hpp: %.ypp
- +mkdir -p ${@D}
- $(BISON) -d -o $*.cpp $<
-
-
-# All this duplication is required because make handles pattern rules specially
-${BUILD_DIR}/char/%.o: src/char/%.cpp | ${BUILD_DIR}/char/.
- $(COMPILE.cpp) -o $@ $<
-${BUILD_DIR}/common/%.o: src/common/%.cpp | ${BUILD_DIR}/common/.
- $(COMPILE.cpp) -o $@ $<
-${BUILD_DIR}/ladmin/%.o: src/ladmin/%.cpp | ${BUILD_DIR}/ladmin/.
- $(COMPILE.cpp) -o $@ $<
-${BUILD_DIR}/login/%.o: src/login/%.cpp | ${BUILD_DIR}/login/.
- $(COMPILE.cpp) -o $@ $<
-${BUILD_DIR}/map/%.o: src/map/%.cpp | ${BUILD_DIR}/map/.
- $(COMPILE.cpp) -o $@ $<
-${BUILD_DIR}/tests/%.o: src/tests/%.cpp | ${BUILD_DIR}/tests/.
- $(COMPILE.cpp) -o $@ $<
-${BUILD_DIR}/tool/%.o: src/tool/%.cpp | ${BUILD_DIR}/tool/.
- $(COMPILE.cpp) -o $@ $<
-${BUILD_DIR}/gtest-all.o: ${GTEST_DIR}/src/gtest-all.cc | ${BUILD_DIR}/.
- $(COMPILE.cpp) -I${GTEST_DIR} -DGTEST_HAS_PTHREAD=0 -o $@ $<
-
-
-MOSTPROGS = login-server char-server ladmin eathena-monitor
-PROGS = ${MOSTPROGS} map-server
-# Things to actually make
-all: ${PROGS}
-most: ${MOSTPROGS}
-clean:
- rm -rf ${PROGS} ${BUILD_DIR}/
-common: ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/random.o ${BUILD_DIR}/common/nullpo.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/utils.o ${BUILD_DIR}/common/extract.o ${BUILD_DIR}/common/ip.o
-magic: ${BUILD_DIR}/map/magic-interpreter-lexer.o ${BUILD_DIR}/map/magic-interpreter-parser.o ${BUILD_DIR}/map/magic-expr.o ${BUILD_DIR}/map/magic-interpreter-base.o ${BUILD_DIR}/map/magic-stmt.o ${BUILD_DIR}/map/magic.o
-
-# Top level programs
-login-server: ${BUILD_DIR}/login/login
- cp -f $< $@
-char-server: ${BUILD_DIR}/char/char
- cp -f $< $@
-map-server: ${BUILD_DIR}/map/map
- cp -f $< $@
-ladmin: ${BUILD_DIR}/ladmin/ladmin
- cp -f $< $@
-eathena-monitor: ${BUILD_DIR}/tool/eathena-monitor
- cp -f $< $@
-
-${BUILD_DIR}/tests/main: ${BUILD_DIR}/tests/main.o $(patsubst src/%.cpp,obj/%.o,$(wildcard src/*/*_test.cpp)) ${BUILD_DIR}/gtest-all.o \
- ${BUILD_DIR}/common/extract.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/random.o ${BUILD_DIR}/common/ip.o
-test: ${BUILD_DIR}/tests/main
- ${TESTER} $< ${TEST_ARGS}
-
-# Executable dependencies - generated by hand
-${BUILD_DIR}/char/char: ${BUILD_DIR}/char/char.o ${BUILD_DIR}/char/inter.o ${BUILD_DIR}/char/int_party.o ${BUILD_DIR}/char/int_storage.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/random.o ${BUILD_DIR}/common/utils.o ${BUILD_DIR}/common/extract.o ${BUILD_DIR}/common/ip.o
-${BUILD_DIR}/ladmin/ladmin: ${BUILD_DIR}/ladmin/ladmin.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/extract.o ${BUILD_DIR}/common/random.o ${BUILD_DIR}/common/utils.o ${BUILD_DIR}/common/ip.o
-${BUILD_DIR}/login/login: ${BUILD_DIR}/login/login.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/random.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/utils.o ${BUILD_DIR}/common/extract.o ${BUILD_DIR}/common/ip.o
-${BUILD_DIR}/map/map: ${BUILD_DIR}/map/map.o ${BUILD_DIR}/map/tmw.o ${BUILD_DIR}/map/magic-interpreter-lexer.o ${BUILD_DIR}/map/magic-interpreter-parser.o ${BUILD_DIR}/map/magic-interpreter-base.o ${BUILD_DIR}/map/magic-expr.o ${BUILD_DIR}/map/magic-stmt.o ${BUILD_DIR}/map/magic.o ${BUILD_DIR}/map/map.o ${BUILD_DIR}/map/chrif.o ${BUILD_DIR}/map/clif.o ${BUILD_DIR}/map/pc.o ${BUILD_DIR}/map/npc.o ${BUILD_DIR}/map/path.o ${BUILD_DIR}/map/itemdb.o ${BUILD_DIR}/map/mob.o ${BUILD_DIR}/map/script.o ${BUILD_DIR}/map/storage.o ${BUILD_DIR}/map/skill.o ${BUILD_DIR}/map/skill-pools.o ${BUILD_DIR}/map/atcommand.o ${BUILD_DIR}/map/battle.o ${BUILD_DIR}/map/intif.o ${BUILD_DIR}/map/trade.o ${BUILD_DIR}/map/party.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/map/grfio.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/nullpo.o ${BUILD_DIR}/common/random.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/utils.o ${BUILD_DIR}/common/extract.o ${BUILD_DIR}/common/ip.o
-${BUILD_DIR}/tool/eathena-monitor: ${BUILD_DIR}/tool/eathena-monitor.o ${BUILD_DIR}/common/utils.o
-
-# silence build warnings for code beyond my control
-${BUILD_DIR}/map/magic-interpreter-lexer.o ${BUILD_DIR}/map/magic-interpreter-parser.o ${BUILD_DIR}/gtest-all.o: override WARNINGS=
-# for out-of-tree builds
-${BUILD_DIR}/map/magic-interpreter-lexer.o ${BUILD_DIR}/map/magic-interpreter-parser.o: override CPPFLAGS+=-I${SRC_DIR}/src/map
-
-# deps.make is *NOT* automatically rebuilt normally
-# but the generated source files do need to be done first
-deps.make: src/map/magic-interpreter-parser.cpp src/map/magic-interpreter-lexer.cpp
- ( cd ${SRC_DIR}; for F in `find src/ -name '*.cpp'`; do \
- ${CXX} ${CPPFLAGS} ${CXXFLAGS} -MM "$$F" -MT "$$(sed 's/src/$${BUILD_DIR}/;s/\.cpp/.o/' <<< "$$F")"; \
- done ) > deps.make
- echo '# vim: filetype=make' >> deps.make
-
-include deps.make
-
-install:
- install -d ${BINDIR}
- install --backup=${ENABLE_BACKUPS_DURING_INSTALL} -t ${BINDIR} $(wildcard ${PROGS})
-
-# might need changes later to handle static declarations (solution:
-# run ctags twice, specifying forward patterns for the declarations
-# and backward patterns for the definition)
-tags: $(shell cd ${SRC_DIR}; git ls-files src/ | grep -v GNUmakefile)
- ctags --totals --c-kinds=+px -f $@ $^
-Makefile: ${SRC_DIR}/Makefile.in
- @echo Makefile.in updated, you must rerun configure
- @false
diff --git a/real.make b/real.make
new file mode 100644
index 0000000..86305ac
--- /dev/null
+++ b/real.make
@@ -0,0 +1,263 @@
+## real.make - The One Makefile that builds them all.
+##
+## Copyright © 2012-2013 Ben Longbons <b.r.longbons@gmail.com>
+##
+## This file is part of The Mana World (Athena server)
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# With the One Makefile, you never have to remember to update the list of
+# objects you need to link your programs. It is designed to behave (almost)
+# exactly the way you expect a Makefile to act - which cannot be said of
+# automake, cmake, or qmake.
+#
+# The One Makefile lives under the name 'real.make', because it is
+# reponsible for doing all the actual building, but it is not the file
+# that the user actually calls (using make) directly. The reason for this
+# is that the One Makefile requires a certain environment that it cannot
+# arrange for on its own.
+#
+# Specifically:
+# The -r and -R flags must be passed.
+# A list of variables must be included, but regenerating Makefile from
+# Makefile.in is time-consuming, so real.make actually *includes* the
+# file that called it.
+#
+# For an example of how to do this safely, look at the Makefile.in shipped
+# by TMWA. Of course, you could use any other mechanism to generate a
+# Makefile, as long as it supplies the appropriate list of variables.
+
+
+# TODO:
+# 1. Implement support for static libraries
+# This should be trivial.
+# 2. Implement support for shared libraries
+# This requires building two different .o files and such.
+# 3. Implement support for mixed C and C++ source trees
+# This just requires writing more patsubst in various places
+# At that point, they should *probably* be refactored out into functions.
+# However, it would be hard to allow linking some binaries as pure C.
+# Unless maybe we should use .c.o and .cpp.o ?
+# 4. See if something can be done about all the mkdirs.
+# 5. Remove the few (obvious) bits that are hard-coded for TMWA.
+# 6. Handle testing better. I'm guessing I should actually compile just
+# one foo_test.cpp file into each executable test ...
+#
+# IWBNMI:
+# 1. Add 'make check' and 'make installcheck'.
+# 2. 'make distclean' should remove "anything that ./configure created".
+# 3. 'make dist' should be implemented. Git only or not?
+# 4. 'make install' should install documentation.
+# 5. Split 'make install-exec' and 'make install-data'. Beware etc and var!
+# 6. '--program-prefix' and '--program-suffix' (easy). What about sed?
+# 7. Support DESTDIR during 'make install' (URGENT).
+# 8. 'make distcheck' using the 'make dist' tarball?
+# 9. Add rules for gettext.
+# 10. Support per-target build flags? (requires renaming)
+
+ifeq ($(findstring s,$(firstword ${MAKEFLAGS})),)
+ifeq (${MAKE_RESTARTS},)
+# TODO: should I write this in tengwar?
+# The major problem is that it's usually encoded in the PUA
+# and thus requires a font specification.
+# There *is* a formal request and tentative allocation in the SMP,
+# but it has been languishing for 15 years.
+# TODO: regardless of the preceding, look up the words for 'build' and 'link'.
+# (Does there exist a word that could mean "makefile"?
+# Maybe something like 'instructional scroll')
+
+# Note: the space is necessary
+$(info )
+$(info Welcome to the One Makefile)
+$(info Copyright 2012 Ben Longbons)
+$(info )
+$(info One Makefile to build them all,)
+$(info One Makefile to find them,)
+$(info One Makefile to bring them all)
+$(info and in the darkness link them.)
+$(info )
+else
+$(info The Road goes ever on and on ...)
+endif
+endif
+
+ifeq ($(findstring r, $(firstword ${MAKEFLAGS})),)
+$(error Missing -r - please do not invoke this makefile directly.)
+endif
+
+ifeq ($(findstring R, $(firstword ${MAKEFLAGS})),)
+$(error Missing -R - please do not invoke this makefile directly.)
+endif
+
+ifneq "$(notdir ${MAKEFILE_LIST})" "real.make"
+$(error not used as sole toplevel makefile!)
+endif
+
+include Makefile # for variables - this is handled VERY carefully
+
+# bash is needed for 'set -o pipefail' below - I have had real bugs there!
+# It's just not worth the bother to see if another shell works when it
+# needs to *and* fails when it needs to. Just use bash.
+SHELL=bash
+
+# path lists
+LEXERS := $(shell cd ${SRC_DIR}; find src/ -name '*.lpp')
+PARSERS := $(shell cd ${SRC_DIR}; find src/ -name '*.ypp')
+GEN_SOURCES := \
+ $(patsubst %.lpp,%.cpp,${LEXERS}) \
+ $(patsubst %.ypp,%.cpp,${PARSERS})
+GEN_HEADERS := \
+ $(patsubst %.ypp,%.hpp,${PARSERS})
+REAL_SOURCES := $(shell cd ${SRC_DIR}; find src/ -name '*.cpp')
+REAL_HEADERS := $(shell cd ${SRC_DIR}; find src/ -name '*.hpp')
+SOURCES := ${GEN_SOURCES} ${REAL_SOURCES}
+HEADERS := ${GEN_HEADERS} ${REAL_HEADERS}
+DEPENDS := $(patsubst src/%.cpp,obj/%.d,${SOURCES})
+OBJECTS := $(patsubst %.d,%.o,${DEPENDS})
+GEN_DEPENDS := $(patsubst src/%.cpp,obj/%.d,${GEN_SOURCES})
+GEN_OBJECTS := $(patsubst %.d,%.o,${GEN_DEPENDS})
+MAIN_SOURCES := $(filter %/main.cpp,${SOURCES})
+BINARIES := $(patsubst src/%/main.cpp,bin/tmwa-%,${MAIN_SOURCES})
+
+TEST_DEPENDS := $(patsubst src/%/test.cpp,obj/%/autolist.d,$(filter %/test.cpp,${SOURCES}))
+DEPENDS += ${TEST_DEPENDS}
+TEST_BINARIES := $(patsubst obj/%/autolist.d,bin/test-%,${TEST_DEPENDS})
+
+# tricky part
+
+# We can't put comments in a macro so here goes:
+# 1: Include the contents of the current %.d file ($1).
+# 2: For each header, substitute the corresponding %.o's dependency file.
+# 3: Blank, reserved for header->libtmwa-common.a if that gets implemented.
+# 4: Remove all non-deps - clutter and lonely headers.
+# 5: Prevent infinite loops later by filtering out deps we've already seen.
+# 6: Merge new deps into the existing dep list.
+# 7: Recurse over all new deps (see 5).
+define RECURSIVE_DEPS_IMPL
+$(eval more_deps := $(shell cat $(patsubst %/test.d,%/autolist.d,${1})))
+$(eval more_deps := $(patsubst src/%.hpp,obj/%.d,${more_deps}))
+
+$(eval more_deps := $(filter ${DEPENDS},${more_deps}))
+$(eval more_deps := $(filter-out ${cur_deps},${more_deps}))
+$(eval cur_deps += ${more_deps})
+$(foreach dep,${more_deps},$(call RECURSIVE_DEPS_IMPL,${dep}))
+endef
+
+# 1: Initialize the dep list ($1 is a %.d).
+# 2: Call the real function on it.
+# 3: Blank for clarity.
+# 4: Expand to text. Note that *nothing* else actually produces anything!
+define RECURSIVE_DEPS
+$(eval cur_deps := ${1})
+$(call RECURSIVE_DEPS_IMPL,${1})
+
+${cur_deps}
+endef
+
+# Apply the rules to all the main.cpp files
+$(foreach exe,${BINARIES},$(eval ${exe}: $(strip $(patsubst %.d,%.o,$(call RECURSIVE_DEPS,$(patsubst bin/tmwa-%,obj/%/main.d,${exe}))))))
+$(foreach exe,${TEST_BINARIES},$(eval ${exe}: $(strip $(patsubst %.d,%.o,$(call RECURSIVE_DEPS,$(patsubst bin/test-%,obj/%/test.d,${exe}))))))
+
+# utility functions for the rules
+MKDIR_FIRST = @mkdir -p ${@D}
+
+# Stuff sensitive to attoconf
+CXXFLAGS += ${WARNINGS}
+ifeq (${ENABLE_WARNINGS},yes)
+WARNINGS := -include ${SRC_DIR}/src/warnings.hpp
+endif
+${GEN_DEPENDS} ${GEN_OBJECTS}: override WARNINGS :=
+${GEN_DEPENDS} ${GEN_OBJECTS}: override CPPFLAGS += -I ${SRC_DIR}/$(patsubst obj/%,src/%,${@D})
+
+# related to gdb bug 15801
+ifeq (${ENABLE_ABI6},yes)
+CXXFLAGS += -fabi-version=6
+endif
+ifeq (${ENABLE_CYGWIN_HACKS},yes)
+override CXXFLAGS += -std=gnu++0x
+else
+override CXXFLAGS += -std=c++0x
+endif
+CXXFLAGS += -fstack-protector
+override CXXFLAGS += -fno-strict-aliasing
+override CXXFLAGS += -fvisibility=hidden
+
+# actual rules
+vpath %.ypp ${SRC_DIR}
+vpath %.lpp ${SRC_DIR}
+vpath %.cpp ${SRC_DIR}
+vpath %.hpp ${SRC_DIR}
+
+.DELETE_ON_ERROR:
+.DEFAULT_GOAL := all
+# main goals
+all: ${BINARIES}
+sources: ${GEN_SOURCES} ${GEN_HEADERS}
+mostlyclean:
+ rm -rf obj
+clean: mostlyclean
+ rm -rf bin
+distclean: clean
+ rm -f ${GEN_SOURCES} ${GEN_HEADERS}
+
+%.cpp: %.lpp
+ $(MKDIR_FIRST)
+ ${FLEX} -o $@ $<
+%.cpp %.hpp: %.ypp
+ $(MKDIR_FIRST)
+ ${BISON} -d -o $*.cpp $<
+obj/%.d: src/%.cpp
+ $(MKDIR_FIRST)
+ set -o pipefail; \
+ ${CXX} ${CPPFLAGS} ${CXXFLAGS} -MM $< \
+ -MT '$@ $(patsubst %.d,%.o,$@)' \
+ | sed -e ':again; s:/[^/ ]*/../:/:; t again' \
+ -e 's: ${SRC_DIR}/: :g' \
+ > $@
+# the above SRC_DIR replacement is not really safe, but it works okayish.
+obj/%.o: src/%.cpp
+ $(MKDIR_FIRST)
+ ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<
+
+obj/%/autolist.d: $(filter-out %/autolist.d,${DEPENDS})
+ echo $@: $(filter %_test.d,$^) > $@
+include ${DEPENDS}
+
+bin/%:
+ $(MKDIR_FIRST)
+ ${CXX} ${LDFLAGS} $^ ${LDLIBS} -o $@
+
+${TEST_BINARIES}: obj/gtest-all.o
+
+# This isn't perfect.
+$(filter %_test.o,${OBJECTS}) obj/gtest-all.o: override CPPFLAGS += -DGTEST_HAS_PTHREAD=0 -I${GTEST_DIR}
+obj/gtest-all.o: override WARNINGS :=
+obj/gtest-all.o: ${GTEST_DIR}/src/gtest-all.cc
+ $(MKDIR_FIRST)
+ ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<
+
+test: $(patsubst bin/%,.run-%,${TEST_BINARIES})
+.run-%: bin/%
+ $<
+
+install:
+ install -d ${BINDIR}
+ install --backup=${ENABLE_BACKUPS_DURING_INSTALL} -t ${BINDIR} \
+ $(wildcard ${BINARIES})
+tags: ${SOURCES} ${HEADERS}
+ ctags --totals --c-kinds=+px -f $@ $^
+
+Makefile: ${SRC_DIR}/Makefile.in
+ @echo Makefile.in updated, you must rerun configure
+ @false
diff --git a/src/admin/GNUmakefile b/src/admin/GNUmakefile
new file mode 100644
index 0000000..a34b76b
--- /dev/null
+++ b/src/admin/GNUmakefile
@@ -0,0 +1,7 @@
+.SUFFIXES:
+bin/tmwa-admin:
+ ${MAKE} -C ../.. bin/tmwa-admin
+clean:
+ rm -r ../../obj/admin/
+%::
+ ${MAKE} -C ../.. obj/admin/$@
diff --git a/src/ladmin/ladmin.cpp b/src/admin/ladmin.cpp
index e0860b2..e0860b2 100644
--- a/src/ladmin/ladmin.cpp
+++ b/src/admin/ladmin.cpp
diff --git a/src/admin/ladmin.hpp b/src/admin/ladmin.hpp
new file mode 100644
index 0000000..8c7e195
--- /dev/null
+++ b/src/admin/ladmin.hpp
@@ -0,0 +1 @@
+// dummy header to make Make dependencies work
diff --git a/src/admin/main.cpp b/src/admin/main.cpp
new file mode 100644
index 0000000..2900720
--- /dev/null
+++ b/src/admin/main.cpp
@@ -0,0 +1,2 @@
+// dummy file to make Make dependencies work
+#include "ladmin.hpp"
diff --git a/src/char/GNUmakefile b/src/char/GNUmakefile
index 0e1aece..48b4c0a 100644
--- a/src/char/GNUmakefile
+++ b/src/char/GNUmakefile
@@ -1,6 +1,6 @@
.SUFFIXES:
-all:
- ${MAKE} -C ../.. char-server
+bin/tmwa-char:
+ ${MAKE} -C ../.. bin/tmwa-char
clean:
rm -r ../../obj/char/
%::
diff --git a/src/char/main.cpp b/src/char/main.cpp
new file mode 100644
index 0000000..9f68e0f
--- /dev/null
+++ b/src/char/main.cpp
@@ -0,0 +1,2 @@
+// dummy file to make Make dependencies work
+#include "char.hpp"
diff --git a/src/common/GNUmakefile b/src/common/GNUmakefile
index d8d841f..917ce0e 100644
--- a/src/common/GNUmakefile
+++ b/src/common/GNUmakefile
@@ -1,5 +1,5 @@
.SUFFIXES:
-all:
+common:
${MAKE} -C ../.. common
clean:
rm -r ../../obj/common/
diff --git a/src/ladmin/GNUmakefile b/src/ladmin/GNUmakefile
deleted file mode 100644
index d44f89d..0000000
--- a/src/ladmin/GNUmakefile
+++ /dev/null
@@ -1,7 +0,0 @@
-.SUFFIXES:
-all:
- ${MAKE} -C ../.. ladmin
-clean:
- rm -r ../../obj/ladmin/
-%::
- ${MAKE} -C ../.. obj/ladmin/$@
diff --git a/src/login/GNUmakefile b/src/login/GNUmakefile
index a87b879..eb983e8 100644
--- a/src/login/GNUmakefile
+++ b/src/login/GNUmakefile
@@ -1,6 +1,6 @@
.SUFFIXES:
-all:
- ${MAKE} -C ../.. login-server
+bin/tmwa-login:
+ ${MAKE} -C ../.. bin/tmwa-login
clean:
rm -r ../../obj/login/
%::
diff --git a/src/login/login.hpp b/src/login/login.hpp
new file mode 100644
index 0000000..8c7e195
--- /dev/null
+++ b/src/login/login.hpp
@@ -0,0 +1 @@
+// dummy header to make Make dependencies work
diff --git a/src/login/main.cpp b/src/login/main.cpp
new file mode 100644
index 0000000..2ef17a0
--- /dev/null
+++ b/src/login/main.cpp
@@ -0,0 +1,2 @@
+// dummy file to make Make dependencies work
+#include "login.hpp"
diff --git a/src/map/GNUmakefile b/src/map/GNUmakefile
index 0945926..22f6daa 100644
--- a/src/map/GNUmakefile
+++ b/src/map/GNUmakefile
@@ -1,6 +1,6 @@
.SUFFIXES:
-all:
- ${MAKE} -C ../.. map-server
+bin/tmwa-map:
+ ${MAKE} -C ../.. bin/tmwa-map
clean:
rm -r ../../obj/map/
%::
diff --git a/src/map/magic-interpreter-base.cpp b/src/map/magic-interpreter-base.cpp
index 1a80617..3167efb 100644
--- a/src/map/magic-interpreter-base.cpp
+++ b/src/map/magic-interpreter-base.cpp
@@ -1,3 +1,5 @@
+#include "magic-interpreter-base.hpp"
+
#include "magic-interpreter-aux.hpp"
#include "magic-interpreter.hpp"
diff --git a/src/map/magic-interpreter-base.hpp b/src/map/magic-interpreter-base.hpp
new file mode 100644
index 0000000..8c7e195
--- /dev/null
+++ b/src/map/magic-interpreter-base.hpp
@@ -0,0 +1 @@
+// dummy header to make Make dependencies work
diff --git a/src/map/magic-interpreter-lexer.hpp b/src/map/magic-interpreter-lexer.hpp
new file mode 100644
index 0000000..8c7e195
--- /dev/null
+++ b/src/map/magic-interpreter-lexer.hpp
@@ -0,0 +1 @@
+// dummy header to make Make dependencies work
diff --git a/src/map/magic-interpreter-lexer.lpp b/src/map/magic-interpreter-lexer.lpp
index a7c25e5..b5a16b2 100644
--- a/src/map/magic-interpreter-lexer.lpp
+++ b/src/map/magic-interpreter-lexer.lpp
@@ -1,4 +1,6 @@
%{
+#include "magic-interpreter-lexer.hpp"
+#
#include "magic-interpreter-parser.hpp"
#include "../common/cxxstdio.hpp"
diff --git a/src/map/magic-stmt.cpp b/src/map/magic-stmt.cpp
index 6b013ab..12fed6e 100644
--- a/src/map/magic-stmt.cpp
+++ b/src/map/magic-stmt.cpp
@@ -1,3 +1,5 @@
+#include "magic-stmt.hpp"
+
#include <cassert>
#include "../common/cxxstdio.hpp"
diff --git a/src/map/magic-stmt.hpp b/src/map/magic-stmt.hpp
new file mode 100644
index 0000000..8c7e195
--- /dev/null
+++ b/src/map/magic-stmt.hpp
@@ -0,0 +1 @@
+// dummy header to make Make dependencies work
diff --git a/src/map/magic.cpp b/src/map/magic.cpp
index 9c07dd1..b6dc806 100644
--- a/src/map/magic.cpp
+++ b/src/map/magic.cpp
@@ -3,8 +3,16 @@
#include "../common/cxxstdio.hpp"
#include "magic-interpreter.hpp"
+
#include "pc.hpp"
+#include "magic-expr.hpp"
+#include "magic-interpreter-base.hpp"
+#include "magic-interpreter-lexer.hpp"
+#include "magic-interpreter-parser.hpp"
+#include "magic-stmt.hpp"
+#include "magic.hpp"
+
#include "../poison.hpp"
#undef DEBUG
diff --git a/src/map/main.cpp b/src/map/main.cpp
new file mode 100644
index 0000000..c930630
--- /dev/null
+++ b/src/map/main.cpp
@@ -0,0 +1,2 @@
+// dummy file to make Make dependencies work
+#include "map.hpp"
diff --git a/src/map/skill-pools.hpp b/src/map/skill-pools.hpp
new file mode 100644
index 0000000..8c7e195
--- /dev/null
+++ b/src/map/skill-pools.hpp
@@ -0,0 +1 @@
+// dummy header to make Make dependencies work
diff --git a/src/map/skill.hpp b/src/map/skill.hpp
index bcd0261..a233ed4 100644
--- a/src/map/skill.hpp
+++ b/src/map/skill.hpp
@@ -2,6 +2,7 @@
#define SKILL_HPP
#include "skill.t.hpp"
+#include "skill-pools.hpp"
#include "../common/strings.hpp"
diff --git a/src/monitor/GNUmakefile b/src/monitor/GNUmakefile
new file mode 100644
index 0000000..42efa8b
--- /dev/null
+++ b/src/monitor/GNUmakefile
@@ -0,0 +1,7 @@
+.SUFFIXES:
+bin/tmwa-monitor:
+ ${MAKE} -C ../.. bin/tmwa-monitor
+clean:
+ rm -r ../../obj/monitor/
+%::
+ ${MAKE} -C ../.. obj/monitor/$@
diff --git a/src/tool/eathena-monitor.cpp b/src/monitor/main.cpp
index f6e8271..f6e8271 100644
--- a/src/tool/eathena-monitor.cpp
+++ b/src/monitor/main.cpp
diff --git a/src/tests/main.cpp b/src/tests/test.cpp
index 96d7200..96d7200 100644
--- a/src/tests/main.cpp
+++ b/src/tests/test.cpp
diff --git a/src/tool/GNUmakefile b/src/tool/GNUmakefile
deleted file mode 100644
index 24ee766..0000000
--- a/src/tool/GNUmakefile
+++ /dev/null
@@ -1,7 +0,0 @@
-.SUFFIXES:
-all:
- ${MAKE} -C ../.. eathena-monitor
-clean:
- rm -r ../../obj/tool/
-%::
- ${MAKE} -C ../.. obj/tool/$@