Changeset - r15894:6346341f669e
[Not reviewed]
master
0 1 0
rubidium - 14 years ago 2010-08-21 11:30:41
rubidium@openttd.org
(svn r20588) -Fix (r20586): apparantly some NFORenums don't return an error code when an unknown command line option is given
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
Makefile.grf.in
Show inline comments
 
@@ -14,50 +14,52 @@
 
#
 
# 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")
 
NFORENUM := $(shell nforenum -s -v >/dev/null 2>/dev/null && echo "nforenum -s" || echo "nforenum")
 
# 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)/openttd.grf
 

	
 
# Make sure the sprites directory exists.
 
$(OBJS_DIR)/sprites:
 
	$(Q)-mkdir "$@"
 

	
 
# Generic
 
$(BIN_DIR)/openttd.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)/openttd.grf && cp $(OBJS_DIR)/openttd.grf $(BIN_DIR)/openttd.grf) || ([ -e $(BIN_DIR)/openttd.grf ] && touch $(BIN_DIR)/openttd.grf && echo "no NFORenum and GRFCodec found, skipping rebuild of openttd.grf...") || (echo "no NFORenum and GRFCodec found, but no openttd.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)/openttd.grf: $(PCX_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites
 
	$(E) '$(STAGE) Assembling openttd.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/openttd.nfo
 
	$(Q) $(NFORENUM) $(OBJS_DIR)/sprites/openttd.nfo
0 comments (0 inline, 0 general)