2011-02-16 13:24:56 +00:00
|
|
|
include config.make
|
|
|
|
|
2008-11-17 19:04:27 +00:00
|
|
|
# Build version string, taking into account that 'VER_REV' may not be set
|
2009-09-05 09:40:57 +00:00
|
|
|
VERSION := $(strip $(shell cat src/Cocoa/oolite-version.xcconfig | cut -d '=' -f 2))
|
|
|
|
VER_MAJ := $(shell echo "${VERSION}" | cut -d '.' -f 1)
|
|
|
|
VER_MIN := $(shell echo "${VERSION}" | cut -d '.' -f 2)
|
|
|
|
VER_REV := $(shell echo "${VERSION}" | cut -d '.' -f 3)
|
2008-11-17 19:04:27 +00:00
|
|
|
VER_REV := $(if ${VER_REV},${VER_REV},0)
|
2013-07-06 20:58:29 +02:00
|
|
|
VER_DATE := $(shell date +%y%m%d)
|
2013-09-09 11:00:39 +02:00
|
|
|
# VER_GITREV: Make sure git is in the command path
|
2013-09-09 13:10:38 +02:00
|
|
|
# VER_GITREV is the count of commits since the establishment of the repository on github. Used
|
|
|
|
# as replacement for SVN incremental revision number, since we require the version number to be
|
|
|
|
# of format X.X.X.X.
|
2013-11-12 18:36:58 +01:00
|
|
|
# VER_GITHASH are the first seven digits of the actual hash of the commit being built.
|
2013-09-09 13:10:38 +02:00
|
|
|
VER_GITREV := $(shell git rev-list --count HEAD)
|
2013-11-10 22:55:06 +01:00
|
|
|
VER_GITHASH := $(shell git rev-parse --short=7 HEAD)
|
2013-11-12 18:36:58 +01:00
|
|
|
VER := $(shell echo "${VER_MAJ}.${VER_MIN}.${VER_REV}.${VER_GITREV}-${VER_DATE}-${VER_GITHASH}")
|
2008-11-17 19:04:27 +00:00
|
|
|
BUILDTIME := $(shell date "+%Y.%m.%d %H:%M")
|
2009-09-05 09:40:57 +00:00
|
|
|
DEB_BUILDTIME := $(shell date "+%a, %d %b %Y %H:%M:%S %z")
|
|
|
|
ifeq (${VER_REV},0)
|
|
|
|
DEB_VER := $(shell echo "${VER_MAJ}.${VER_MIN}")
|
|
|
|
else
|
|
|
|
DEB_VER := $(shell echo "${VER_MAJ}.${VER_MIN}.${VER_REV}")
|
|
|
|
endif
|
2011-02-16 13:24:56 +00:00
|
|
|
DEB_REV := $(shell cat debian/revision)
|
2010-06-02 19:14:29 +00:00
|
|
|
# Ubuntu versions are: <upstream version>-<deb ver>ubuntu<build ver>
|
2013-07-06 20:58:29 +02:00
|
|
|
# eg: oolite1.74.4-130706-0ubuntu1
|
|
|
|
# Oolite versions are: MAJ.min.rev-date (yymmdd)
|
|
|
|
# eg. 1.74.0-130706
|
|
|
|
# Our .deb versions are: MAJ.min.rev-datestring-<pkg rev>[~<type>]
|
|
|
|
# eg. 1.74.0.3275-0, 1.74.0-130706-0~test
|
2011-03-04 19:21:17 +00:00
|
|
|
pkg-debtest: DEB_REV := $(shell echo "0~test${DEB_REV}")
|
|
|
|
pkg-debsnapshot: DEB_REV := $(shell echo "0~trunk${DEB_REV}")
|
2008-11-17 10:42:14 +00:00
|
|
|
|
2008-11-15 09:54:01 +00:00
|
|
|
ifeq ($(GNUSTEP_HOST_OS),mingw32)
|
2013-10-31 09:06:57 +01:00
|
|
|
ifeq ($(GNUSTEP_HOST_CPU),x86_64)
|
|
|
|
LIBJS = deps/Windows-deps/x86_64/DLLs/js32ECMAv5.dll
|
|
|
|
LIBJS_DBG = deps/Windows-deps/x86_64/DLLs/js32ECMAv5.dll
|
|
|
|
else
|
|
|
|
LIBJS = deps/Windows-deps/x86/DLLs/js32ECMAv5.dll
|
|
|
|
LIBJS_DBG = deps/Windows-deps/x86/DLLs/js32ECMAv5.dll
|
|
|
|
endif
|
2011-03-04 19:21:17 +00:00
|
|
|
DEPS = $(LIBJS)
|
|
|
|
DEPS_DBG = $(LIBJS_DBG)
|
2011-03-13 09:06:27 +00:00
|
|
|
else
|
2011-03-04 19:21:17 +00:00
|
|
|
# define autopackage .apspec file according to the CPU architecture
|
2011-03-26 13:58:16 +00:00
|
|
|
HOST_ARCH := $(shell echo $(GNUSTEP_HOST_CPU) | sed -e s/i.86/x86/ -e s/amd64/x86_64/ )
|
2011-03-04 19:21:17 +00:00
|
|
|
ifeq ($(HOST_ARCH),x86_64)
|
|
|
|
APSPEC_FILE = installers/autopackage/default.x86_64.apspec
|
|
|
|
else
|
|
|
|
APSPEC_FILE = installers/autopackage/default.x86.apspec
|
|
|
|
endif
|
2011-03-13 09:06:27 +00:00
|
|
|
|
2011-03-04 19:21:17 +00:00
|
|
|
DEPS = LIBJS
|
|
|
|
DEPS_DBG = LIBJS_DBG
|
2008-11-15 09:54:01 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# Here are our default targets
|
|
|
|
#
|
2010-06-02 19:14:29 +00:00
|
|
|
.PHONY: debug
|
2011-02-16 13:24:56 +00:00
|
|
|
debug: $(DEPS_DBG)
|
2015-09-06 10:25:25 +01:00
|
|
|
$(MAKE) -f GNUmakefile debug=yes strip=no
|
2013-10-17 22:16:26 +01:00
|
|
|
mkdir -p AddOns && rm -rf AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp AddOns/Basic-debug.oxp
|
2010-06-02 19:14:29 +00:00
|
|
|
|
2008-11-17 10:42:14 +00:00
|
|
|
.PHONY: release
|
2008-11-15 09:54:01 +00:00
|
|
|
release: $(DEPS)
|
2015-09-06 10:25:25 +01:00
|
|
|
$(MAKE) -f GNUmakefile debug=no strip=yes
|
2013-10-17 22:16:26 +01:00
|
|
|
mkdir -p AddOns && rm -rf AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp AddOns/Basic-debug.oxp
|
2010-04-28 17:02:16 +00:00
|
|
|
|
2009-11-14 16:18:23 +00:00
|
|
|
.PHONY: release-deployment
|
|
|
|
release-deployment: $(DEPS)
|
2015-09-06 10:25:25 +01:00
|
|
|
$(MAKE) -f GNUmakefile DEPLOYMENT_RELEASE_CONFIGURATION=yes debug=no strip=yes
|
2013-10-17 22:16:26 +01:00
|
|
|
|
2009-07-11 16:09:53 +00:00
|
|
|
.PHONY: release-snapshot
|
|
|
|
release-snapshot: $(DEPS)
|
2015-09-06 10:25:25 +01:00
|
|
|
$(MAKE) -f GNUmakefile SNAPSHOT_BUILD=yes VERSION_STRING=$(VER) debug=no strip=yes
|
2013-10-17 22:16:26 +01:00
|
|
|
mkdir -p AddOns && rm -rf AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp AddOns/Basic-debug.oxp
|
2008-11-15 09:54:01 +00:00
|
|
|
|
2010-06-02 19:14:29 +00:00
|
|
|
# Here are targets using the provided dependencies
|
|
|
|
.PHONY: deps-debug
|
2011-02-16 13:24:56 +00:00
|
|
|
deps-debug: $(DEPS_DBG)
|
2015-09-06 10:25:25 +01:00
|
|
|
$(MAKE) -f GNUmakefile debug=yes use_deps=yes strip=no
|
2013-10-17 22:16:26 +01:00
|
|
|
mkdir -p AddOns && rm -rf AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp AddOns/Basic-debug.oxp
|
2010-06-02 19:14:29 +00:00
|
|
|
|
|
|
|
.PHONY: deps-release
|
|
|
|
deps-release: $(DEPS)
|
2015-09-06 10:25:25 +01:00
|
|
|
$(MAKE) -f GNUmakefile debug=no use_deps=yes strip=yes
|
2013-10-17 22:16:26 +01:00
|
|
|
mkdir -p AddOns && rm -rf AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp AddOns/Basic-debug.oxp
|
|
|
|
|
|
|
|
|
2010-06-02 19:14:29 +00:00
|
|
|
.PHONY: deps-release-deployment
|
|
|
|
deps-release-deployment: $(DEPS)
|
2015-09-06 10:25:25 +01:00
|
|
|
$(MAKE) -f GNUmakefile DEPLOYMENT_RELEASE_CONFIGURATION=yes debug=no use_deps=yes strip=yes
|
2013-10-17 22:16:26 +01:00
|
|
|
|
2010-06-02 19:14:29 +00:00
|
|
|
.PHONY: deps-release-snapshot
|
|
|
|
deps-release-snapshot: $(DEPS)
|
2015-09-06 10:25:25 +01:00
|
|
|
$(MAKE) -f GNUmakefile SNAPSHOT_BUILD=yes VERSION_STRING=$(VER) debug=no use_deps=yes strip=yes
|
2013-10-17 22:16:26 +01:00
|
|
|
mkdir -p AddOns && rm -rf AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp AddOns/Basic-debug.oxp
|
2008-11-15 09:54:01 +00:00
|
|
|
|
2011-02-16 13:24:56 +00:00
|
|
|
.PHONY: LIBJS_DBG
|
|
|
|
LIBJS_DBG:
|
|
|
|
ifeq ($(GNUSTEP_HOST_OS),mingw32)
|
|
|
|
@echo "ERROR - this Makefile can't (yet) build the Javascript DLL"
|
|
|
|
@echo " Please build it yourself and copy it to $(LIBJS_DBG)."
|
|
|
|
false
|
|
|
|
endif
|
2011-03-04 19:21:17 +00:00
|
|
|
$(MAKE) -f libjs.make debug=yes
|
2011-02-16 13:24:56 +00:00
|
|
|
|
|
|
|
.PHONY: LIBJS
|
|
|
|
LIBJS:
|
2008-11-15 09:54:01 +00:00
|
|
|
ifeq ($(GNUSTEP_HOST_OS),mingw32)
|
|
|
|
@echo "ERROR - this Makefile can't (yet) build the Javascript DLL"
|
|
|
|
@echo " Please build it yourself and copy it to $(LIBJS)."
|
|
|
|
false
|
|
|
|
endif
|
2011-03-04 19:21:17 +00:00
|
|
|
$(MAKE) -f libjs.make debug=no
|
2008-11-15 09:54:01 +00:00
|
|
|
|
2008-11-17 10:42:14 +00:00
|
|
|
.PHONY: clean
|
2008-11-15 09:54:01 +00:00
|
|
|
clean:
|
2011-03-04 19:21:17 +00:00
|
|
|
$(MAKE) -f GNUmakefile clean
|
2011-11-30 00:05:17 +00:00
|
|
|
$(RM) -rf oolite.app
|
2013-10-17 22:16:26 +01:00
|
|
|
$(RM) -rf AddOns
|
2011-02-27 23:29:34 +00:00
|
|
|
|
|
|
|
.PHONY: distclean
|
|
|
|
distclean: clean
|
2011-02-16 13:24:56 +00:00
|
|
|
ifneq ($(GNUSTEP_HOST_OS),mingw32)
|
2011-03-05 06:51:29 +00:00
|
|
|
$(MAKE) -f libjs.make distclean debug=yes
|
|
|
|
$(MAKE) -f libjs.make distclean debug=no
|
2011-02-16 13:24:56 +00:00
|
|
|
endif
|
2008-11-15 09:54:01 +00:00
|
|
|
|
2008-11-17 10:42:14 +00:00
|
|
|
.PHONY: all
|
2009-11-14 16:18:23 +00:00
|
|
|
all: release release-deployment release-snapshot debug
|
2008-11-15 09:54:01 +00:00
|
|
|
|
2008-11-17 10:42:14 +00:00
|
|
|
.PHONY: remake
|
2008-11-15 09:54:01 +00:00
|
|
|
remake: clean all
|
|
|
|
|
2010-06-02 19:14:29 +00:00
|
|
|
.PHONY: deps-all
|
|
|
|
deps-all: deps-release deps-release-deployment deps-release-snapshot deps-debug
|
|
|
|
|
|
|
|
.PHONY: deps-remake
|
|
|
|
deps-remake: clean deps-all
|
|
|
|
|
2009-09-04 16:44:01 +00:00
|
|
|
# Here are our linux autopackager targets
|
|
|
|
#
|
|
|
|
pkg-autopackage:
|
2010-04-28 09:37:38 +00:00
|
|
|
makepackage -c -m $(APSPEC_FILE)
|
2009-09-04 16:44:01 +00:00
|
|
|
|
2011-03-26 13:58:16 +00:00
|
|
|
# Here are our POSIX (e.g. FreeBSD, Linux etc.) self-extracted packager targets
|
|
|
|
#
|
|
|
|
# TODO: For debug package the "oolite" startup script should point to "oolite.app/oolite.dbg" binary,
|
|
|
|
# the "uninstall" script should remove the "oolite.dbg" binary and
|
|
|
|
# either not distribute the "oolite-update" scripts or create an Oolite debug repository and
|
|
|
|
# update the "oolite.app/oolite-update" script to synchronize accordingly
|
|
|
|
#
|
|
|
|
# pkg-posix-debug:
|
2011-03-27 14:30:25 +00:00
|
|
|
# installers/posix/make_installer.sh $(HOST_ARCH) $(VER) "debug"
|
2011-03-26 13:58:16 +00:00
|
|
|
#
|
|
|
|
pkg-posix:
|
2011-03-27 14:30:25 +00:00
|
|
|
installers/posix/make_installer.sh $(HOST_ARCH) $(VER) "release-deployment" ""
|
2011-03-26 13:58:16 +00:00
|
|
|
|
|
|
|
pkg-posix-test:
|
2011-03-27 14:30:25 +00:00
|
|
|
installers/posix/make_installer.sh $(HOST_ARCH) $(VER) "release" ""
|
2011-03-26 13:58:16 +00:00
|
|
|
|
|
|
|
pkg-posix-snapshot:
|
2011-03-27 14:30:25 +00:00
|
|
|
installers/posix/make_installer.sh $(HOST_ARCH) $(VER) "release-snapshot" ""
|
|
|
|
|
|
|
|
pkg-posix-nightly:
|
|
|
|
installers/posix/make_installer.sh $(HOST_ARCH) $(VER) "release-snapshot" "nightly"
|
2011-03-26 13:58:16 +00:00
|
|
|
|
2008-11-15 09:54:01 +00:00
|
|
|
# Here are our Debian packager targets
|
|
|
|
#
|
2009-09-05 09:40:57 +00:00
|
|
|
.PHONY: debian/changelog
|
|
|
|
debian/changelog:
|
2010-06-02 19:14:29 +00:00
|
|
|
cat debian/changelog.in | sed -e "s/@@VERSION@@/${VER}/g" -e "s/@@REVISION@@/${DEB_REV}/g" -e "s/@@TIMESTAMP@@/${DEB_BUILDTIME}/g" > debian/changelog
|
2009-09-05 09:40:57 +00:00
|
|
|
|
|
|
|
.PHONY: pkg-deb pkg-debtest pkg-debsnapshot
|
|
|
|
pkg-deb: debian/changelog
|
|
|
|
debuild binary
|
|
|
|
|
|
|
|
pkg-debtest: debian/changelog
|
|
|
|
debuild binary
|
|
|
|
|
|
|
|
pkg-debsnapshot: debian/changelog
|
2010-06-02 19:14:29 +00:00
|
|
|
debuild -e SNAPSHOT_BUILD=yes -e VERSION_STRING=$(VER) binary
|
2008-11-15 09:54:01 +00:00
|
|
|
|
2008-11-17 10:42:14 +00:00
|
|
|
.PHONY: pkg-debclean
|
2008-11-15 09:54:01 +00:00
|
|
|
pkg-debclean:
|
|
|
|
debuild clean
|
|
|
|
|
|
|
|
# And here are our Windows packager targets
|
|
|
|
#
|
2013-10-31 09:06:57 +01:00
|
|
|
NSIS=/nsis/makensis.exe
|
2008-11-17 10:42:14 +00:00
|
|
|
NSISVERSIONS=installers/win32/OoliteVersions.nsh
|
|
|
|
|
|
|
|
# Passing arguments cause problems with some versions of NSIS.
|
|
|
|
# Because of this, we generate them into a separate file and include them.
|
|
|
|
.PHONY: ${NSISVERSIONS}
|
|
|
|
${NSISVERSIONS}:
|
|
|
|
@echo "; Version Definitions for Oolite" > $@
|
|
|
|
@echo "; NOTE - This file is auto-generated by the Makefile, any manual edits will be overwritten" >> $@
|
2008-11-17 19:04:27 +00:00
|
|
|
@echo "!define VER_MAJ ${VER_MAJ}" >> $@
|
|
|
|
@echo "!define VER_MIN ${VER_MIN}" >> $@
|
|
|
|
@echo "!define VER_REV ${VER_REV}" >> $@
|
2013-09-09 13:10:38 +02:00
|
|
|
@echo "!define VER_GITREV ${VER_GITREV}" >> $@
|
|
|
|
@echo "!define VER_GITHASH ${VER_GITHASH}" >> $@
|
2008-11-17 19:04:27 +00:00
|
|
|
@echo "!define VERSION ${VER}" >> $@
|
2008-11-17 10:42:14 +00:00
|
|
|
@echo "!define BUILDTIME \"${BUILDTIME}\"" >> $@
|
2013-12-23 09:37:27 +01:00
|
|
|
ifeq ($(GNUSTEP_HOST_CPU),x86_64)
|
|
|
|
@echo "!define BUILDHOST_IS64BIT 1" >> $@
|
|
|
|
else
|
|
|
|
@echo "!define BUILDHOST_IS64BIT 0" >> $@
|
|
|
|
endif
|
2008-11-17 10:42:14 +00:00
|
|
|
|
|
|
|
.PHONY: pkg-win
|
|
|
|
pkg-win: release ${NSISVERSIONS}
|
2008-11-15 14:21:56 +00:00
|
|
|
$(NSIS) installers/win32/OOlite.nsi
|
2013-10-17 22:16:26 +01:00
|
|
|
|
2009-11-14 16:18:23 +00:00
|
|
|
.PHONY: pkg-win-deployment
|
|
|
|
pkg-win-deployment: release-deployment ${NSISVERSIONS}
|
2011-03-25 00:19:12 +00:00
|
|
|
@echo "!define DEPLOYMENT 1" >> ${NSISVERSIONS}
|
2009-11-14 16:18:23 +00:00
|
|
|
$(NSIS) installers/win32/OOlite.nsi
|
2008-11-15 09:54:01 +00:00
|
|
|
|
2008-11-17 10:42:14 +00:00
|
|
|
.PHONY: pkg-win-snapshot
|
2009-07-11 16:09:53 +00:00
|
|
|
pkg-win-snapshot: release-snapshot ${NSISVERSIONS}
|
2008-11-17 10:42:14 +00:00
|
|
|
@echo "!define SNAPSHOT 1" >> ${NSISVERSIONS}
|
|
|
|
$(NSIS) installers/win32/OOlite.nsi
|
|
|
|
|
|
|
|
.PHONY: help
|
2008-11-15 09:54:01 +00:00
|
|
|
help:
|
2010-06-02 19:14:29 +00:00
|
|
|
@echo "This is a helper-Makefile to make compiling Oolite easier."
|
2010-04-28 17:02:16 +00:00
|
|
|
@echo
|
2010-06-02 19:14:29 +00:00
|
|
|
@echo "NOTE (Linux): To build with the dependency libraries provided with Oolite"
|
|
|
|
@echo " source, use 'deps-' prefix with debug, release, release-snapshot"
|
|
|
|
@echo " and release-deployment build options."
|
2010-04-28 17:02:16 +00:00
|
|
|
@echo
|
2010-06-02 19:14:29 +00:00
|
|
|
@echo "Development Targets:"
|
|
|
|
@echo " debug - builds a debug executable in oolite.app/oolite.dbg"
|
2015-06-04 15:09:43 +03:00
|
|
|
@echo " release - builds a test release executable in oolite.app/oolite"
|
2010-06-02 19:14:29 +00:00
|
|
|
@echo " release-deployment - builds a release executable in oolite.app/oolite"
|
|
|
|
@echo " release-snapshot - builds a snapshot release in oolite.app/oolite"
|
|
|
|
@echo " all - builds the above targets"
|
|
|
|
@echo " clean - removes all generated files"
|
2008-11-15 09:54:01 +00:00
|
|
|
@echo
|
2010-06-02 19:14:29 +00:00
|
|
|
@echo "Packaging Targets:"
|
2011-03-26 13:58:16 +00:00
|
|
|
@echo " Linux (debian):"
|
2010-06-02 19:14:29 +00:00
|
|
|
@echo " pkg-deb - builds a release Debian package"
|
|
|
|
@echo " pkg-debtest - builds a test release Debian package"
|
|
|
|
@echo " pkg-debsnapshot - builds a snapshot release Debian package"
|
|
|
|
@echo " pkg-debclean - cleans up after a Debian package build"
|
2008-11-15 09:54:01 +00:00
|
|
|
@echo
|
2011-03-26 13:58:16 +00:00
|
|
|
@echo " POSIX (e.g. FreeBSD, Linux etc.):"
|
2011-03-27 14:30:25 +00:00
|
|
|
@echo " pkg-autopackage - builds an autopackage (http://autopackage.org) package"
|
2011-03-26 13:58:16 +00:00
|
|
|
@echo
|
|
|
|
@echo " pkg-posix - builds a release self-extracting package"
|
|
|
|
@echo " pkg-posix-test - builds a test release self-extracting package"
|
|
|
|
@echo " pkg-posix-snapshot - builds a snapshot release self-extracting package"
|
2011-03-27 14:30:25 +00:00
|
|
|
@echo " pkg-posix-nightly - builds a snapshot release self-extracting package for the nightly build"
|
2011-03-26 13:58:16 +00:00
|
|
|
@echo
|
2010-06-02 19:14:29 +00:00
|
|
|
@echo " Windows Installer:"
|
|
|
|
@echo " pkg-win - builds a test-release version"
|
|
|
|
@echo " pkg-win-deployment - builds a release version"
|
|
|
|
@echo " pkg-win-snapshot - builds a snapshot version"
|