Add a note in the documentation of font sizes
[openttd/fttd.git] / Makefile.grf.in
blob1cc2642320f97d8ea684f1e706a20fedc0df648b
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.
10 # Recent versions (including sources) can be found at:
11 #  http://www.openttd.org/download-grfcodec
13 # The mercurial repository can be found at:
14 #  http://hg.openttdcoop.org/grfcodec
18 ROOT_DIR = !!ROOT_DIR!!
19 GRF_DIR  = $(ROOT_DIR)/media/extra_grf
20 BASESET_DIR = $(ROOT_DIR)/media/baseset
21 LANG_DIR = $(ROOT_DIR)/src/lang
22 BIN_DIR  = !!BIN_DIR!!/baseset
23 OBJS_DIR = !!GRF_OBJS_DIR!!
24 OS       = !!OS!!
25 STAGE    = !!STAGE!!
27 # Check if we want to show what we are doing
28 ifdef VERBOSE
29         Q =
30         E = @true
31 else
32         Q = @
33         E = @echo
34 endif
36 GRFCODEC := !!GRFCODEC!!
37 NFORENUM := !!NFORENUM!!
38 CC_BUILD := !!CC_BUILD!!
39 MD5SUM   := $(shell [ "$(OS)" = "OSX" ] && echo "md5 -r" || echo "md5sum")
41 # Some "should not be changed" settings.
42 NFO_FILES    := $(GRF_DIR)/*.nfo $(GRF_DIR)/rivers/*.nfo
43 PNG_FILES    := $(GRF_DIR)/*.png $(GRF_DIR)/rivers/*.png
45 # Build the GRF.
46 ifdef GRFCODEC
47 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
48 else
49 all:
50 endif
52 # Make sure the sprites directory exists.
53 $(OBJS_DIR)/sprites:
54         $(Q)-mkdir "$@"
56 $(OBJS_DIR)/langfiles.tmp: $(LANG_DIR)/*.txt
57         $(E) '$(STAGE) Collecting baseset translations'
58         $(Q) cat $^ > $@
60 $(BIN_DIR)/%.obg: $(BASESET_DIR)/%.obg $(BIN_DIR)/openttd.grf $(OBJS_DIR)/langfiles.tmp $(BASESET_DIR)/translations.awk
61         $(E) '$(STAGE) Updating $(notdir $@)'
62         $(Q) sed 's/^OPENTTD.GRF  = *[0-9a-f]*$$/OPENTTD.GRF  = '`$(MD5SUM) $(BIN_DIR)/openttd.grf | sed 's@ .*@@'`'/' $< > $@.tmp
63         $(Q) awk -v langfiles='$(OBJS_DIR)/langfiles.tmp' -f $(BASESET_DIR)/translations.awk $@.tmp >$@
64         $(Q) rm $@.tmp
66 $(BIN_DIR)/%.obs: $(BASESET_DIR)/%.obs $(OBJS_DIR)/langfiles.tmp $(BASESET_DIR)/translations.awk
67         $(E) '$(STAGE) Updating $(notdir $@)'
68         $(Q) awk -v langfiles='$(OBJS_DIR)/langfiles.tmp' -f $(BASESET_DIR)/translations.awk $< >$@
70 $(BIN_DIR)/%.obm: $(BASESET_DIR)/%.obm $(OBJS_DIR)/langfiles.tmp $(BASESET_DIR)/translations.awk
71         $(E) '$(STAGE) Updating $(notdir $@)'
72         $(Q) awk -v langfiles='$(OBJS_DIR)/langfiles.tmp' -f $(BASESET_DIR)/translations.awk $< >$@
74 # Compile extra grf
75 $(BIN_DIR)/openttd.grf: $(PNG_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites $(GRF_DIR)/assemble_nfo.awk
76         $(E) '$(STAGE) Assembling openttd.nfo'
77         $(Q)-cp $(PNG_FILES) $(OBJS_DIR)/sprites 2> /dev/null
78         $(Q) awk -f $(GRF_DIR)/assemble_nfo.awk $(GRF_DIR)/openttd.nfo > $(OBJS_DIR)/sprites/openttd.nfo
79         $(Q) $(NFORENUM) -s $(OBJS_DIR)/sprites/openttd.nfo
80         $(E) '$(STAGE) Compiling openttd.grf'
81         $(Q) $(GRFCODEC) -n -s -e -p1 $(OBJS_DIR)/openttd.grf
82         $(Q)cp $(OBJS_DIR)/openttd.grf $(BIN_DIR)/openttd.grf
84 # Clean up temporary files.
85 clean:
86         $(Q)rm -f *.bak *.grf
88 # Clean up temporary files
89 mrproper: clean
90         $(Q)rm -fr sprites
92 .PHONY: all mrproper depend clean