3
# We want to disable the default rules. It's not c/c++ anyway
6
################################################################
7
# Programme definitions / search paths
8
################################################################
9
# Build parameters and programmes
11
GRFCODEC_FLAGS ?= -e -p 2
30
UNIX2DOS ?= $(shell [ `which unix2dos 2>/dev/null` ] && echo "unix2dos" || echo "")
31
# Macs have a different md5 command than linux or mingw envirnoment:
32
MD5SUM ?= $(shell [ "$(OSTYPE)" = "Darwin" ] && echo "md5 -r" || echo "md5sum")
36
NFO_DIR ?= $(SRC_DIR)/nfo
39
# Add some OS detection and guess an install path (use the system's default)
40
OSTYPE:=$(shell uname -s)
41
ifeq ($(OSTYPE),Linux)
42
INSTALL_DIR?=$(HOME)/.openttd/data
44
ifeq ($(OSTYPE),Darwin)
45
INSTALL_DIR?=$(HOME)/Documents/OpenTTD/data
47
ifeq ($(shell echo "$(OSTYPE)" | cut -d_ -f1),MINGW32)
48
INSTALL_DIR?=C:\Documents and Settings\$(USERNAME)\My Documents\OpenTTD\data
55
# Previous versions used INSTALLDIR instead of INSTALL_DIR. Use the previous version,
56
# if supplied via command line parameter:
59
INSTALL_DIR = $(INSTALLDIR)
62
################################################################
63
# Get the Repository revision, tags and the modified status
64
# The displayed name within OpenTTD / TTDPatch
66
# a nightly build: GRF's Name nightly-r51
67
# a release build (taged version): GRF's Name 0.1
68
################################################################
69
REPO_REVISION ?= $(shell $(HG) id -n | cut -d+ -f1)
70
REPO_MODIFIED ?= $(shell [ "`$(HG) id | cut -c13`" = "+" ] && echo "M" || echo "")
71
REPO_TAGS ?= $(shell $(HG) id -t | grep -v "tip")
72
REPO_FILES_CMD := $(HG) st -A | grep -v "^I" | grep -v "^?" | grep -v "^\!" | cut -d\ -f2
73
REPO_FILES ?= $(shell $(REPO_FILES_CMD))
74
REPO_DIRS ?= $(shell for i in $(REPO_FILES); do dirname $$i; done | sort | uniq)
75
REPO_TITLE := $(REPO_NAME) $(shell [ -n "$(REPO_TAGS)" ] && echo $(REPO_TAGS)$(REPO_MODIFIED) || echo nightly-r$(REPO_REVISION)$(REPO_MODIFIED))
77
################################################################
78
# Rules on how to generate filenames. Usually no need to change
79
################################################################
80
# Define how the displayed name and the filename of the bundled grf shall look like:
81
# The result will either be
82
# nightly build: mynewgrf-nightly-r51
83
# a release build (tagged version): mynewgrf-0.1
84
# followed by an M, if the source repository is not a clean version.
89
FILENAME_STUB := $(basename $(MAIN_TARGET))
90
DIR_BASE := $(FILENAME_STUB)-
91
VERSION_STRING := $(shell [ -n "$(REPO_TAGS)" ] && echo $(REPO_TAGS)$(REPO_MODIFIED) || echo nightly-r$(REPO_REVISION)$(REPO_MODIFIED))
92
DIR_NAME := $(shell [ -n "$(REPO_TAGS)" ] && echo $(DIR_BASE)$(VERSION_STRING) || echo $(DIR_BASE)nightly)
93
VERSIONED_FILENAME := $(DIR_BASE)$(VERSION_STRING)
94
DIR_NAME_SRC := $(VERSIONED_FILENAME)-source
96
TAR_FILENAME := $(DIR_NAME).tar
97
BZIP_FILENAME := $(TAR_FILENAME).bz2
98
ZIP_FILENAME := $(VERSIONED_FILENAME).zip
100
MD5_FILENAME := $(DIR_NAME).md5
101
REV_FILENAME := $(VERSIONED_FILENAME).$(REV_EXTENSION)
103
DOC_FILES_SRC := $(LICENSE_FILENAME_SRC) $(README_FILENAME_SRC) $(CHANGELOG_FILENAME_SRC)
104
DOC_FILES := $(addsuffix .txt,$(basename $(DOC_FILES_SRC)))
106
# Directories which to remember when creating a source release
107
MAIN_DIRS = $(SRC_DIR) $(DOC_DIR) $(SCRIPT_DIR) $(TEMPLATE_DIR) $(EXTRA_DIRS)
109
FILE_SRC_RE := $(shell echo $(FILE_SRC_EXTENSIONS) | tr -s "[:space:]" "|")
110
FILE_INC_RE := $(shell echo $(FILE_INC_EXTENSIONS) | tr -s "[:space:]" "|")
112
# Remove the @ when you want a more verbose output.
116
VPATH = . docs extra/os/rpm scripts src src/wav