Fix: [Win32] Crash message not fitting in crash dialog
[openttd-github.git] / Makefile.in
blob38d7f53294f663d6f58011a4f08f57c96f12d97f
1 # This file is part of OpenTTD.
2 # 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.
3 # 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.
4 # 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/>.
6 # Check if we want to show what we are doing
7 ifdef VERBOSE
8 Q =
9 else
10 Q = @
11 endif
13 include Makefile.am
15 CONFIG_CACHE_PWD = !!CONFIG_CACHE_PWD!!
16 CONFIG_CACHE_SOURCE_LIST = !!CONFIG_CACHE_SOURCE_LIST!!
17 BIN_DIR = !!BIN_DIR!!
18 ICON_THEME_DIR = !!ICON_THEME_DIR!!
19 MAN_DIR = !!MAN_DIR!!
20 MENU_DIR = !!MENU_DIR!!
21 SRC_DIR = !!SRC_DIR!!
22 ROOT_DIR = !!ROOT_DIR!!
23 BUNDLE_DIR = "$(ROOT_DIR)/bundle"
24 BUNDLES_DIR = "$(ROOT_DIR)/bundles"
25 INSTALL_DIR = !!INSTALL_DIR!!
26 INSTALL_BINARY_DIR = "$(INSTALL_DIR)/"!!BINARY_DIR!!
27 INSTALL_MAN_DIR = "$(INSTALL_DIR)/$(MAN_DIR)"
28 INSTALL_MENU_DIR = "$(INSTALL_DIR)/$(MENU_DIR)"
29 INSTALL_ICON_DIR = "$(INSTALL_DIR)/"!!ICON_DIR!!
30 INSTALL_ICON_THEME_DIR = "$(INSTALL_DIR)/$(ICON_THEME_DIR)"
31 INSTALL_DATA_DIR = "$(INSTALL_DIR)/"!!DATA_DIR!!
32 INSTALL_DOC_DIR = "$(INSTALL_DIR)/"!!DOC_DIR!!
33 SOURCE_LIST = !!SOURCE_LIST!!
34 CONFIGURE_FILES = !!CONFIGURE_FILES!!
35 BINARY_NAME = !!BINARY_NAME!!
36 STRIP = !!STRIP!!
37 TTD = !!TTD!!
38 TTDS = $(SRC_DIRS:%=%/$(TTD))
39 OS = !!OS!!
40 OSXAPP = !!OSXAPP!!
41 LIPO = !!LIPO!!
42 AWK = !!AWK!!
43 SORT = !!SORT!!
44 DISTCC = !!DISTCC!!
46 RES := $(shell if [ ! -f $(CONFIG_CACHE_PWD) ] || [ "`pwd`" != "`cat $(CONFIG_CACHE_PWD)`" ]; then echo "`pwd`" > $(CONFIG_CACHE_PWD); fi )
47 RES := $(shell if [ ! -f $(CONFIG_CACHE_SOURCE_LIST) ] || [ -n "`cmp $(CONFIG_CACHE_SOURCE_LIST) $(SOURCE_LIST) 2>/dev/null`" ]; then cp $(SOURCE_LIST) $(CONFIG_CACHE_SOURCE_LIST); fi )
49 all: config.pwd config.cache
50 ifdef DISTCC
51 @if [ -z "`echo '$(MFLAGS)' | grep '\-j'`" ]; then echo; echo "WARNING: you enabled distcc support, but you don't seem to be using the -jN parameter"; echo; fi
52 endif
53 @for dir in $(DIRS); do \
54 $(MAKE) -C $$dir all || exit 1; \
55 done
56 ifdef LIPO
57 # Lipo is an OSX thing. If it is defined, it means we are building for universal,
58 # and so we have have to combine the binaries into one big binary
60 # Remove the last binary made by the last compiled target
61 $(Q)rm -f $(BIN_DIR)/$(TTD)
62 # Make all the binaries into one
63 $(Q)$(LIPO) -create -output $(BIN_DIR)/$(TTD) $(TTDS)
64 endif
66 help:
67 @echo "Available make commands:"
68 @echo ""
69 @echo "Compilation:"
70 @echo " all compile the executable and the lang files"
71 @echo " lang compile the lang files only"
72 @echo "Clean up:"
73 @echo " clean remove the files generated during compilation"
74 @echo " mrproper remove the files generated during configuration and compilation"
75 @echo "Run after compilation:"
76 @echo " run execute openttd after the compilation"
77 @echo " run-gdb execute openttd in debug mode after the compilation"
78 @echo " run-prof execute openttd in profiling mode after the compilation"
79 @echo "Installation:"
80 @echo " install install the compiled files and the data-files after the compilation"
81 @echo " bundle create the base for an installation bundle"
82 @echo " bundle_zip create the zip installation bundle"
83 @echo " bundle_gzip create the gzip installation bundle"
84 @echo " bundle_bzip2 create the bzip2 installation bundle"
85 @echo " bundle_lha create the lha installation bundle"
86 @echo " bundle_dmg create the dmg installation bundle"
88 config.pwd: $(CONFIG_CACHE_PWD)
89 $(MAKE) reconfigure
91 config.cache: $(CONFIG_CACHE_SOURCE_LIST) $(CONFIGURE_FILES)
92 $(MAKE) reconfigure
94 reconfigure:
95 ifeq ($(shell if test -f config.cache; then echo 1; fi), 1)
96 @echo "----------------"
97 @echo "The system detected that source.list or any configure file is altered."
98 @echo " Going to reconfigure with last known settings..."
99 @echo "----------------"
100 # Make sure we don't lock config.cache
101 @$(shell cat config.cache | sed 's@\\ @\\\\ @g') || exit 1
102 @echo "----------------"
103 @echo "Reconfig done. Please re-execute make."
104 @echo "----------------"
105 else
106 @echo "----------------"
107 @echo "Have not found a configuration, please run configure first."
108 @echo "----------------"
109 @exit 1
110 endif
112 clean:
113 @for dir in $(DIRS); do \
114 $(MAKE) -C $$dir clean; \
115 done
116 $(Q)rm -rf $(BUNDLE_TARGET)
118 lang:
119 @for dir in $(LANG_DIRS); do \
120 $(MAKE) -C $$dir all; \
121 done
123 mrproper:
124 @for dir in $(DIRS); do \
125 $(MAKE) -C $$dir mrproper; \
126 done
127 # Don't be tempted to merge these two for loops. Doing that breaks make
128 # --dry-run, since make has this "feature" that it always runs commands
129 # containing $(MAKE), even when --dry-run is passed. The objective is of
130 # course to also get a dry-run of submakes, but make is not smart enough
131 # to see that a for loop runs both a submake and an actual command.
132 @for dir in $(DIRS); do \
133 rm -f $$dir/Makefile; \
134 done
135 $(Q)rm -rf objs
136 $(Q)rm -f Makefile Makefile.am Makefile.bundle
137 $(Q)rm -f media/openttd.desktop media/openttd.desktop.install
138 $(Q)rm -f $(CONFIG_CACHE_SOURCE_LIST) config.cache config.pwd config.log $(CONFIG_CACHE_PWD)
139 # directories for bundle generation
140 $(Q)rm -rf $(BUNDLE_DIR)
141 $(Q)rm -rf $(BUNDLES_DIR)
142 # output of profiling
143 $(Q)rm -f $(BIN_DIR)/gmon.out
144 # output of generating 'API' documentation
145 $(Q)rm -rf $(ROOT_DIR)/docs/source
146 $(Q)rm -rf $(ROOT_DIR)/docs/aidocs
147 $(Q)rm -rf $(ROOT_DIR)/docs/gamedocs
148 # directories created by OpenTTD on regression testing
149 $(Q)rm -rf $(BIN_DIR)/ai/regression/content_download $(BIN_DIR)/ai/regression/save $(BIN_DIR)/ai/regression/scenario
150 distclean: mrproper
152 maintainer-clean: distclean
153 $(Q)rm -f $(BIN_DIR)/baseset/openttd.grf $(BIN_DIR)/baseset/orig_extra.grf $(BIN_DIR)/baseset/*.obg $(BIN_DIR)/baseset/*.obs $(BIN_DIR)/baseset/*.obm
155 depend:
156 @for dir in $(SRC_DIRS); do \
157 $(MAKE) -C $$dir depend; \
158 done
160 run: all
161 $(Q)cd !!BIN_DIR!! && ./!!TTD!! $(OPENTTD_ARGS)
163 run-gdb: all
164 $(Q)cd !!BIN_DIR!! && gdb --ex run --args ./!!TTD!! $(OPENTTD_ARGS)
166 run-prof: all
167 $(Q)cd !!BIN_DIR!! && ./!!TTD!! $(OPENTTD_ARGS) && gprof !!TTD!! | less
169 regression: all
170 $(Q)cd !!BIN_DIR!! && sh ai/regression/run.sh
171 test: regression
173 %.o:
174 @for dir in $(SRC_DIRS); do \
175 $(MAKE) -C $$dir $(@:src/%=%); \
176 done
178 %.lng:
179 @for dir in $(LANG_DIRS); do \
180 $(MAKE) -C $$dir $@; \
181 done
183 .PHONY: test distclean mrproper clean
185 include Makefile.bundle