File: Makefile

package info (click to toggle)
castle-game-engine 5.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 185,428 kB
  • sloc: pascal: 260,781; cpp: 1,363; objc: 713; makefile: 537; xml: 496; sh: 480; php: 4
file content (238 lines) | stat: -rw-r--r-- 9,797 bytes parent folder | download
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
# 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, and also delete:
#     - Emacs backup files (*~) and
#     - Delphi backup files (*.~???)
#     - pasdoc generated documentation in doc/pasdoc/
#
#   cleanall --
#     Same as cleanmore for now.
#     Intention is to remove *everything* that can be manually recreated,
#     even if somewhat hard, and clean editor backup.

# compiling ------------------------------------------------------------

.PHONY: all
all:
	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

# 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_to_pas \
  examples/images_videos/image_compare \
  examples/images_videos/simple_video_editor \
  examples/fonts/test_font_break \
  examples/fonts/font_from_texture \
  examples/fonts/texturefont2pascal \
  examples/window/window_events \
  examples/window/window_menu \
  examples/window/window_gtk_mix \
  examples/window/multi_window \
  examples/curves_surfaces/bezier_surfaces/animate_surface \
  examples/curves_surfaces/bezier_surfaces/design_surface \
  examples/curves_surfaces/interpolated_curves \
  examples/space_filling_curve/draw_space_filling_curve \
  examples/radiance_transfer/radiance_transfer \
  examples/radiance_transfer/precompute_radiance_transfer \
  examples/radiance_transfer/show_sh \
  examples/shadow_fields/precompute_shadow_field \
  examples/shadow_fields/shadow_fields \
  examples/dynamic_ambient_occlusion/dynamic_ambient_occlusion \
  examples/terrain/terrain \
  examples/3d_rendering_processing/custom_3d_object \
  examples/3d_rendering_processing/triangulate_demo \
  examples/3d_rendering_processing/placeholder_names \
  examples/3d_rendering_processing/tools/gen_light_map \
  examples/3d_rendering_processing/tools/kanim_to_interpolators \
  examples/3d_rendering_processing/multiple_viewports \
  examples/3d_rendering_processing/fog_culling \
  examples/3d_rendering_processing/plane_mirror_and_shadow \
  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 \
  src/x3d/teapot/teapot_3d_to_pascal \
  src/x3d/nodes_specification/x3d_nodes_spec_to_pascal/x3d_nodes_spec_to_pascal \
  src/x3d/nodes_specification/generate_x3d_nodes_helpers/generate_x3d_nodes_to_pascal \
  examples/fixed_camera_game/rift \
  examples/isometric_game/sandbox \
  examples/images_videos/gaussian_write \
  examples/3d_sound_game/lets_take_a_walk \
  examples/3d_sound_game/data/levels/base/devel/process_base_b \
  examples/resource_animations/resource_animations \
  examples/fps_game/fps_game \
  examples/2d/controls_demo \
  examples/android/android_demo/androiddemo_standalone \
  tools/castle-engine

EXAMPLES_LAZARUS_BASE_NAMES := \
  examples/audio/test_al_source_allocator \
  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/lcl_dynlib_tester/cge_dynlib_tester

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

.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

# 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 '*.libimp*.a' -or \
			   -iname '*.apk' -or \
	                   -iname '*.dcu' -or -iname '*.dpu' -or \
			   -iname 'castleengine.dll' -or -iname 'libcastleengine.so' ')' \
	     -print \
	     | xargs rm -f
	find . -type d -name lib -exec rm -Rf '{}' ';' -prune
	rm -Rf packages/castle_base.pas \
	  packages/castle_window.pas \
	  packages/castle_components.pas \
	  packages/castle_android_utilities.pas \
	  packages/alternative_castle_window_based_on_lcl.pas \
	  tests/test_castle_game_engine tests/test_castle_game_engine.exe
# fpmake binary, and units/ produced by fpmake compilation
	rm -Rf fpmake fpmake.exe units/
# lazarus produces lib/ subdirectories during compilation
	find examples/ -type d -name lib -prune -exec rm -Rf '{}' ';'
# 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 '*.blend1' \
			')' -exec rm -f '{}' ';'
	$(MAKE) -C doc/pasdoc/ clean

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.

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 ------------------------------------------------------------