-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
383 lines (325 loc) · 14.1 KB
/
Makefile
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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
GNATCHECK=$(shell gnat --version)
GPRCHECK=$(shell gprbuild --version)
TARGET=$(shell gcc -dumpmachine)
CWD=$(CURDIR)
PREFIX=$(CWD)/inst_folder
# Specify build mode "Debug", "Release" or "Profile"
BUILD_MODE=Debug
ifeq ($(strip $(findstring GPRBUILD, $(GPRCHECK))),GPRBUILD)
BUILDER=gprbuild -p
INSTALLER=gprinstall -p -f
CLEANER=gprclean
PRETTY_PRINTER=gnatpp
STUDIO=gnatstudio
GNATDOC=gnatdoc
else
BUILDER=gnatmake -p
INSTALLER=gprinstall -p -f
CLEANER=gnatclean
PRETTY_PRINTER=gnatpp
STUDIO=gnatstudio
GNATDOC=gnatdoc
endif
# If using MinGW on Cygwin32 or 64 you can use the following:
#
# For 32bit
#BUILDER=i686-w64-ming32-gnatmake.exe
#CLEANER=i686-w64-ming32-gnatclean.exe
#
# For 64bit
#BUILDER=x86_64-w64-mingw32-gnatmake.exe
#CLEANER=x86_64-w64-mingw32-gnatclean.exe
ifeq ($(strip $(findstring darwin, $(TARGET))),darwin)
PRJ_TARGET=OSX
else
ifeq ($(strip $(findstring mingw32, $(TARGET))),mingw32)
PRJ_TARGET=Windows
else
ifeq ($(strip $(findstring cygwin, $(TARGET))),cygwin)
PRJ_TARGET=Windows
else
ifeq ($(strip $(findstring windows, $(TARGET))),windows)
PRJ_TARGET=Windows
else
ifeq ($(strip $(findstring freebsd, $(TARGET))),freebsd)
PRJ_TARGET=FreeBSD
else
ifeq ($(strip $(findstring linux, $(TARGET))),linux)
PRJ_TARGET=Linux
else
PRJ_TARGET=UNIX
endif
endif
endif
endif
endif
endif
ifeq ($(strip $(findstring x86, $(TARGET))),x86)
PRJ_ARCH=x86_64
else
ifeq ($(strip $(findstring i686, $(TARGET))),i686)
PRJ_ARCH=i686
else
PRJ_ARCH=auto
endif
endif
ifeq ($(shell echo "check_quotes"),"check_quotes")
BUILD_OS := Windows
else
BUILD_OS := UnixLike
endif
ifeq ($(BUILD_OS),Windows)
COPY=copy
MOVE=move
MKDIR=mkdir
RM=del
RMS=del /S /Q
PATHSEP=\\
BUILD_SQLITE3=sqlite3
else
COPY=cp -p
MOVE=mv
MKDIR=mkdir -p
RM=rm -f
RMS=rm -rf
PATHSEP=/
BUILD_SQLITE3=
endif
help :
@echo "-----------------------------------------------------------------------------"
@echo "-- --"
@echo "-- Usage: make <entry> --"
@echo "-- --"
@echo "-- <entry> ::= help -- print this message --"
@echo "-- | all -- build gnoga with demos and all dependencies --"
@echo "-- | install -- install gnoga --"
@echo "-- | uninstall -- uninstall gnoga --"
@echo "-- | demo -- build all demos --"
@echo "-- | tutorials -- build all tutorials --"
@echo "-- | gnoga_tools -- build all tools --"
@echo "-- | tests -- build all tests --"
@echo "-- | clean -- clean build files --"
@echo "-- | clean_all -- clean build files and deps --"
@echo "-- | rm-docs -- build reference manual --"
@echo "-- | html-docs -- build html docs --"
@echo "-- | studio -- launch GNAT Studio with gnoga environnement --"
@echo "-- | check_rules -- check gnoga with AdaControl --"
@echo "-- | gnoga-config -- create script with gnoga compilation options --"
@echo "-- --"
@echo "-- Configurable variables: --"
@echo "-- --"
@echo "-- PREFIX = $(PREFIX)"
@echo "-- GNATCHECK = $(GNATCHECK)"
@echo "-- GPRCHECK = $(GPRCHECK)"
@echo "-- TARGET = $(TARGET)"
@echo "-- BUILDER = $(BUILDER)"
@echo "-- PRJ_TARGET = $(PRJ_TARGET)"
@echo "-- PRJ_ARCH = $(PRJ_ARCH)"
@echo "-- BUILD_OS = $(BUILD_OS)"
@echo "-- BUILD_MODE = $(BUILD_MODE)"
@echo "-- --"
@echo "-----------------------------------------------------------------------------"
SC_OPTIONS=-Xarch=${PRJ_ARCH} -XSC_OS=${PRJ_TARGET} -XDevelopment=${BUILD_MODE}
GN_OPTIONS=-XPRJ_BUILD=${BUILD_MODE} -XPRJ_TARGET=${PRJ_TARGET} ${SC_OPTIONS}
ifeq ($(PRJ_TARGET),Windows)
ZB_MAKE=BUILD=$(subst Release,Production,${BUILD_MODE}) OS=Windows_NT
ZB_OPTIONS=-XBUILD=$(subst Release,Production,${BUILD_MODE}) -XOS=Windows_NT
else
ZB_MAKE=BUILD=$(subst Release,Production,${BUILD_MODE}) OS=unix
ZB_OPTIONS=-XBUILD=$(subst Release,Production,${BUILD_MODE}) -XOS=unix
endif
all: deps $(BUILD_SQLITE3) basic_components gnoga gnoga_tools demo tutorials
basic_components:
$(MAKE) -C components
# Mandatory dependances for Gnoga and demos
deps : simple_components uxstrings zanyblue
simple_components:
$(BUILDER) -P deps/simple_components/lib_components.gpr $(SC_OPTIONS)
sqlite3:
- $(MKDIR) lib
cd deps/simple_components/sqlite-sources && gcc -s -c -O2 -o sqlite3.o sqlite3.c
cd deps/simple_components/sqlite-sources && ar rcs libsqlite3.a sqlite3.o
cd deps/simple_components/sqlite-sources && $(MOVE) libsqlite3.a ..$(PATHSEP)..$(PATHSEP)..$(PATHSEP)lib
cd deps/simple_components/sqlite-sources && $(RM) sqlite3.o
zanyblue:
- cd deps/zanyblue/src && "$(MAKE)" $(ZB_MAKE) APPDIRS="zbmcompile zbinfo"
uxstrings:
$(BUILDER) -P deps/uxstrings/lib_uxstrings.gpr
native_gtk: src/gnoga_gtk_window.c
cd obj && gcc -c ../src/gnoga_gtk_window.c `pkg-config --cflags gtk+-3.0,webkit2gtk-3.0`
native_osx:
- cd deps && git clone https://github.com/MacGapProject/MacGap2.git
@echo
@echo "Native XCode project is now in deps/MacGap2"
@echo "See docs/native_mac_apps.md for instructions"
electron:
@echo "Please insure that Node.js - npm is installed and on path."
@echo
- cd deps && git clone https://github.com/atom/electron-quick-start
- cd deps/electron-quick-start && npm install
$(COPY) html$(PATHSEP)electron.html deps$(PATHSEP)electron-quick-start$(PATHSEP)index.html
$(COPY) js$(PATHSEP)electron_boot.js deps$(PATHSEP)electron-quick-start
$(COPY) js$(PATHSEP)jquery.min.js deps$(PATHSEP)electron-quick-start
@echo
@echo "Native desktop using electron is now in deps/electron-quick-start"
@echo "The example is set to connect to any running gnoga app on localhost:8080"
@echo "Start your gnoga app and then run 'nmp start' in deps/electron-quick-start"
@echo "See docs/native_desktop_apps.md for instructions on full desktop development"
.IGNORE: bin/multimarkdown
bin/multimarkdown:
cd deps && git clone https://github.com/fletcher/MultiMarkdown-4.git
cd deps/MultiMarkdown-4 && git submodule init
cd deps/MultiMarkdown-4 && git submodule update
cd deps/MultiMarkdown-4 && "$(MAKE)"
$(MKDIR) bin
$(MOVE) deps/MultiMarkdown-4/multimarkdown bin/
gnoga:
$(BUILDER) -P src/gnoga.gpr $(GN_OPTIONS)
gnoga_secure:
$(BUILDER) -P ssl/gnoga_secure.gpr $(GN_OPTIONS)
gnoga_tools:
$(BUILDER) -P tools/tools_agg.gpr $(GN_OPTIONS)
# Install Gnoga and deps
install: install_deps install_gnoga
# Install deps
install_deps: deps $(BUILD_SQLITE3)
$(INSTALLER) --prefix="$(PREFIX)" --install-name=components deps/simple_components/lib_components.gpr $(SC_OPTIONS)
- $(COPY) lib$(PATHSEP)libsqlite3.a "$(PREFIX)$(PATHSEP)lib"
- $(MAKE) -C deps/zanyblue/src $(ZB_MAKE) INSTALL_DIR="$(PREFIX)" install
$(INSTALLER) --prefix="$(PREFIX)" --install-name=uxstrings deps/uxstrings/lib_uxstrings.gpr
# Install Gnoga without deps
install_gnoga: basic_components gnoga gnoga_tools
$(INSTALLER) --prefix="$(PREFIX)" --install-name=gnoga src/gnoga.gpr $(GN_OPTIONS)
$(INSTALLER) --prefix="$(PREFIX)" --install-name=gnoga --mode=usage tools/tools_agg.gpr $(GN_OPTIONS)
$(MAKE) -C components INSTALL_DIR="$(PREFIX)"/share/gnoga
# Build and install Gnoga standalone with deps already installed in PREFIX
install_gnoga_sa:
$(BUILDER) -P gpr_sa/gnoga.gpr $(GN_OPTIONS) -aP "$(PREFIX)"/share/gpr
GPR_PROJECT_PATH="$(PREFIX)"/share/gpr $(GNATDOC) -P gpr_sa/gnoga.gpr --enable-build --no-subprojects $(GN_OPTIONS)
$(INSTALLER) --prefix="$(PREFIX)" --install-name=gnoga gpr_sa/gnoga.gpr $(GN_OPTIONS) -aP "$(PREFIX)"/share/gpr
$(BUILDER) -P tools/tools_agg_ext.gpr $(GN_OPTIONS) -XPREFIX="$(PREFIX)"
$(INSTALLER) --prefix="$(PREFIX)" --install-name=gnoga --mode=usage tools/tools_agg_ext.gpr $(GN_OPTIONS) -XPREFIX="$(PREFIX)"
$(MAKE) -C components INSTALL_DIR="$(PREFIX)"/share/gnoga
.IGNORE: uninstall
uninstall:
$(INSTALLER) --prefix="$(PREFIX)" --install-name=components --uninstall lib_components.gpr
$(INSTALLER) --prefix="$(PREFIX)" --install-name=uxstrings --uninstall lib_uxstrings.gpr
$(INSTALLER) --prefix="$(PREFIX)" --install-name=gnoga --uninstall gnoga.gpr
$(MAKE) -C deps/zanyblue/src INSTALL_DIR="$(PREFIX)" uninstall
$(RM) -fr "$(PREFIX)"/share/gnoga
demo: snake mine_detector connect_four chattanooga adaedit adablog linxtris random_int adaothello tic_tac_toe leaves logo localize
snake:
$(BUILDER) -P demo/demo_agg.gpr $@-main $(GN_OPTIONS)
mine_detector:
$(BUILDER) -P demo/demo_agg.gpr $@ $(GN_OPTIONS)
chattanooga:
$(COPY) demo$(PATHSEP)chattanooga$(PATHSEP)glass.ogg html
$(BUILDER) -P demo/demo_agg.gpr $@-program $(GN_OPTIONS)
adaedit:
$(BUILDER) -P demo/demo_agg.gpr $@ $(GN_OPTIONS)
adablog:
$(COPY) demo$(PATHSEP)adablog$(PATHSEP)adablog.css css
- $(BUILDER) -P demo/demo_agg.gpr $@-main $(GN_OPTIONS)
connect_four: zanyblue
- cd demo/connect_four && ..$(PATHSEP)..$(PATHSEP)deps$(PATHSEP)zanyblue$(PATHSEP)bin$(PATHSEP)zbmcompile -i -v -G strings connectfour_messages connectfour
$(BUILDER) -P demo/demo_agg.gpr $@ $(GN_OPTIONS) $(ZB_OPTIONS)
linxtris:
$(BUILDER) -P demo/demo_agg.gpr $@ $(GN_OPTIONS)
@echo "usage: bin/linxtris -data_dir demo/linxtris/"
random_int:
$(BUILDER) -P demo/demo_agg.gpr $@-program $(GN_OPTIONS)
adaothello:
$(BUILDER) -P demo/demo_agg.gpr othello_game $(GN_OPTIONS)
tic_tac_toe:
$(BUILDER) -P demo/demo_agg.gpr $@-program $(GN_OPTIONS)
leaves:
$(COPY) demo$(PATHSEP)leaves$(PATHSEP)img$(PATHSEP)*.png img
$(COPY) demo$(PATHSEP)leaves$(PATHSEP)img$(PATHSEP)*.jpg img
$(BUILDER) -P demo/demo_agg.gpr $@_main $(GN_OPTIONS)
logo: zanyblue
$(COPY) demo$(PATHSEP)logo$(PATHSEP)*.png img
- cd demo$(PATHSEP)logo && ..$(PATHSEP)..$(PATHSEP)deps$(PATHSEP)zanyblue$(PATHSEP)bin$(PATHSEP)zbmcompile -i -v -G strings logo_messages logo
$(BUILDER) -P demo/demo_agg.gpr $@-main $(GN_OPTIONS) $(ZB_OPTIONS)
localize:
# - cd demo$(PATHSEP)localize && ..$(PATHSEP)..$(PATHSEP)deps$(PATHSEP)zanyblue$(PATHSEP)bin$(PATHSEP)zbmcompile -i -v -G strings localize_messages localize
$(BUILDER) -P demo/demo_agg.gpr $@-main $(GN_OPTIONS) $(ZB_OPTIONS)
tests:
- $(BUILDER) -k -P test/test_agg.gpr $(GN_OPTIONS)
tests-%:
- $(BUILDER) -k -P test/test_agg.gpr $(subst tests-,,$@) $(GN_OPTIONS)
tests_ssl: gnoga_secure
- $(BUILDER) -P test_ssl/test_ssl.gpr $(GN_OPTIONS)
tutorials:
- $(BUILDER) -P tutorial/tutorial_agg.gpr $(GN_OPTIONS)
.IGNORE: clean_all
clean_all: clean clean_deps
$(MAKE) -C components uninstall
$(RMS) css
$(RMS) html
$(RMS) img
$(RMS) js
$(RMS) upload
$(RM) docs$(PATHSEP)html$(PATHSEP)*.html
$(RMS) docs$(PATHSEP)html$(PATHSEP)gnoga_rm
.IGNORE: clean_deps
clean_deps:
$(CLEANER) -P deps/simple_components/lib_components.gpr
$(CLEANER) -P deps/uxstrings/lib_uxstrings.gpr
cd deps/zanyblue && "$(MAKE)" -C src clean
$(RMS) deps$(PATHSEP)MultiMarkdown-4
$(RMS) deps$(PATHSEP)electron-quick-start
$(RM) bin$(PATHSEP)multimarkdown
$(RM) lib$(PATHSEP)libsqlite3.a
.IGNORE: clean
clean: clean_demo clean_tutorials clean_tests
$(CLEANER) -P src/gnoga.gpr
$(CLEANER) -P ssl/gnoga_secure.gpr
$(CLEANER) -P tools/tools_agg.gpr
$(RM) bin$(PATHSEP)*.db
$(RM) bin$(PATHSEP)temp.txt
$(RM) obj$(PATHSEP)gnoga_gtk_window.o
.IGNORE: clean_demo
clean_demo:
$(CLEANER) -P demo/demo_agg.gpr
.IGNORE: clean_tutorials
clean_tutorials:
$(CLEANER) -P tutorial/tutorial_agg.gpr
.IGNORE: clean_tests
clean_tests:
$(CLEANER) -P test/test_agg.gpr
rm-docs: gnoga
$(GNATDOC) -P src/gnoga.gpr --enable-build --no-subprojects $(GN_OPTIONS)
html-docs: bin/multimarkdown
cd docs && ../bin/multimarkdown user_guide.md > html/user_guide.html
cd docs && ../bin/multimarkdown api_summary.md > html/api_summary.html
cd docs && ../bin/multimarkdown native_mac_apps.md > html/native_mac_apps.html
cd docs && ../bin/multimarkdown native_gtk_apps.md > html/native_gtk_apps.html
studio:
ifeq ($(BUILD_OS),Windows)
cmd /C start /B $(STUDIO) -P $(CWD)/src/gnoga.gpr $(GN_OPTIONS) $(ZB_OPTIONS)
else
$(STUDIO) -P $(CWD)/src/gnoga.gpr $(GN_OPTIONS) $(ZB_OPTIONS) &
endif
# Use AdaControl to check rules/gnoga.aru
# Make sure AdaControl utilities are in your PATH
# https://sourceforge.net/projects/adacontrol
check_rules:
$(BUILDER) -c -f -P src/gnoga.gpr -gnatct $(GN_OPTIONS)
adactl -f rules/gnoga.aru -p src/gnoga.gpr @rules/gnoga.txt -s -S 3 -- -FT -Tobj
gnoga-config:
ifeq ($(BUILD_OS),Windows)
- $(MKDIR) bin
echo %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9 $(GN_OPTIONS) $(ZB_OPTIONS) -aP$(CWD)$(PATHSEP)src -aP$(CWD)$(PATHSEP)deps$(PATHSEP)zanyblue$(PATHSEP)src > bin$(PATHSEP)gnoga-config.cmd
else
- $(MKDIR) bin
echo echo $(GN_OPTIONS) $(ZB_OPTIONS) -aP$(CWD)$(PATHSEP)src -aP$(CWD)$(PATHSEP)deps$(PATHSEP)zanyblue$(PATHSEP)src > bin$(PATHSEP)gnoga-config
chmod +x bin$(PATHSEP)gnoga-config
endif
pretty_print_gnoga:
$(PRETTY_PRINTER) --no-subprojects -P src/gnoga.gpr $(GN_OPTIONS)
pretty_print_test:
GPR_PROJECT_PATH=$(CWD)$(PATHSEP)src $(PRETTY_PRINTER) --no-subprojects -P test/test.gpr $(GN_OPTIONS)
pretty_print_demo:
for i in snake mine_detector connect_four chattanooga adaedit adablog linxtris random_int adaothello tic_tac_toe leaves logo localize; do (GPR_PROJECT_PATH=$(CWD)$(PATHSEP)src:$(CWD)$(PATHSEP)deps$(PATHSEP)zanyblue$(PATHSEP)src $(PRETTY_PRINTER) --no-subprojects -P demo/$$i/$$i.gpr $(GN_OPTIONS)); done
pretty_print_tutorial:
for i in 01 02 03 04 05 06 07 08 09 10 11; do (GPR_PROJECT_PATH=$(CWD)$(PATHSEP)src:$(CWD)$(PATHSEP)deps$(PATHSEP)zanyblue$(PATHSEP)src $(PRETTY_PRINTER) --no-subprojects -P tutorial/tutorial-$$i/tutorial_$$i.gpr $(GN_OPTIONS)); done