mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-02-02 09:04:29 +01:00
- Fix: Retain information about all base sets that are found and not only the latest version to stop confusing people that use newer versions of the base sets than those available via BaNaNaS (r20607) - Fix: Let NewGRFs var43 var (information about liveries) for vehicles not be influenced by the local setting determining whether to show liveries or not [FS#4063] (r20605) - Fix: 'Downscale' a full load order to a load if possible order when removing the order while the vehicle is loading. This to prevent the vehicle from (possibly) staying forever in the station [FS#4075] (r20600) - Fix: Crash when the tooltip is wider than the window is [FS#4066] (r20596) - Fix: No (proper) savegame conversion was done when _date_fract got a new value range (r20592)
96 lines
4.9 KiB
Makefile
96 lines
4.9 KiB
Makefile
# $Id$
|
|
|
|
# This file is part of OpenTTD.
|
|
# OpenTTD 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, version 2.
|
|
# OpenTTD 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 OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
# Building requires GRFCodec and NFORenum. Older versions of GRFCodec are
|
|
# known to miscompile the graphics.
|
|
#
|
|
# Recent nightlies (including sources) of both can be found at:
|
|
# http://www.openttd.org/download-grfcodec
|
|
# http://www.openttd.org/download-nforenum
|
|
#
|
|
# The mercurial repository of both can be found at:
|
|
# http://hg.openttdcoop.org/grfcodec
|
|
# http://hg.openttdcoop.org/nforenum
|
|
#
|
|
|
|
|
|
ROOT_DIR = !!ROOT_DIR!!
|
|
GRF_DIR = $(ROOT_DIR)/media/extra_grf
|
|
BIN_DIR = !!BIN_DIR!!/data
|
|
OBJS_DIR = !!GRF_OBJS_DIR!!
|
|
OS = !!OS!!
|
|
STAGE = !!STAGE!!
|
|
|
|
# Check if we want to show what we are doing
|
|
ifdef VERBOSE
|
|
Q =
|
|
E = @true
|
|
else
|
|
Q = @
|
|
E = @echo
|
|
endif
|
|
|
|
# Some configurational settings for your environment.
|
|
# If GRFCodec doesn't know a command, it'll exit with a non-zero exit code.
|
|
GRFCODEC := $(shell grfcodec -s -v >/dev/null 2>/dev/null && echo "grfcodec -s" || echo "grfcodec")
|
|
# Old NFORenums don't give an error code when a parameter isn't known, so we have to work around that.
|
|
NFORENUM := $(shell [ `nforenum -s -v 2>/dev/null | wc -l ` -eq 1 ] && echo "nforenum -s" || echo "nforenum")
|
|
MD5SUM := $(shell [ "$(OS)" = "OSX" ] && echo "md5 -r" || echo "md5sum")
|
|
|
|
# Some "should not be changed" settings.
|
|
NFO_FILES := $(GRF_DIR)/*.nfo
|
|
PCX_FILES := $(GRF_DIR)/*.pcx
|
|
|
|
# Build the GRF.
|
|
all: $(BIN_DIR)/openttdd.grf $(BIN_DIR)/openttdw.grf
|
|
|
|
# Make sure the sprites directory exists.
|
|
$(OBJS_DIR)/sprites:
|
|
$(Q)-mkdir "$@"
|
|
|
|
$(BIN_DIR)/openttdd.grf: $(PCX_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites
|
|
@# Only try; if nforenum isn't available, just retouch the file as they likely didn't need it anyway.
|
|
$(Q) ($(NFORENUM) -? > /dev/null 2>&1 && $(MAKE) $(OBJS_DIR)/openttdd.grf && cp $(OBJS_DIR)/openttdd.grf $(BIN_DIR)/openttdd.grf) || ([ -e $(BIN_DIR)/openttdd.grf ] && touch $(BIN_DIR)/openttdd.grf && echo "no NFORenum and GRFCodec found, skipping rebuild of openttdd.grf...") || (echo "no NFORenum and GRFCodec found, but no openttdd.grf either. Install NFORenum and GRFCodec." && exit 1)
|
|
|
|
# Yeah, we'd like to use -i in the sed, but Mac OS X's sed and GNU sed just can't agree on the usage of -i. In any case either one of them fails.
|
|
$(OBJS_DIR)/openttdd.grf: $(PCX_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites
|
|
$(E) '$(STAGE) Assembling openttdd.nfo'
|
|
$(Q)-cp $(PCX_FILES) $(OBJS_DIR)/sprites 2> /dev/null
|
|
$(Q) gcc -DDOS -I$(GRF_DIR) -C -E - < "$(GRF_DIR)/openttd.nfo" | sed -e '/^#/d' -e '/^$$/d' > $(OBJS_DIR)/sprites/openttdd.nfo
|
|
$(Q) $(NFORENUM) $(OBJS_DIR)/sprites/openttdd.nfo
|
|
$(E) '$(STAGE) Compiling openttdd.grf'
|
|
$(Q) $(GRFCODEC) -e -m1 $(OBJS_DIR)/openttdd.grf
|
|
$(Q) cp $(OBJS_DIR)/openttdd.grf $(BIN_DIR)/openttdd.grf
|
|
$(E) '$(STAGE) Updating base graphics sets for DOS graphics'
|
|
$(Q) for grf in $(BIN_DIR)/orig_dos*.obg; do sed 's/^OPENTTDD.GRF = [0-9a-f]*$$/OPENTTDD.GRF = '`$(MD5SUM) $(BIN_DIR)/openttdd.grf | sed 's@ .*@@'`'/' $$grf > $$grf.tmp && mv $$grf.tmp $$grf; done
|
|
|
|
$(BIN_DIR)/openttdw.grf: $(PCX_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites
|
|
@# Only try; if nforenum isn't available, just retouch the file as they likely didn't need it anyway.
|
|
$(Q) ($(NFORENUM) -? > /dev/null 2>&1 && $(MAKE) $(OBJS_DIR)/openttdw.grf && cp $(OBJS_DIR)/openttdw.grf $(BIN_DIR)/openttdw.grf) || ([ -e $(BIN_DIR)/openttdw.grf ] && touch $(BIN_DIR)/openttdw.grf && echo "no NFORenum and GRFCodec found, skipping rebuild of openttdw.grf...") || (echo "no NFORenum and GRFCodec found, but no openttdw.grf either. Install NFORenum and GRFCodec." && exit 1)
|
|
|
|
$(OBJS_DIR)/openttdw.grf: $(PCX_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites
|
|
$(E) '$(STAGE) Assembling openttdw.nfo'
|
|
$(Q)-cp $(PCX_FILES) $(OBJS_DIR)/sprites 2> /dev/null
|
|
$(Q) gcc -I$(GRF_DIR) -C -E - < "$(GRF_DIR)/openttd.nfo" | sed -e '/^#/d' -e '/^$$/d' > $(OBJS_DIR)/sprites/openttdw.nfo
|
|
$(Q) $(NFORENUM) $(OBJS_DIR)/sprites/openttdw.nfo
|
|
$(E) '$(STAGE) Compiling openttdw.grf'
|
|
$(Q) $(GRFCODEC) -e -p2 $(OBJS_DIR)/openttdw.grf
|
|
$(Q) cp $(OBJS_DIR)/openttdw.grf $(BIN_DIR)/openttdw.grf
|
|
$(E) '$(STAGE) Updating base graphics sets for Windows graphics'
|
|
$(Q) for grf in $(BIN_DIR)/orig_win.obg; do sed 's/^OPENTTDW.GRF = [0-9a-f]*$$/OPENTTDW.GRF = '`$(MD5SUM) $(BIN_DIR)/openttdw.grf | sed 's@ .*@@'`'/' $$grf > $$grf.tmp && mv $$grf.tmp $$grf; done
|
|
|
|
# Clean up temporary files.
|
|
clean:
|
|
$(Q)rm -f *.bak *.grf
|
|
|
|
# Clean up temporary files and result of generation, i.e. the grfs.
|
|
mrproper: clean
|
|
$(Q)rm -fr sprites
|
|
$(Q)rm -f $(BIN_DIR)/openttdd.grf $(BIN_DIR)/openttdw.grf
|
|
|
|
.PHONY: all mrproper depend clean
|