Introduce ForwardList as an implementation of a forward list
[openttd/fttd.git] / Makefile.grf.in
blob81089efb1195a7b2ed6d5dfbb7d7707a64b4b0f1
1 # $Id$
3 # This file is part of OpenTTD.
4 # 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.
5 # 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.
6 # 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/>.
8 # Building requires GRFCodec and NFORenum. Older versions of GRFCodec are
9 #  known to miscompile the graphics.
11 # Recent nightlies (including sources) of both can be found at:
12 #  http://www.openttd.org/download-grfcodec
13 #  http://www.openttd.org/download-nforenum
15 # The mercurial repository of both can be found at:
16 #  http://hg.openttdcoop.org/grfcodec
17 #  http://hg.openttdcoop.org/nforenum
21 ROOT_DIR = !!ROOT_DIR!!
22 GRF_DIR  = $(ROOT_DIR)/media/extra_grf
23 BASESET_DIR = $(ROOT_DIR)/media/baseset
24 LANG_DIR = $(ROOT_DIR)/src/lang
25 BIN_DIR  = !!BIN_DIR!!/baseset
26 OBJS_DIR = !!GRF_OBJS_DIR!!
27 OS       = !!OS!!
28 STAGE    = !!STAGE!!
30 # Check if we want to show what we are doing
31 ifdef VERBOSE
32         Q =
33         E = @true
34 else
35         Q = @
36         E = @echo
37 endif
39 GRFCODEC := !!GRFCODEC!!
40 NFORENUM := !!NFORENUM!!
41 CC_BUILD := !!CC_BUILD!!
42 MD5SUM   := $(shell [ "$(OS)" = "OSX" ] && echo "md5 -r" || echo "md5sum")
44 # Some "should not be changed" settings.
45 NFO_FILES    := $(GRF_DIR)/*.nfo $(GRF_DIR)/rivers/*.nfo
46 PNG_FILES    := $(GRF_DIR)/*.png $(GRF_DIR)/rivers/*.png
48 # Build the GRF.
49 ifdef GRFCODEC
50 all: $(BIN_DIR)/openttd.grf $(BIN_DIR)/orig_dos.obg $(BIN_DIR)/orig_dos_de.obg $(BIN_DIR)/orig_win.obg $(BIN_DIR)/orig_dos.obs $(BIN_DIR)/orig_win.obs $(BIN_DIR)/no_sound.obs $(BIN_DIR)/orig_win.obm $(BIN_DIR)/no_music.obm
51 else
52 all:
53 endif
55 # Make sure the sprites directory exists.
56 $(OBJS_DIR)/sprites:
57         $(Q)-mkdir "$@"
59 $(OBJS_DIR)/langfiles.tmp: $(LANG_DIR)/*.txt
60         $(E) '$(STAGE) Collecting baseset translations'
61         $(Q) cat $^ > $@
63 $(BIN_DIR)/%.obg: $(BASESET_DIR)/%.obg $(BIN_DIR)/openttd.grf $(OBJS_DIR)/langfiles.tmp $(BASESET_DIR)/translations.awk
64         $(E) '$(STAGE) Updating $(notdir $@)'
65         $(Q) sed 's/^OPENTTD.GRF  = *[0-9a-f]*$$/OPENTTD.GRF  = '`$(MD5SUM) $(BIN_DIR)/openttd.grf | sed 's@ .*@@'`'/' $< > $@.tmp
66         $(Q) awk -v langfiles='$(OBJS_DIR)/langfiles.tmp' -f $(BASESET_DIR)/translations.awk $@.tmp >$@
67         $(Q) rm $@.tmp
69 $(BIN_DIR)/%.obs: $(BASESET_DIR)/%.obs $(OBJS_DIR)/langfiles.tmp $(BASESET_DIR)/translations.awk
70         $(E) '$(STAGE) Updating $(notdir $@)'
71         $(Q) awk -v langfiles='$(OBJS_DIR)/langfiles.tmp' -f $(BASESET_DIR)/translations.awk $< >$@
73 $(BIN_DIR)/%.obm: $(BASESET_DIR)/%.obm $(OBJS_DIR)/langfiles.tmp $(BASESET_DIR)/translations.awk
74         $(E) '$(STAGE) Updating $(notdir $@)'
75         $(Q) awk -v langfiles='$(OBJS_DIR)/langfiles.tmp' -f $(BASESET_DIR)/translations.awk $< >$@
77 # Compile extra grf
78 $(BIN_DIR)/openttd.grf: $(PNG_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites
79         $(E) '$(STAGE) Assembling openttd.nfo'
80         $(Q)-cp $(PNG_FILES) $(OBJS_DIR)/sprites 2> /dev/null
81         $(Q) $(CC_BUILD) -nostdinc -I$(GRF_DIR) -C -E - < "$(GRF_DIR)/openttd.nfo" | sed -e '/^#/d' -e '/^$$/d' > $(OBJS_DIR)/sprites/openttd.nfo
82         $(Q) $(NFORENUM) -s $(OBJS_DIR)/sprites/openttd.nfo
83         $(E) '$(STAGE) Compiling openttd.grf'
84         $(Q) $(GRFCODEC) -n -s -e -p1 $(OBJS_DIR)/openttd.grf
85         $(Q)cp $(OBJS_DIR)/openttd.grf $(BIN_DIR)/openttd.grf
87 # Clean up temporary files.
88 clean:
89         $(Q)rm -f *.bak *.grf
91 # Clean up temporary files
92 mrproper: clean
93         $(Q)rm -fr sprites
95 .PHONY: all mrproper depend clean