1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359
|
# Most useful targets:
#
# all (default target) --
# Compile all units, uses fpmake.
#
# examples --
# Compile examples and tools (inside examples/ subdirectory).
# This compilation method uses our xxx_compile.sh Unix scripts,
# and requires only pure FPC installation.
# Lazarus is not required (LCL dependent examples are not compiled).
# Note that you can also compile each example separately,
# just execute directly appropriate xxx_compile.sh scripts.
#
# examples-laz --
# Compile examples and tools (inside examples/ subdirectory).
# This compilation method uses our .lpi project files,
# and compiles every program by the lazbuild utility.
# Lazarus and FPC installation is required, and Lazarus must know
# about the castle_* packages (compile them from Lazarus first).
#
# clean --
# Delete FPC 1.0.x Windows trash (*.ppw, *.ow), FPC trash, Delphi trash,
# Lazarus trash (*.compiled),
# binaries of example programs,
# also FPC compiled trash in packages/*/lib/.
#
# Not-so-commonly-useful targets:
#
# cleanmore --
# Same as clean, but also delete:
# - Emacs backup files (*~) and
# - Delphi backup files (*.~???)
# - pasdoc generated documentation in doc/pasdoc/ and doc/reference/
# - closed-source libs you may have left in tools/build-tool/data
# - QtCreator *.pro.user
# This is a useful step when packing the release of CGE.
#
# cleanall --
# Same as cleanmore for now.
# Intention is to remove *everything* that can be manually recreated,
# even if somewhat hard, and clean editor backup.
# Hack for Cygwin, to avoid using Windows built-in "find" program.
#FIND:=/bin/find
FIND:=find
# compile ------------------------------------------------------------
.PHONY: all
all:
$(MAKE) --no-print-directory build-using-fpmake
tools/texture-font-to-pascal/texture-font-to-pascal_compile.sh
tools/image-to-pascal/image-to-pascal_compile.sh
tools/castle-curves/castle-curves_compile.sh
tools/build-tool/castle-engine_compile.sh
tools/sprite-sheet-to-x3d/sprite-sheet-to-x3d_compile.sh
.PHONY: build-using-fpmake
build-using-fpmake:
fpc fpmake.pp
@echo 'Running fpmake. If this fails saying that "rtl" is not found, remember to set FPCDIR environment variable, see http://wiki.freepascal.org/FPMake .'
# Workaround FPC >= 3.x problem (bug?) --- it ignores $FPCDIR, but --globalunitdir works
if [ '(' -n "$(FPCDIR)" ')' -a \
'(' $(shell fpc -iV) '!=' '2.6.4' ')' -a \
'(' $(shell fpc -iV) '!=' '2.6.2' ')' ]; then \
./fpmake --globalunitdir="$(FPCDIR)" -v -o -Ur; \
else \
./fpmake -v -o -Ur; \
fi
# install / uninstall --------------------------------------------------------
#
# Note that this *does not* take care of installing the unit files.
# So it does not copy .ppu/.o files, it does not change your /etc/fpc.cfg
# or ~/.fpc.cfg. There are many ways how to install unit files,
# we leave this step up to you.
# See http://castle-engine.sourceforge.net/engine.php for documentation.
#
# Below we only take care of installing the tools.
# By default they are installed system-wide to /usr/local ,
# so you can run "make" followed by "sudo make install" to have the tools
# ready on a typical Unix system.
# Standard installation dirs, following conventions on
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html#Directory-Variables
PREFIX=$(DESTDIR)/usr/local
EXEC_PREFIX=$(PREFIX)
BINDIR=$(EXEC_PREFIX)/bin
DATAROOTDIR=$(PREFIX)/share
DATADIR=$(DATAROOTDIR)
.PHONY: install
install:
install -d $(BINDIR)
install tools/texture-font-to-pascal/texture-font-to-pascal $(BINDIR)
install tools/image-to-pascal/image-to-pascal $(BINDIR)
install tools/castle-curves/castle-curves $(BINDIR)
install tools/build-tool/castle-engine $(BINDIR)
install tools/sprite-sheet-to-x3d/sprite-sheet-to-x3d $(BINDIR)
# cp -R tools/build-tool/data $(DATADIR)/castle-engine
install -d $(DATADIR)
cd tools/build-tool/data/ && \
$(FIND) . -type f -exec install --mode 644 -D '{}' $(DATADIR)/castle-engine/'{}' ';'
.PHONY: uninstall
uninstall:
rm -f $(BINDIR)/texture-font-to-pascal \
$(BINDIR)/image-to-pascal \
$(BINDIR)/castle-curves \
$(BINDIR)/castle-engine \
$(BINDIR)/sprite-sheet-to-x3d
rm -Rf $(DATADIR)/castle-engine
# Strip libraries that cannot be distributed in Debian package of CGE.
# - Some of them (some bundled Windows, Android libs) cannot be recompiled
# automatically and easily for now (although they are open-source),
# and are not of sufficient interest to the Debian users.
# - Some (Gradle) should be better used by depending on
# the appropriate Debian package.
.PHONY: strip-precompiled-libraries
strip-precompiled-libraries:
rm -Rf tools/build-tool/data/external_libraries/ \
tools/build-tool/data/android/integrated-services/sound/ \
tools/build-tool/data/android/integrated-services/ogg_vorbis/ \
tools/build-tool/data/android/base/gradle/ \
tools/build-tool/data/android/base/gradlew \
tools/build-tool/data/android/base/gradlew.bat \
tools/build-tool/data/android/integrated/gradle/ \
tools/build-tool/data/android/integrated/gradlew \
tools/build-tool/data/android/integrated/gradlew.bat
# examples and tools -----------------------------------------------------------
# Note that images/examples/fft_tests is not included here,
# and unit images/imagesfftw.pas is not included in fpmake.pp,
# because
# 1. it requires to compile FPC > 2.2.x, and we try to work also with earlier FPC.
# 2. to link the example, you need the fftw library. I don't want
# to force everyone who wants to execute "make examples" to install
# fftw library (especially since it's really not needed by my engine,
# currently my fftw code is just for testing, it's not actually used
# by our engine or any game for anything).
EXAMPLES_BASE_NAMES := \
examples/audio/algets \
examples/audio/alplay \
examples/audio/doppler_demo \
examples/audio/efx_demo \
examples/tools/dircleaner \
examples/tools/stringoper \
examples/tools/castle_download \
examples/tools/to_data_uri \
examples/castlescript/castle_calculator \
examples/castlescript/image_make_by_script \
examples/images_videos/image_convert \
examples/images_videos/dds_decompose \
examples/images_videos/image_identify \
examples/images_videos/image_paint \
examples/images_videos/image_compare \
examples/images_videos/simple_video_editor \
examples/images_videos/drawing_modes_test \
examples/joystick/joystick_demo \
examples/fonts/test_font_break \
examples/fonts/font_from_texture \
examples/fonts/test_local_characters/test_local_characters \
examples/fonts/html_text \
examples/fonts/font_draw_over_image \
examples/tiled/tiled_demo_standalone \
examples/window/window_events \
examples/window/window_menu \
examples/window/window_gtk_mix \
examples/window/multi_window \
examples/curves/simplest_curve_read \
examples/space_filling_curve/draw_space_filling_curve \
examples/research_special_rendering_methods/radiance_transfer/radiance_transfer \
examples/research_special_rendering_methods/radiance_transfer/precompute_radiance_transfer \
examples/research_special_rendering_methods/radiance_transfer/show_sh \
examples/research_special_rendering_methods/dynamic_ambient_occlusion/dynamic_ambient_occlusion \
examples/terrain/terrain \
examples/3d_rendering_processing/triangulate_demo \
examples/3d_rendering_processing/placeholder_names \
examples/3d_rendering_processing/multiple_viewports \
examples/3d_rendering_processing/fog_culling \
examples/3d_rendering_processing/animate_3d_model_by_code \
examples/3d_rendering_processing/animate_3d_model_by_code_2 \
examples/3d_rendering_processing/call_pascal_code_from_3d_model_script \
examples/3d_rendering_processing/view_3d_model_advanced \
examples/3d_rendering_processing/scene_manager_demos \
examples/3d_rendering_processing/view_3d_model_basic \
examples/3d_rendering_processing/build_3d_object_by_code \
examples/3d_rendering_processing/build_3d_tunnel \
examples/3d_rendering_processing/combine_multiple_x3d_into_one \
examples/3d_rendering_processing/display_box_custom_shaders \
examples/3d_rendering_processing/listen_on_x3d_events \
examples/3d_rendering_processing/cars_demo \
examples/3d_rendering_processing/render_3d_to_texture_and_use_as_quad \
src/x3d/teapot/teapot_3d_to_pascal \
src/x3d/nodes_specification/x3d-nodes-to-pascal/x3d-nodes-to-pascal \
examples/3d_sound_game/lets_take_a_walk \
examples/resource_animations/resource_animations \
examples/fps_game/fps_game \
examples/2d_standard_ui/show_various_ui_controls/show_various_ui_controls \
examples/2d_standard_ui/edit_test/edit_test \
examples/2d_standard_ui/timer_test/timer_test \
examples/2d_standard_ui/zombie_fighter/zombie_fighter \
examples/mobile/simple_3d_demo/simple_3d_demo_standalone \
tools/image-to-pascal/image-to-pascal \
tools/texture-font-to-pascal/texture-font-to-pascal \
tools/castle-curves/castle-curves \
tools/sprite-sheet-to-x3d/sprite-sheet-to-x3d \
examples/random_generator/globalrandom \
examples/random_generator/random_speed_test \
examples/random_generator/random_threads_test
EXAMPLES_LAZARUS_BASE_NAMES := \
examples/audio/test_al_source_allocator \
examples/audio/audio_player_scrubber/audio_player_scrubber \
examples/lazarus/model_3d_viewer/model_3d_viewer \
examples/lazarus/model_3d_with_2d_controls/model_3d_with_2d_controls \
examples/lazarus/load_model_and_camera_manually/load_model_and_camera_manually \
examples/lazarus/two_controls/two_controls \
tests/test_castle_game_engine \
src/library/castleengine \
examples/library/lazarus_library_tester/cge_dynlib_tester \
examples/random_generator/graphics_random_test \
tools/build-tool/code/castle-engine
EXAMPLES_UNIX_EXECUTABLES := $(EXAMPLES_BASE_NAMES) \
$(EXAMPLES_LAZARUS_BASE_NAMES)
EXAMPLES_WINDOWS_EXECUTABLES := $(addsuffix .exe,$(EXAMPLES_BASE_NAMES)) \
$(addsuffix .exe,$(EXAMPLES_LAZARUS_BASE_NAMES))
EXAMPLES_MACOSX_APPS := $(addsuffix .app,$(EXAMPLES_BASE_NAMES)) \
$(addsuffix .app,$(EXAMPLES_LAZARUS_BASE_NAMES))
EXAMPLES_RES_FILES := $(addsuffix .res,$(EXAMPLES_BASE_NAMES)) \
$(addsuffix .res,$(EXAMPLES_LAZARUS_BASE_NAMES))
.PHONY: examples
examples:
$(foreach NAME,$(EXAMPLES_BASE_NAMES),$(NAME)_compile.sh && ) true
# compile all examples with CastleEngineManifest.xml inside
$(FIND) . -iname CastleEngineManifest.xml -execdir castle-engine $(CASTLE_ENGINE_TOOL_OPTIONS) compile ';'
.PHONY: examples-ignore-errors
examples-ignore-errors:
$(foreach NAME,$(EXAMPLES_BASE_NAMES),$(NAME)_compile.sh ; ) true
.PHONY: cleanexamples
cleanexamples:
rm -f $(EXAMPLES_UNIX_EXECUTABLES) $(EXAMPLES_WINDOWS_EXECUTABLES) $(EXAMPLES_RES_FILES)
rm -Rf $(EXAMPLES_MACOSX_APPS)
.PHONY: examples-laz
examples-laz:
lazbuild packages/castle_base.lpk
lazbuild packages/castle_window.lpk
lazbuild packages/castle_components.lpk
$(foreach NAME,$(EXAMPLES_BASE_NAMES) $(EXAMPLES_LAZARUS_BASE_NAMES),lazbuild $(NAME).lpi && ) true
# Compile only Lazarus-specific examples (that depend on LCL)
.PHONY: examples-only-laz
examples-only-laz:
lazbuild packages/castle_base.lpk
lazbuild packages/castle_window.lpk
lazbuild packages/castle_components.lpk
$(foreach NAME,$(EXAMPLES_LAZARUS_BASE_NAMES),lazbuild $(NAME).lpi && ) true
# cleaning ------------------------------------------------------------
.PHONY: clean cleanmore cleanall
clean: cleanexamples
$(FIND) . -type f '(' -iname '*.ow' -or -iname '*.ppw' -or -iname '*.aw' -or \
-iname '*.o' -or -iname '*.ppu' -or -iname '*.a' -or \
-iname '*.or' -or \
-iname '*.rsj' -or \
-iname '*.compiled' -or \
-iname '*.lps' -or \
-iname '*.libimp*.a' -or \
-iname '*.apk' -or \
-iname '*.dcu' -or -iname '*.dpu' -or \
-iname '*.log' ')' \
-print \
| xargs rm -f
$(FIND) . -type d '(' -name 'lib' -or \
-name 'castle-engine-output' ')' \
-exec rm -Rf '{}' ';' -prune
rm -Rf packages/castle_base.pas \
packages/castle_window.pas \
packages/castle_components.pas \
packages/alternative_castle_window_based_on_lcl.pas \
tests/test_castle_game_engine \
tests/test_castle_game_engine.exe \
examples/mobile/drawing_toy/drawing_toy \
examples/mobile/drawing_toy/drawing_toy.exe \
examples/portable_game_skeleton/my_fantastic_game \
examples/portable_game_skeleton/my_fantastic_game.exe \
examples/fonts/font_draw_over_image_output.png
$(MAKE) -C doc/man/man1/ clean
# fpmake binary, and units/ produced by fpmake compilation
rm -Rf fpmake fpmake.exe units/ *.fpm
# lazarus produces lib/ subdirectories during compilation
$(FIND) examples/ -type d -name lib -prune -exec rm -Rf '{}' ';'
rm -Rf src/library/ios-output/\
src/library/libcastleengine.dylib \
src/library/castleengine.dll \
src/library/libcastleengine.so
# clean every project with CastleEngineManifest.xml
$(FIND) . -iname CastleEngineManifest.xml -execdir castle-engine clean ';'
cleanmore: clean
$(FIND) . -type f '(' -iname '*~' -or \
-iname '*.bak' -or \
-iname '*.~???' -or \
-iname '*.pro.user' -or \
-iname '*.blend1' \
')' -exec rm -f '{}' ';'
$(FIND) . -type d '(' -iname 'backup' \
')' -exec rm -Rf '{}' ';' -prune
$(MAKE) -C doc/pasdoc/ clean
rm -Rf tools/build-tool/data/android/integrated-services/giftiz/app/libs/*.jar \
tools/build-tool/data/android/integrated-services/chartboost/app/libs/*.jar \
tools/build-tool/data/android/integrated-services/heyzap/app/libs/*.jar \
tools/build-tool/data/android/integrated-services/startapp/app/libs/*.jar \
tools/build-tool/data/ios/services/game_analytics/cge_project_name/game_analytics/GameAnalytics.h \
tools/build-tool/data/ios/services/game_analytics/cge_project_name/game_analytics/libGameAnalytics.a
cleanall: cleanmore
# Clean compiled versions of CastleWindow unit.
# Makes sure that unit CastleWindow will be *always* *rebuild* in next compilation.
#
# This is useful, since CastleWindow unit may be compiled with various
# back-ends (e.g. under Unices two most useful back-ends
# are XLIB and GTK). To make sure that compilation of some program
# will produce exactly what you need, it's useful to force rebuild of CastleWindow.
#
# Of course this means that compilation time will suffer a little,
# since CastleWindow unit will be possibly rebuild without any real need.
clean-window:
rm -f src/window/castlewindow.o \
src/window/castlewindow.ppu \
src/window/CastleWindow.o \
src/window/CastleWindow.ppu
# ----------------------------------------
# Set SVN tag.
# Don't use anymore, we use GIT now.
# svntag:
# source ../www/pack/generated_versions.sh && \
# svn copy https://svn.code.sf.net/p/castle-engine/code/trunk/castle_game_engine \
# https://svn.code.sf.net/p/castle-engine/code/tags/castle_game_engine/"$$GENERATED_VERSION_CASTLE_GAME_ENGINE" \
# -m "Tagging the $$GENERATED_VERSION_CASTLE_GAME_ENGINE version of 'Castle Game Engine'."
# eof ------------------------------------------------------------
|