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 # Check if we want to show what we are doing
17 CONFIG_CACHE_PWD
= !!CONFIG_CACHE_PWD
!!
18 CONFIG_CACHE_SOURCE_LIST
= !!CONFIG_CACHE_SOURCE_LIST
!!
20 ICON_THEME_DIR
= !!ICON_THEME_DIR
!!
22 MENU_DIR
= !!MENU_DIR
!!
24 ROOT_DIR
= !!ROOT_DIR
!!
25 BUNDLE_DIR
= "$(ROOT_DIR)/bundle"
26 BUNDLES_DIR
= "$(ROOT_DIR)/bundles"
27 INSTALL_DIR
= !!INSTALL_DIR
!!
28 INSTALL_BINARY_DIR
= "$(INSTALL_DIR)/"!!BINARY_DIR
!!
29 INSTALL_MAN_DIR
= "$(INSTALL_DIR)/$(MAN_DIR)"
30 INSTALL_MENU_DIR
= "$(INSTALL_DIR)/$(MENU_DIR)"
31 INSTALL_ICON_DIR
= "$(INSTALL_DIR)/"!!ICON_DIR
!!
32 INSTALL_ICON_THEME_DIR
= "$(INSTALL_DIR)/$(ICON_THEME_DIR)"
33 INSTALL_DATA_DIR
= "$(INSTALL_DIR)/"!!DATA_DIR
!!
34 INSTALL_DOC_DIR
= "$(INSTALL_DIR)/"!!DOC_DIR
!!
35 SOURCE_LIST
= !!SOURCE_LIST
!!
36 CONFIGURE_FILES
= !!CONFIGURE_FILES
!!
37 BINARY_NAME
= !!BINARY_NAME
!!
40 TTDS
= $(SRC_DIRS
:%=%/$(TTD
))
44 REVISION
= !!REVISION
!!
49 RES
:= $(shell if
[ ! -f
$(CONFIG_CACHE_PWD
) ] ||
[ "`pwd`" != "`cat $(CONFIG_CACHE_PWD)`" ]; then echo
"`pwd`" > $(CONFIG_CACHE_PWD
); fi
)
50 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
)
52 all: config.pwd config.cache
54 @if
[ -z
"`echo '$(MFLAGS)' | grep '\-j'`" ]; then echo
; echo
"WARNING: you enabled distcc support, but you don't seem to be using the -jN paramter"; echo
; fi
56 @for
dir in
$(DIRS
); do \
57 $(MAKE
) -C
$$dir all || exit
1; \
60 # Lipo is an OSX thing. If it is defined, it means we are building for universal,
61 # and so we have have to combine the binaries into one big binary
63 # Remove the last binary made by the last compiled target
64 $(Q
)rm -f
$(BIN_DIR
)/$(TTD
)
65 # Make all the binaries into one
66 $(Q
)$(LIPO
) -create
-output
$(BIN_DIR
)/$(TTD
) $(TTDS
)
70 @echo
"Available make commands:"
73 @echo
" all compile the executable and the lang files"
74 @echo
" lang compile the lang files only"
76 @echo
" clean remove the files generated during compilation"
77 @echo
" mrproper remove the files generated during configuration and compilation"
78 @echo
"Run after compilation:"
79 @echo
" run execute openttd after the compilation"
80 @echo
" run-gdb execute openttd in debug mode after the compilation"
81 @echo
" run-prof execute openttd in profiling mode after the compilation"
83 @echo
" install install the compiled files and the data-files after the compilation"
84 @echo
" bundle create the base for an installation bundle"
85 @echo
" bundle_zip create the zip installation bundle"
86 @echo
" bundle_gzip create the gzip installation bundle"
87 @echo
" bundle_bzip2 create the bzip2 installation bundle"
88 @echo
" bundle_lha create the lha installation bundle"
89 @echo
" bundle_dmg create the dmg installation bundle"
91 config.pwd
: $(CONFIG_CACHE_PWD
)
94 config.cache
: $(CONFIG_CACHE_SOURCE_LIST
) $(CONFIGURE_FILES
)
98 ifeq ($(shell if
test -f config.cache
; then echo
1; fi
), 1)
99 @echo
"----------------"
100 @echo
"The system detected that source.list or any configure file is altered."
101 @echo
" Going to reconfigure with last known settings..."
102 @echo
"----------------"
103 # Make sure we don't lock config.cache
104 @
$(shell cat config.cache | sed
's@\\ @\\\\ @g') || exit
1
105 @echo
"----------------"
106 @echo
"Reconfig done. Please re-execute make."
107 @echo
"----------------"
109 @echo
"----------------"
110 @echo
"Have not found a configuration, please run configure first."
111 @echo
"----------------"
116 @for
dir in
$(DIRS
); do \
117 $(MAKE
) -C
$$dir clean; \
119 $(Q
)rm -rf
$(BUNDLE_TARGET
)
122 @for
dir in
$(LANG_DIRS
); do \
123 $(MAKE
) -C
$$dir all; \
127 @for
dir in
$(DIRS
); do \
128 $(MAKE
) -C
$$dir mrproper
; \
129 rm -f
$$dir/Makefile
; \
132 $(Q
)rm -f Makefile Makefile.am Makefile.bundle
133 $(Q
)rm -f media
/openttd.desktop media
/openttd.desktop.
install
134 $(Q
)rm -f
$(CONFIG_CACHE_SOURCE_LIST
) config.cache config.pwd config.log
$(CONFIG_CACHE_PWD
)
135 # directories for bundle generation
136 $(Q
)rm -rf
$(BUNDLE_DIR
)
137 $(Q
)rm -rf
$(BUNDLES_DIR
)
138 # output of profiling
139 $(Q
)rm -f
$(BIN_DIR
)/gmon.out
140 # output of generating 'API' documentation
141 $(Q
)rm -f
$(ROOT_DIR
)/openttd.tag
142 $(Q
)rm -rf
$(ROOT_DIR
)/docs
/source
143 # output of generating AI API documentation
144 $(Q
)rm -f
$(SRC_DIR
)/ai
/api
/openttd.tag
145 $(Q
)rm -rf
$(ROOT_DIR
)/docs
/aidocs
146 # directories created by OpenTTD on regression testing
147 $(Q
)rm -rf
$(BIN_DIR
)/ai
/regression
/content_download
$(BIN_DIR
)/ai
/regression
/save
$(BIN_DIR
)/ai
/regression
/scenario
150 maintainer-clean
: distclean
151 $(Q
)rm -f
$(BIN_DIR
)/data
/openttd.grf
154 @for
dir in
$(SRC_DIRS
); do \
155 $(MAKE
) -C
$$dir depend
; \
159 $(Q
)cd
!!BIN_DIR
!! && .
/!!TTD
!! $(OPENTTD_ARGS
)
162 $(Q
)cd
!!BIN_DIR
!! && gdb
--ex run
--args .
/!!TTD
!! $(OPENTTD_ARGS
)
165 $(Q
)cd
!!BIN_DIR
!! && .
/!!TTD
!! $(OPENTTD_ARGS
) && gprof
!!TTD
!! | less
168 $(Q
)cd
!!BIN_DIR
!! && sh ai
/regression
/run.sh
172 @for
dir in
$(SRC_DIRS
); do \
173 $(MAKE
) -C
$$dir $(@
:src
/%=%); \
177 @for
dir in
$(LANG_DIRS
); do \
178 $(MAKE
) -C
$$dir $@
; \
181 .PHONY
: test distclean mrproper
clean
183 include Makefile.bundle