-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathMakefile
729 lines (589 loc) · 27.3 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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
# Makefile: build libS52.so and others for various scenarios (openev plugin)
#
# SD AUG2004
# SD FEB2008 - clean up, fix some deps
# SD JUL2008 - move test stuff
# SD JUL2008 - add pkg-config
# SD JAN2009 - mod clean up
# SD JUN2009 - fix s52gv
# SD FEB2010 - fix s52gv2 (now default)
# SD 2011NOV08 - add s52eglarm (android)
# SD 2012NOV04 - add Parson lib (simple JSON parser) to handle SOCK stream
# SD 2012NOV05 - move sduc-git.txt note inside Makefile (bottom)
# SD 2013AUG31 - add s52gtk3egl
# SD 2014FEB11 - add s52eglw32, s52gtk2egl
.POSIX:
# FIXME: add target test/*
.PHONY: clean distclean
#------------------------------------------------------------------------------
# Makefile optimization tricks
# Disable all built-in rules for performance
.SUFFIXES:
# Build with a single shell for all commands
.ONESHELL:
#------------------------------------------------------------------------------
##### TARGETS #########
#all: s52glx # OGR & GLX & GL 1.1 & GLU
#all: s52eglx # OGR & EGL & X11 (for testing EGL/GLES2 on X)
#all: s52eglarm # OGR & EGL & ARM (for testing EGL/GLES2 on ARM/Android)
#all: s52eglw32 # OGR & EGL & Win32 (for testing EGL/GLES2 on Win32)
#all: s52gv # GV (GTK)
#all: s52gv2 # GV2 (GTK2)
#all: s52gtk2 # OGR & GTK2 & GL 1.5 (VBO)
#all: s52win32 # build libS52.dll on GL1 to run on wine/win32 (MinGW)
#all: s52gtk2p # profiling
#all: s52gtk2gps # build s52gtk2 for testing with live data comming from GPSD
#all: s52gtk2gl2 # OGR & GTK2 & GL 2.x
all: s52gtk2egl # GTK2 & GL2 & EGL
#all: s52gtk3egl # GTK3 & GL2 & EGL
##### EXP TARGETS #########
#all: s52qt4 # OGR & Qt4 (build s52gtk2 to run on Qt4)
#all: s52clutter # use COGL for rendering text
#all: s52clutter.js # use COGL for rendering text and Javascript
# debug GL
#export LIBGL_DEBUG=verbose
# debug GDAL
#export CPL_DEBUG=on
# GL error path
#MESA_NO_ERROR=1
SHELL = /bin/sh
DBG0 = -O0 -g
DBG1 = -O0 -g1 -Wall -Wpedantic -Wextra
DBG2 = -O0 -g2 -Wall -Wpedantic -Wextra
DBG3 = -O0 -g3 -Wall -Wpedantic -Wextra -ggdb3 -fstack-protector-all -Wstrict-aliasing -Wstrict-overflow -Wno-uninitialized
DBGOFF = -DG_DISABLE_ASSERT
DBG = $(DBG3)
#DBG = $(DBG0)
# GCC 4.9: -fstack-protector-strong
# CLang:
# no -rdynamic
# -fsanitize=safestack
# stack protection: GCC -fstack-check, CLang -fsanitize=cfi
# from JPL Coding Standard in C
# -Wall -pedantic -std=iso9899:1999
# -Wtraditional -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wconversion
# from clutter
# Compiler flags: -Werror -Wall -Wshadow -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Winit-self
# from /.
#MALLOC_CHECK_=3, gcc's _FORTIFY_SOURCE=2 define, gcc's -fmudflap flag, gcc's -Wall -Wextra and -pedantic flags;
# GO -fdump-go-spec=S52.go to generate symbol for GO
# -Weffc++
# Causes GCC to check for the 50 specific C++ suggestions in Scott Meyers famous book 'Effective C++'
# Qt blog
# CFLAGS = -fsanitize=address -fno-omit-frame-pointer
# LFLAGS = -fsanitize=address
# TCC
#CC = tcc -fPIC
#CXX = tcc -fPIC -fmudflap
# GCC
# gcov: -fprofile-arcs -ftest-coverage
CC = gcc -std=c99 -fPIC -pipe -D_POSIX_C_SOURCE=199309L # to get siginfo_t
#CC += -fsanitize=address -fno-omit-frame-pointer
#CC = gcc -std=c99 -fstack-check -fPIC -DMALLOC_CHECK_=3 -D_FORTIFY_SOURCE=2
#CC = gcc -std=gnu99 -fPIC -DMALLOC_CHECK_=3 -D_FORTIFY_SOURCE=2 # need gnu99 to get M_PI and sigtrap()
#CC = g++ -fPIC -O0 -g -Wall # test - compile C code as C++
CXX = g++ -fPIC
#CXX = g++ -fPIC -fpermissive # warn goto jump from inner block
# CLANG -fsanitize=cfi
#CC = clang -std=c99 -pipe -fPIC -O0 -g -Wall -Wextra -pedantic -D_POSIX_C_SOURCE=199309L
#CC += --analyze
#CC += -fsanitize=address
#CXX = clang++ -fPIC -O0 -g -Wall -Wextra -pedantic
#CC = $(CXX)
# FIXME: check this
# LLVM-AddressSanitizer: http://clang.llvm.org/docs/AddressSanitizer.html
# Compile
# clang -O1 -g -fsanitize=address -fno-omit-frame-pointer -c example_UseAfterFree.cc
# Link
# clang -g -fsanitize=address example_UseAfterFree.o
MINGW = /usr/bin/i586-mingw32msvc-
#MINGW = /usr/bin/i686-w64-mingw32-
s52win32 : CC = $(MINGW)gcc -Wall -m32 -std=c99
s52win32 : CXX = $(MINGW)g++ -Wall -m32
s52win32 : AR = $(MINGW)ar
s52win32 : RANLIB= $(MINGW)ranlib
s52eglw32: CC = $(MINGW)gcc -Wall -m32 -std=gnu99
s52eglw32: CXX = $(MINGW)g++ -Wall -m32
#s52win32 : CXX = $(CC) # hack
s52gv : CXX = $(CC) # hack
s52gv2 : CXX = $(CC) # hack
TAGS = ctags
############### OBJS setup ##############################
#
#
SRCS_S52 = S52GL.c S52PL.c S52CS.c S57ogr.c S57data.c S52MP.c S52utils.c S52.c
OBJS_S52 = $(SRCS_S52:.c=.o) S52raz-3.2.rle.o
OBJS_GV = gvS57layer.o S57gv.o
OBJS_FREETYPE_GL = ./lib/freetype-gl/vector.o ./lib/freetype-gl/texture-atlas.o ./lib/freetype-gl/texture-font.o
# Note: there is no GLU for ARM, so the tess code is pulled from COGL.
# (Quadric are also in GLU, but it is done by hand in S52GL.c to output float
# for VBO in GLES2 for circle / disk / arc.)
OBJS_TESS = ./lib/libtess/dict.o ./lib/libtess/geom.o \
./lib/libtess/mesh.o ./lib/libtess/normal.o \
./lib/libtess/priorityq.o ./lib/libtess/render.o \
./lib/libtess/sweep.o ./lib/libtess/tessmono.o \
./lib/libtess/tess.o
# handle JSON in WebSocket
OBJ_PARSON = ./lib/parson/parson.o
OPENEV_HOME = `pwd -P`/../../openev-cvs
OPENEV2_HOME = `pwd -P`/../../../openev2/trunk/src/lib/gv
#GV2LIBS = /usr/local/lib/python2.6/dist-packages/openev/_gv.so
############### CFLAGS setup ##############################
#
#
# NOTE: -malign-double: for 32bits system (useless on 64bits)
# NOTE: GV_USE_DOUBLE_PRECISION_COORD not needed directly for S52
# but gvtype.h need it and it can be pulled in (somehow.)
# NOTE: 'gdal-config --cflags': need with mingw
# NOTE: -D_REENTRANT add this if threading
# NOTE: signal is handled by glib-2.0 as of gtk+-2.0
#
#
# *** experimental ***
#
# Text:
# -DS52_USE_COGL - used to test text rendering from COGL
# -DS52_USE_FTGL - text rendering
# -DS52_USE_GLC - text rendering
# -DS52_USE_FREETYPE_GL - text rendering need GL2 or GLES2
# -DS52_USE_TXT_SHADOW - add 'shadow' to Text (work only with S52_USE_FREETYPE_GL)
#
# S52/S57:
# -DS52_USE_OGR_FILECOLLECTOR
# - compile with g++ to use gdal/ogr s57filecollector()
# - add 'extern "C"' to ogr/ogrsf_frmts/s57.h:40 S57FileCollector()
# - gcc >= 4: extern "C" __attribute__ ((visibility ("default"))) (global symbol)
# - for Windows file path in CATALOG to work on unix apply patch in doc/s57filecollector.cpp.diff
# -DS52_USE_SUPP_LINE_OVERLAP
# - supress display of overlapping line (need OGR patch in doc/ogrfeature.cpp.diff)
# - work for LC() only (not LS())
# - see S52 manual p. 45 doc/pslb03_2.pdf
# -DS52_USE_C_AGGR_C_ASSO- return info C_AGGR C_ASSO on cursor pick (need OGR patch in doc/ogrfeature.cpp.diff)
# -DS52_USE_SYM_AISSEL01 - need symbol in test/plib-test-priv.rle
# -DS52_USE_WORLD - need shapefile WORLD_SHP in S52.c:201 ("--0WORLD.shp")
# -DS52_USE_RADAR - GL2 - radar mode: skip swapbuffer between DRAW & LAST cycle, skip read/write FB - set S52_MAR_DISP_RADAR_LAYER
# -DS52_USE_RASTER - GL2 - bathy raster (GeoTIFF) - set S52_MAR_DISP_RADAR_LAYER
# -DS52_USE_AFGLOW - experimental synthetic after glow
#
# Debug:
# -DS52_DEBUG - add more info for debugging libS52 (ex _checkError() in S52GL.c)
# -DS52_USE_LOGFILE - log every S52_* in tmp file
# -DS52_USE_BACKTRACE - debug
# -DG_DISABLE_ASSERT - glib - disable g_assert()
# -DS52_USE_CA_ENC - debug CA ENC lookUp in PL
#
# Network:
# -DS52_USE_DBUS - mimic S52.h
# -DS52_USE_SOCK=2950 - set SOCK port number (same as DBus - socket & WebSocket - need ./lib/parson)
# -DS52_USE_PIPE - same as DBus, in a day
#
# OpenGL:
# -DS52_USE_EGL - EGL callback from libS52
# GL FIX FUNC:
# -DS52_USE_GL1 - GL1.x
# -DS52_USE_GLSC1 - GLSC1.x - Safety Critical 1.0 (subset of GL1.3)
# -DS52_USE_OPENGL_VBO - GL1.5 or greater. Vertex Buffer Object used also in all GL2+
# GL GLSL:
# -DS52_USE_GL2 - GL2.x
# -DS52_USE_GLES2 - GLES2.x
# -DS52_USE_GLSC2 - GLSC2.x - Safety Critical 2.0 / GLSL 1.00 (subset of GLES 2.0.25)
# -DS52_USE_GL3 - GL3.x -in a day (npot)
# -DS52_USE_GLES3 - GLES3.x -in a day (npot)
# ARM:
# -DS52_USE_ANDROID - build for Android/ARM
# -DS52_USE_TEGRA2 - must be in sync with Android.mk (Xoom)
# -DS52_USE_ADRENO - must be in sync with Android.mk (Nexus 7 (2013))
#
# MinGW:
# -DS52_USE_MINGW
#
# PROJ4
# -DS52_USE_PROJ - Mercator Projection, used by all but s52gv and s52gv2
# LCMS
# -DS52_USE_LCMS2 - debug - use lcms2 instead of lcms1 - Note: mod pkg-config to lcms2
# default CFLAGS for default target (s52gtk2)
CFLAGS = `pkg-config --cflags glib-2.0 lcms gl ftgl` \
`gdal-config --cflags` \
-I./lib/parson \
-DS52_USE_FTGL \
-DS52_USE_GL1 \
-DS52_USE_OPENGL_VBO \
-DS52_USE_SOCK=2950 \
-DS52_USE_PROJ \
-DS52_DEBUG $(DBG)
s52gtk2p : CFLAGS += -pg
s52glx : CFLAGS = `pkg-config --cflags glib-2.0 lcms glu gl ftgl` \
`gdal-config --cflags` \
-DS52_USE_PROJ \
-DS52_USE_GL1 \
-DS52_USE_FTGL \
-DS52_DEBUG $(DBG)
# -DS52_USE_SUPP_LINE_OVERLAP
s52gtk2gl2 : CFLAGS = \
`pkg-config --cflags glib-2.0 lcms gl freetype2` \
`gdal-config --cflags` \
-I./lib/freetype-gl \
-I./lib/libtess \
-I./lib/parson \
-DS52_USE_PROJ \
-DS52_USE_OPENGL_VBO \
-DS52_USE_GL2 \
-DS52_USE_FREETYPE_GL \
-DS52_USE_BACKTRACE \
-DS52_USE_TXT_SHADOW \
-DS52_USE_AFGLOW \
-DS52_DEBUG $(DBG)
# FIXME: clutter use cogl not ftgl
# -DS52_USE_OGR_FILECOLLECTOR
s52clutter s52clutter.js : CFLAGS = \
`pkg-config --cflags glib-2.0 lcms glu gl ftgl` \
`gdal-config --cflags` \
-I/home/sduclos/dev/gis/gdal/gdal/frmts/iso8211/ \
-DS52_USE_PROJ \
-DS52_USE_BACKTRACE \
-DS52_USE_GOBJECT \
-DS52_USE_GL1 \
-DS52_USE_OPENGL_VBO \
-DS52_USE_FTGL \
-DS52_DEBUG $(DBG)
# -DS52_USE_SUPP_LINE_OVERLAP
# -DS52_USE_GLSC2
# -DS52_USE_LCMS2
# -DS52_USE_CA_ENC
# -DS52_USE_OGR_FILECOLLECTOR
#`gdal-config --cflags`
s52eglx s52gtk2egl s52gtk3egl : CFLAGS = \
`pkg-config --cflags glib-2.0 gio-2.0 lcms glesv2 freetype2 gdal` \
-I./lib/freetype-gl \
-I./lib/libtess \
-I./lib/parson \
-DS52_USE_PROJ \
-DS52_USE_BACKTRACE \
-DS52_USE_EGL \
-DS52_USE_OPENGL_VBO \
-DS52_USE_GLES2 \
-DS52_USE_FREETYPE_GL \
-DS52_USE_SOCK=2950 \
-DS52_USE_TXT_SHADOW \
-DS52_USE_AFGLOW \
-DS52_USE_RASTER \
-DS52_USE_SUPP_LINE_OVERLAP \
-DS52_USE_C_AGGR_C_ASSO \
-DS52_DEBUG $(DBG)
# CFLAGS="-mthumb" CXXFLAGS="-mthumb" LIBS="-lstdc++" ./configure --host=arm-eabi \
# --without-grib --prefix=/home/sduclos/dev/prog/Android/dev/ --enable-shared=no --without-ld-shared
# using Android toolchain from NDK to cross compile for ARM (s52eglarm target)
s52eglarm : ARMTOOLCHAINROOT = /home/sduclos/dev/prog/Android/dev/android-19-toolchain
s52eglarm : ARMINCLUDE = $(ARMTOOLCHAINROOT)/sysroot/usr/include
s52eglarm : ARMLIBS = $(ARMTOOLCHAINROOT)/sysroot/usr/lib
# Android 4.4.2: -O2 -O1 crash activity android:name = ".s52ui"
# TEGRA: tadp: -fno-omit-frame-pointer -mno-thumb
s52eglarm : CC = $(ARMTOOLCHAINROOT)/bin/arm-linux-androideabi-gcc -fPIC -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -std=c99
#s52eglarm : CXX = $(ARMTOOLCHAINROOT)/bin/arm-linux-androideabi-g++ -fPIC -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
s52eglarm : AR = $(ARMTOOLCHAINROOT)/bin/arm-linux-androideabi-ar
s52eglarm : RANLIB = $(ARMTOOLCHAINROOT)/bin/arm-linux-androideabi-ranlib
s52eglarm : S52DROIDINC = /home/sduclos/S52/test/android/dist/sysroot/include
s52eglarm : S52DROIDLIB = /home/sduclos/S52/test/android/dist/sysroot/lib
# -DS52_DEBUG $(DBG)
# -DG_DISABLE_ASSERT
# -DS52_USE_TEGRA2
# -DS52_USE_LOGFILE
# -DS52_USE_OGR_FILECOLLECTOR
s52eglarm : DEFS = -DS52_USE_PROJ \
-DS52_USE_EGL \
-DS52_USE_GLES2 \
-DS52_USE_OPENGL_VBO \
-DS52_USE_FREETYPE_GL \
-DS52_USE_ANDROID \
-DS52_USE_ADRENO \
-DS52_USE_SUPP_LINE_OVERLAP \
-DS52_USE_SOCK=2950 \
-DS52_USE_TXT_SHADOW \
-DS52_USE_AFGLOW \
-DS52_DEBUG
s52eglarm : CFLAGS = -I$(S52DROIDINC) \
-I$(S52DROIDINC)/glib-2.0 \
-I$(S52DROIDINC)/glib-2.0/include \
`pkg-config --cflags freetype2` \
-I./lib/freetype-gl \
-I./lib/libtess \
-I./lib/parson \
$(DEFS)
# check this; gv use glib-1 S52 use glib-2
s52gv : CFLAGS = `glib-config --cflags` \
`gdal-config --cflags` \
-DS52_USE_GV $(DBG) \
-DGV_USE_DOUBLE_PRECISION_COORD \
`gtk-config --cflags` -I$(OPENEV_HOME)
s52gv2 : CFLAGS = `pkg-config --cflags glib-2.0 lcms` \
`gdal-config --cflags` \
-DS52_USE_GV \
-DGV_USE_DOUBLE_PRECISION_COORD \
-I$(OPENEV2_HOME)
# -DS52_USE_OGR_FILECOLLECTOR
s52gtk2gps: CFLAGS = `pkg-config --cflags glib-2.0 lcms ftgl dbus-1 dbus-glib-1` \
`gdal-config --cflags` \
-DS52_USE_FTGL \
-DS52_USE_PROJ \
-DS52_USE_SUPP_LINE_OVERLAP \
-DS52_USE_DBUS \
-DS52_USE_GOBJECT \
-DS52_USE_BACKTRACE \
-DS52_DEBUG $(DBG)
s52win32 : GDALPATH = ../../../gdal/gdal-1.7.2-mingw/
# -DS52_DEBUG $(DBG2)
# -DS52_USE_OGR_FILECOLLECTOR
s52win32 : CFLAGS = -mms-bitfields \
-I../../mingw/gtk+-2.16/gtk+-bundle_2.16.6-20100912_win32/include/glib-2.0 \
-I../../mingw/gtk+-2.16/gtk+-bundle_2.16.6-20100912_win32/lib/glib-2.0/include \
-I../../mingw/include \
-I$(GDALPATH)ogr \
-I$(GDALPATH)port \
-I$(GDALPATH)gcore \
-I$(GDALPATH)frmts/iso8211/ \
-DS52_USE_FTGL \
-DS52_USE_GL1 \
-DS52_USE_PROJ \
-DS52_USE_LOGFILE \
-DG_DISABLE_ASSERT \
-DS52_USE_MINGW
s52eglw32 : GDALPATH = ../../../gdal/gdal-1.7.2-mingw
# -DS52_USE_OGR_FILECOLLECTOR
s52eglw32 : CFLAGS = -mms-bitfields \
-I../../mingw/gtk+-2.16/gtk+-bundle_2.16.6-20100912_win32/include/glib-2.0 \
-I../../mingw/gtk+-2.16/gtk+-bundle_2.16.6-20100912_win32/lib/glib-2.0/include \
-I../../mingw/include \
-I$(GDALPATH)/ogr \
-I$(GDALPATH)/port \
-I$(GDALPATH)/gcore \
-I$(GDALPATH)/frmts/iso8211/ \
-I$(GDALPATH)/alg \
-I./lib/freetype-gl \
-I./lib/libtess \
-I./lib/parson \
-DS52_USE_PROJ \
-DS52_USE_OPENGL_VBO \
-DS52_USE_EGL \
-DS52_USE_GL2 \
-DS52_USE_GLES2 \
-DS52_USE_FREETYPE_GL \
-DS52_USE_LOGFILE \
-DG_DISABLE_ASSERT \
-DS52_USE_MINGW \
-DS52_DEBUG $(DBG2)
############### LIBS setup ##############################
#
#
# default LIBS for default target
LIBS = `pkg-config --libs glib-2.0 lcms gl ftgl` \
`gdal-config --libs` -lproj
s52gtk2gl2 : LIBS = `pkg-config --libs glib-2.0 lcms gl freetype2` \
`gdal-config --libs` -lproj
s52clutter, s52clutter.js : LIBS = `pkg-config --libs glib-2.0 lcms glu gl` \
`gdal-config --libs` -lproj
s52glx : LIBS = `pkg-config --libs glib-2.0 lcms glu gl ftgl` \
`gdal-config --libs` -lproj
#s52eglx s52gtk2egl s52gtk3egl: LIBS = `pkg-config --libs glib-2.0 gio-2.0 lcms glesv2 freetype2` \
# `gdal-config --libs` -lproj
s52eglx s52gtk2egl s52gtk3egl: LIBS = `pkg-config --libs glib-2.0 gio-2.0 lcms glesv2 freetype2 gdal` -lproj
# check this; gv use glib-1 S52 use glib-2
s52gv : LIBS = `glib-config --libs` \
`gdal-config --libs` \
`gtk-config --libs` \
-llcms
s52gv2 : LIBS = `pkg-config --libs glib-2.0 lcms` \
`gdal-config --libs` \
-lGL -lGLU $(GV2LIBS)
############### BUILD ##############################
#
#
s52glx : libS52.so test/s52glx
s52eglx : libS52egl.so test/s52eglx
s52gtk2egl : libS52egl.so test/s52gtk2egl
s52gtk3egl : libS52egl.so test/s52gtk3egl
s52eglarm : $(S52DROIDLIB)/libS52.a test/s52eglarm
s52gv : libS52gv.so test/s52gv
s52gv2 : libS52gv.so test/s52gv2
s52gtk2 : libS52.so test/s52gtk2
s52gtk2gl2 : libS52gl2.so test/s52gtk2gl2
s52gtk2p : $(OBJS_S52) test/s52gtk2p # static link
s52clutter : libS52.so test/s52clutter
s52clutter.js : libS52.so test/s52clutter.js
s52qt4 : libS52.so test/s52qt4
s52win32 : libS52.dll test/s52win32 s52win32fini
#s52win32 : libS52.dll.a test/s52win32
#s52win32gps : libS52.dll test/s52win32gps s52win32fini
s52eglw32 : libS52.dll test/s52eglw32
s52gtk2gps : libS52.so test/s52gtk2gps
# debug - backtrace with local func name
# 1 - $nm *.o| grep " t " > local_func.txt
# 2 - sed -e "s/.*\( .*$\)/\1/" local_func.txt local_func2.txt
# 3 - sort local_func2.txt | uniq > local_func3.txt
# 5 - objcopy --globalize-symbols=local_func3.txt $@
S52raz-3.2.rle.o: S52raz.s
$(CC) -c S52raz.s -o $@
%.o: %.c *.h Makefile
$(CC) $(CFLAGS) -c $< -o $@
#objcopy --globalize-symbols=local_func3.txt $@
S52GL.o: S52GL.c S52GL.h _GL1.i _GL2.i _GLU.i S52.h Makefile
$(CC) $(CFLAGS) -c $< -o $@
S52.o: S52.c _S52.i *.h Makefile
$(CC) $(CFLAGS) -c $< -o $@
# $(CXX) $(CFLAGS) -c $< -o $@
./lib/libtess/%.o: ./lib/libtess/%.c
$(CC) $(CFLAGS) -c $< -o $@
./lib/freetype-gl/%.o: ./lib/freetype-gl/%.c
$(CC) $(CFLAGS) -c $< -o $@
./lib/parson/%.o: ./lib/parson/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(S52DROIDLIB)/libS52.a: $(OBJS_S52) $(OBJS_TESS) $(OBJS_FREETYPE_GL) $(OBJ_PARSON) tags
$(AR) rc $(S52DROIDLIB)/libS52.a $(OBJS_S52) $(OBJS_TESS) $(OBJS_FREETYPE_GL) $(OBJ_PARSON)
$(RANLIB) $(S52DROIDLIB)/libS52.a
libS52.so: $(OBJS_S52) $(OBJ_PARSON) tags
$(CC) -shared $(OBJS_S52) $(OBJ_PARSON) $(LIBS) -o $@
libS52gl2.so: $(OBJS_S52) $(OBJS_TESS) $(OBJS_FREETYPE_GL) $(OBJ_PARSON) tags
$(CC) -shared $(OBJS_S52) $(OBJS_TESS) $(OBJS_FREETYPE_GL) $(OBJ_PARSON) $(LIBS) -o $@
-ln -sf libS52gl2.so libS52.so
# -Wl,-Map=output.map
libS52egl.so: $(OBJS_S52) $(OBJS_TESS) $(OBJS_FREETYPE_GL) $(OBJ_PARSON) tags
$(CC) -shared $(LIBS) $(OBJS_S52) $(OBJS_TESS) $(OBJS_FREETYPE_GL) $(OBJ_PARSON) $(LIBS) -o $@
-ln -sf libS52egl.so libS52.so # -s soft link
libS52gv.so: $(OBJS_S52) $(OBJS_GV)
$(CC) -shared $(OBJS_S52) $(OBJS_GV) $(LIBS) -o libS52.so
s52win32 s52eglw32: LIBWIN32PATH = ../../mingw
s52win32 s52eglw32: GTKPATH = $(HOME)/dev/gis/openev-cvs/mingw/gtk+-2.16/gtk+-bundle_2.16.6-20100912_win32/bin
#s52win32 s52eglw32: GTKPATH = $(HOME)/dev/gis/openev-cvs/mingw/gtk+-bundle_2.16.6-20100912_win32/lib
s52win32 : LIBS = -L$(GTKPATH) -lglib-2.0-0 -lfreetype6 \
$(LIBWIN32PATH)/libproj.a \
$(LIBWIN32PATH)/libftgl.a \
$(LIBWIN32PATH)/libgdal-1.dll \
$(LIBWIN32PATH)/liblcms-1.dll \
-lopengl32 -lglu32 \
s52eglw32 : LIBS = $(LIBWIN32PATH)/libproj.a \
$(LIBWIN32PATH)/libgdal-1.dll \
$(LIBWIN32PATH)/liblcms-1.dll \
$(LIBWIN32PATH)/libEGL.lib \
$(LIBWIN32PATH)/libGLESv2.lib \
-L$(GTKPATH) -lglib-2.0-0 -lfreetype6
libS52.dll: $(OBJS_S52)
$(MINGW)objcopy --redefine-sym S52raz=_S52raz --redefine-sym S52razLen=_S52razLen S52raz-3.2.rle.o S52raz-3.2.rle.o
$(CXX) -O0 -g -Wall -mms-bitfields -shared -Wl,--add-stdcall-alias $(OBJS_S52) $(LIBS) -o $@
libS52.dll.a: $(OBJS_S52)
$(AR) rc libS52.dll.a $(OBJS_S52)
$(RANLIB) libS52.dll.a
libS52egl.dll: $(OBJS_S52) $(OBJS_FREETYPE_GL) $(OBJS_TESS) $(OBJ_PARSON)
$(MINGW)objcopy --redefine-sym S52raz=_S52raz \
--redefine-sym S52razLen=_S52razLen S52raz-3.2.rle.o S52raz-3.2.rle.o
$(MINGW)g++ -g -mms-bitfields -O0 -Wall -shared -Wl,--add-stdcall-alias \
$(OBJS_S52) $(OBJS_FREETYPE_GL) $(OBJS_TESS) $(OBJ_PARSON) $(LIBS) -o $@
-rm -f libS52.dll
-ln -s libS52egl.dll libS52.dll
############### Test ##############################
#
#
test/s52glx:
(cd test; make s52glx)
test/s52eglx:
(cd test; make s52eglx)
test/s52gtk2egl:
(cd test; make s52gtk2egl)
test/s52gtk3egl:
(cd test; make s52gtk3egl)
# FIXME: remove DEPRECATED step to cd in test
# (cd test; make s52eglarm; cd android; make)
test/s52eglarm:
(cd test/android; make)
test/s52gv:
(cd test; make s52gv)
test/s52gv2:
(cd test; make s52gv2)
test/s52gtk2:
(cd test; make s52gtk2)
test/s52gtk2gl2:
(cd test; make s52gtk2gl2)
test/s52gtk2gps:
(cd test; make s52gtk2gps)
#test/s52clutter:
# (cd test; make s52clutter)
test/s52clutter.js:
(cd test; make s52clutter.js)
test/s52gtk2p:
(cd test; make s52gtk2p)
test/s52qt4:
(cd test; make s52qt4)
test/s52win32:
(cd test; make s52win32)
test/s52win32gps:
(cd test; make s52win32gps)
test/s52eglw32:
(cd test; make s52eglw32)
s52win32fini:
$(MINGW)strip libS52.dll
# NOTE: libS52 need to know where is _gv python wrapper is
# when using openev.py because we have du jump back to it
# to get to the handle of gvProperty of layers
#../../openev/pymod/_gvmodule.so
############### Utils ##############################
#
#
clean:
rm -f *.o tags *~ *.so *.dll err.txt ./lib/libtess/*.o ./lib/freetype-gl/*.o ./lib/parson/*.o
(cd test; make clean)
distclean: clean
rm -f test/android/dist/sysroot/lib/libS52.a
(cd test; make distclean)
install:
install libS52.so `gdal-config --prefix`/lib
uninstall:
rm -f `gdal-config --prefix`/lib/libS52.so
tar: backup
backup: distclean
(cd ..; tar zcvf S52.tgz S52)
tags:
-$(TAGS) *.c *.h *.i
# ./lib/freetype-gl/*.c ./lib/libtess/*.c ./lib/parson/*.c
cppcheck:
cppcheck --version
cppcheck --enable=all --std=c99 --template='{file}:{line}: {severity},{id},{message}' $(DEFS) $(SRCS_S52) ./test/s52gtkegl.c
# get version - "libS52-2014DEC27-1.157" --> 2014DEC27-1.157
#FIXME: version str in S52.h
LIBS52VERS = $(shell grep libS52- S52utils.c | sed 's/.*"libS52-\(.*\)"/\1/' )
S52-$(LIBS52VERS).gir: S52.h
g-ir-scanner --verbose --namespace=S52 --nsversion=$(LIBS52VERS) --library=S52 --no-libtool S52.h -o $@
sudo cp $@ /usr/share/gir-1.0/
S52-$(LIBS52VERS).typelib: S52-$(LIBS52VERS).gir
g-ir-compiler S52-$(LIBS52VERS).gir -o $@
sudo cp $@ /usr/lib/girepository-1.0/
# https://git.gnome.org/browse/introspection-doc-generator
doc: S52-$(LIBS52VERS).typelib
(cd /home/sduclos/dev/prog/doc-generator/introspection-doc-generator/; seed docs.js ../tmp S52;)
cp /home/sduclos/dev/prog/doc-generator/tmp/seed/* doc/tmp
############### Notes ##############################
#
#
# Run command every time a file is modified:
#while inotifywait -e close_write document.tex
#do
# make
#done
# monitor network traffic
# sudo iftop -i wlan0 (or wlp6s0)
# sudo lsof -i :portno
# wake up GPSD
# telnet 127.0.0.1 2947
# ?WATCH={"enable":true,"json":true}
# git:
# git init (one time)
# git add <file> (ex README)
# git commit -m "new"
# git remote add origin https://git.com/sduclos/S52.git
# sync local .git with mirror git
# git push downstream master
# add mirror URL to push to
# git remote set-url --add --push origin https://github.com/sduclos/S52.git
# git remote set-url --add --push origin https://framagit.org/sduclos/S52.git
# list mirror
# git remote -v
# origin https://github.com/sduclos/S52.git (fetch)
# origin https://github.com/sduclos/S52.git (push)
# origin https://framagit.org/sduclos/S52.git (push)