Changeset - r15859:1a0e19e54e67
[Not reviewed]
master
0 1 0
rubidium - 14 years ago 2010-08-19 08:07:19
rubidium@openttd.org
(svn r20551) -Fix [FS#4056]: apparantly Mac OS X's sed and GNU's can't decide on a single "format" for replacing stuff in-place
1 file changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
Makefile.grf.in
Show inline comments
 
@@ -22,6 +22,7 @@ ROOT_DIR = !!ROOT_DIR!!
 
GRF_DIR  = $(ROOT_DIR)/media/extra_grf
 
BIN_DIR  = !!BIN_DIR!!/data
 
OBJS_DIR = !!GRF_OBJS_DIR!!
 
OS       = !!OS!!
 

	
 
# Check if we want to show what we are doing
 
ifdef VERBOSE
 
@@ -35,6 +36,7 @@ endif
 
# Some configurational settings for your environment.
 
GRFCODEC := grfcodec
 
NFORENUM := $(shell [ `which nforenum 2>/dev/null` ] && echo "nforenum" || echo "renum")
 
MD5SUM   := $(shell [ "$(OS)" = "OSX" ] && echo "md5 -r" || echo "md5sum")
 

	
 
# Some "should not be changed" settings.
 
NFO_FILES    := $(GRF_DIR)/*.nfo
 
@@ -52,13 +54,14 @@ all: $(BIN_DIR)/openttd.grf
 
	@# 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
 
	$(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
 
	$(Q) $(GRFCODEC) -e -m1 $(OBJS_DIR)/openttd.grf
 
	$(Q) cp $(OBJS_DIR)/openttd.grf $(BIN_DIR)/openttd.grf
 
	$(Q) for grf in $(BIN_DIR)/orig*.obg; do sed 's/^OPENTTD.GRF  = [0-9a-f]*$$/OPENTTD.GRF  = '`md5sum $(BIN_DIR)/openttd.grf | sed 's@ .*@@'`'/' -i $$grf; done
 
	$(Q) for grf in $(BIN_DIR)/orig*.obg; do sed 's/^OPENTTD.GRF  = [0-9a-f]*$$/OPENTTD.GRF  = '`$(MD5SUM) $(BIN_DIR)/openttd.grf | sed 's@ .*@@'`'/' $$grf > $$grf.tmp && mv $$grf.tmp $$grf; done
 

	
 
# Clean up temporary files.
 
clean:
0 comments (0 inline, 0 general)