summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-11-06 14:58:40 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-11-06 14:58:40 +0000
commit5c4a140a2673daa366696d03de0eefd7c69e8d1f (patch)
treecf5714dbdd86df7ddaec8c86511f8e407d3f1902
parent79a10fe36b89f68f5d34263ebd7bd4ba46038184 (diff)
downloadcrawl-ref-5c4a140a2673daa366696d03de0eefd7c69e8d1f.tar.gz
crawl-ref-5c4a140a2673daa366696d03de0eefd7c69e8d1f.zip
Added a package-source target to generate source tarball and zip suitable for release from a clean svn tree. package-source is defined only in makefile.lnx; tested on Linux and Mac OS X.
The source packages will include mapdefs.ixx and the level compiler intermediates so that users without lex/yacc can still build Crawl. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup@344 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/makefile5
-rw-r--r--crawl-ref/source/makefile.lnx58
-rw-r--r--crawl-ref/source/misc/src-pkg-excludes.lst3
3 files changed, 60 insertions, 6 deletions
diff --git a/crawl-ref/source/makefile b/crawl-ref/source/makefile
index 9dc90ac5ad..a4ebcf8870 100644
--- a/crawl-ref/source/makefile
+++ b/crawl-ref/source/makefile
@@ -39,6 +39,11 @@ wizard:
debug:
$(MAKE) $(OTHER) -f $(MAKEFILE) DEBUG_CRAWL=y debug EXTRA_FLAGS='-g -DFULLDEBUG -DWIZARD'
+# [dshaligram] The individual makefile need not necessarily support
+# package-source; only makefile.lnx does at the moment.
+package-source:
+ $(MAKE) -f $(MAKEFILE) package-source
+
# DO NOT DELETE THIS LINE -- $(MAKE) depend depends on it.
diff --git a/crawl-ref/source/makefile.lnx b/crawl-ref/source/makefile.lnx
index b8d277f5ec..383d4232c9 100644
--- a/crawl-ref/source/makefile.lnx
+++ b/crawl-ref/source/makefile.lnx
@@ -52,6 +52,17 @@ DOYACC :=
endif
GAME_DEPENDS := compile-levels $(OBJECTS)
+SRC_PKG_BASE := stone_soup
+SRC_VERSION := $(shell egrep 'VERSION ".*"' version.h | \
+ egrep -o '[0-9]\.[0-9](\.[0-9])?')
+PKG_SRC_DIR := $(SRC_PKG_BASE)-$(SRC_VERSION)-src
+SRC_PKG_TAR := $(PKG_SRC_DIR).tbz2
+SRC_PKG_ZIP := $(PKG_SRC_DIR).zip
+
+LEVCOMP := $(UTIL)levcomp
+
+PKG_TIDY_LIST := $(UTIL)*.o $(LEVCOMP) *.o
+PKG_EXCLUDES := $(PWD)/misc/src-pkg-excludes.lst
##########################################################################
@@ -60,13 +71,13 @@ all: $(GAME)
##########################################################################
# The level compiler
#
-compile-levels: $(UTIL)levcomp mapdefs.ixx
+compile-levels: $(LEVCOMP) mapdefs.ixx
-mapdefs.ixx: dat/vaults.des dat/splev.des $(UTIL)levcomp
- $(UTIL)levcomp $@ < dat/vaults.des
- $(UTIL)levcomp -a $@ < dat/splev.des
+mapdefs.ixx: dat/vaults.des dat/splev.des $(LEVCOMP)
+ $(LEVCOMP) $@ < dat/vaults.des
+ $(LEVCOMP) -a $@ < dat/splev.des
-$(UTIL)levcomp: $(UTIL)levcomp_yacc.o $(UTIL)levcomp_lex.o mapdef.o
+$(LEVCOMP): $(UTIL)levcomp_yacc.o $(UTIL)levcomp_lex.o mapdef.o
$(CXX) -o $@ $^
ifeq ($(DOYACC),y)
@@ -84,6 +95,10 @@ endif
##########################################################################
+##########################################################################
+# The actual build targets
+#
+
install: $(GAME)
$(COPY) $(GAME) ${INSTALLDIR}
chmod ${MCHMOD} ${INSTALLDIR}/$(GAME)
@@ -91,7 +106,7 @@ install: $(GAME)
clean:
$(DELETE) *.o
$(DELETE) $(UTIL)*.o
- $(DELETE) $(UTIL)levcomp
+ $(DELETE) $(LEVCOMP)
distclean:
$(DELETE) *.o
@@ -105,6 +120,7 @@ distclean:
$(DELETE) *.lab
ifeq ($(DOYACC),y)
$(DELETE) $(UTIL)*.cc $(UTIL)*.c $(UTIL)*.h
+ $(DELETE) *.ixx
endif
@@ -132,3 +148,33 @@ $(UTIL)%.o: $(UTIL)%.cc
.h.cc:
touch $@
+
+#############################################################################
+# Packaging a source tarball for release
+#
+
+# To package, you *must* have lex and yacc to generate the intermediates.
+ifeq ($(DOYACC),y)
+package-source: distclean mapdefs.ixx pkgtidy removeold vlink pkgtarbz2 pkgzip
+
+pkgtidy:
+ $(DELETE) $(PKG_TIDY_LIST)
+
+removeold:
+ if [ -f ../../$(SRC_PKG_TAR) ]; then $(DELETE) ../../$(SRC_PKG_TAR); fi
+ if [ -f ../../$(SRC_PKG_ZIP) ]; then $(DELETE) ../../$(SRC_PKG_ZIP); fi
+
+# [ds] Existing directory names could produce a bad package!
+vlink:
+ cd .. && WHERE=$$PWD && cd .. && \
+ ( [ -e $(PKG_SRC_DIR) ] || ln -sf $$WHERE $(PKG_SRC_DIR) )
+
+pkgtarbz2:
+ cd ../.. && tar -ch --bzip2 -f $(SRC_PKG_TAR) \
+ -X $(PKG_EXCLUDES) $(PKG_SRC_DIR)
+
+pkgzip:
+ cd ../.. && zip -rq $(SRC_PKG_ZIP) $(PKG_SRC_DIR) \
+ -x@$(PKG_EXCLUDES)
+
+endif
diff --git a/crawl-ref/source/misc/src-pkg-excludes.lst b/crawl-ref/source/misc/src-pkg-excludes.lst
new file mode 100644
index 0000000000..1d28c6f19f
--- /dev/null
+++ b/crawl-ref/source/misc/src-pkg-excludes.lst
@@ -0,0 +1,3 @@
+,svn
+**/.svn/*
+.*