From 9bd8b2492169d9a1eae263d8acb24b492d9b5f55 Mon Sep 17 00:00:00 2001 From: Dennis Schridde Date: Mon, 23 Jun 2008 13:54:47 +0000 Subject: [PATCH] Boost raw Makefiles - Use PACKAGE, PACKAGE_VERSION, remove VERSION - Allow out-of-source-dir builds (mkdir build && cd build && make -f ../Makefile.raw) - Move config.mk from $(top_srcdir)/makerules/config.mk to $(top_builddir)/config.mk When keeping current behaviour (srcdir=builddir), this means: Move it from makerules into the main directory git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5308 4a71c877-e1ca-e34f-864e-861f7616d084 --- Makefile.raw | 20 +++- build_tools/Makefile.raw | 9 +- build_tools/autorevision/Makefile.raw | 31 ++--- data/Makefile.raw | 40 ++++--- data/mods/Makefile.raw | 9 +- data/mods/global/Makefile.raw | 50 ++++---- lib/Makefile.raw | 18 +-- lib/exceptionhandler/Makefile.raw | 5 +- lib/framework/Makefile.raw | 7 +- lib/gamelib/Makefile.raw | 7 +- lib/ivis_common/Makefile.raw | 5 +- lib/ivis_opengl/Makefile.raw | 5 +- lib/netplay/Makefile.raw | 7 +- lib/script/Makefile.raw | 7 +- lib/sequence/Makefile.raw | 5 +- lib/sound/Makefile.raw | 5 +- lib/sqlite3/Makefile.raw | 5 +- lib/widget/Makefile.raw | 5 +- makerules/common.mk | 20 ++-- makerules/config.mk.tmpl | 48 ++++---- makerules/configure.mk | 159 ++++++++++++++++--------- makerules/exe.mk | 10 +- makerules/lib.mk | 12 +- makerules/submake.mk | 10 ++ pkg/Makefile.raw | 8 +- pkg/nsis/Makefile.raw | 13 +- po/Makefile.raw | 32 ++--- src/Makefile.raw | 31 ++--- tools/lobbyserver_cpp/src/Makefile.raw | 10 +- win32/Makefile.raw | 5 +- 30 files changed, 326 insertions(+), 272 deletions(-) create mode 100644 makerules/submake.mk diff --git a/Makefile.raw b/Makefile.raw index 8fcaefdb6..b266c5be5 100644 --- a/Makefile.raw +++ b/Makefile.raw @@ -1,10 +1,18 @@ SUBDIRS=build_tools po win32 lib src data pkg -all clean: $(SUBDIRS) +# Figure out top source dir: The Makefile.raw will be in it, and it is relative to this directory +build_path:=$(patsubst %/Makefile.raw,%,$(lastword $(MAKEFILE_LIST))) +ifneq ($(strip $(build_path)),Makefile.raw) +export top_srcdir:=$(CURDIR)/$(build_path) +else +export top_srcdir:=$(CURDIR) +endif -.PHONY: $(SUBDIRS) -$(SUBDIRS): - $(MAKE) -f Makefile.raw -C $@ $(MAKECMDGOALS) +# Top build dir is this directory +export top_builddir:=$(CURDIR) -src: win32 lib build_tools -packaging: data src po +include $(top_srcdir)/makerules/configure.mk +include $(top_srcdir)/makerules/submake.mk + +src: build_tools win32 lib +pkg: data src po diff --git a/build_tools/Makefile.raw b/build_tools/Makefile.raw index 67a80c732..d535a0aa6 100644 --- a/build_tools/Makefile.raw +++ b/build_tools/Makefile.raw @@ -1,8 +1,5 @@ +include $(top_srcdir)/makerules/configure.mk + SUBDIRS=autorevision -all clean: $(SUBDIRS) - -$(SUBDIRS): - $(MAKE) -f Makefile.raw -C $@ $(MAKECMDGOALS) - -.PHONY: all clean $(SUBDIRS) +include $(top_srcdir)/makerules/submake.mk diff --git a/build_tools/autorevision/Makefile.raw b/build_tools/autorevision/Makefile.raw index 7aeef88af..8c408bf6b 100644 --- a/build_tools/autorevision/Makefile.raw +++ b/build_tools/autorevision/Makefile.raw @@ -1,26 +1,29 @@ -MAKERULES=../../makerules -include $(MAKERULES)/configure.mk -include $(MAKERULES)/common.mk +include $(top_srcdir)/makerules/configure.mk + +# Hacks to build for compiling system, not for target +CC:=g++ +CXX:=g++ +CPPFLAGS:=$(subst -DWIN32,,$(CPPFLAGS)) +CFLAGS:=$(subst -mwindows,,$(CFLAGS)) +CXXFLAGS:=$(subst -mwindows,,$(CXXFLAGS)) +LDFLAGS:= +EXEEXT= SRC=autorevision.cpp EXE=autorevision -CXX=g++ -DEPS=$(patsubst %.c,%.o, $(SRC:%.cpp=%.o)) $(LIBS) +include $(top_srcdir)/makerules/exe.mk + +.PHONY: all all-local clean clean-local all: all-local -$(EXE)$(EXEEXT): $(DEPS) - $(CXX) -o $@ $< - all-local: $(EXE)$(EXEEXT) - $(EXE)$(EXEEXT) +cstr -v ../.. ../../src/autorevision.h + $(builddir)$(DIRSEP)$(EXE)$(EXEEXT) +cstr -v $(top_srcdir) $(top_builddir)/src/autorevision.h clean-local: - -$(RMF) ../../src/autorevision.h + -$(RM_F) $(top_builddir)/src/autorevision.h -clean: - $(RMF) $(DEPS) $(EXE)$(EXEEXT) - -.PHONY: all all-local clean +clean: clean-local + $(RM_F) $(DEPS) $(EXE)$(EXEEXT) diff --git a/data/Makefile.raw b/data/Makefile.raw index b0428c155..8e53e96e7 100644 --- a/data/Makefile.raw +++ b/data/Makefile.raw @@ -1,35 +1,41 @@ +include $(top_srcdir)/makerules/configure.mk + SUBDIRS=mods -MAKERULES=../makerules -include $(MAKERULES)/configure.mk - -BASELIST = anims audio components effects features tagdefinitions \ - gamedesc.lev images messages misc multiplay novideo.rpl \ - script sequenceaudio stats stats-sql structs texpages wrf -PATCHLIST = addon.lev anims components effects \ +BASELIST=anims audio components effects features tagdefinitions \ + gamedesc.lev images messages misc multiplay music novideo.rpl script \ + sequenceaudio stats stats-sql structs texpages wrf +PATCHLIST=addon.lev anims components effects \ messages multiplay stats structs wrf BASEARCHIVE=base.wz PATCHARCHIVE=mp.wz +CLEANFILES=$(BASEARCHIVE) $(PATCHARCHIVE) + +include $(top_srcdir)/makerules/submake.mk + +.PHONY: all clean $(BASEARCHIVE) $(PATCHARCHIVE) $(SUBDIRS) + all: ifdef DATA all: $(BASEARCHIVE) $(PATCHARCHIVE) $(SUBDIRS) endif -$(SUBDIRS): - $(MAKE) -f Makefile.raw -C $@ $(MAKECMDGOALS) +stamp: + touch stamp -$(BASEARCHIVE): $(BASELIST:%=base/%) - cd base && zip -ru0 $@ $(BASELIST) -x *svn* +$(BASEARCHIVE): $(srcdir)/$(basename $(BASEARCHIVE)) stamp $(patsubst %,$(srcdir)/$(basename $(BASEARCHIVE))/%,$(BASELIST)) + (cd $< && zip -ru0 $(builddir)/$@ $(filter-out stamp,$(filter-out $<,$(^:$