-
Notifications
You must be signed in to change notification settings - Fork 29
/
magic.mk
3399 lines (2663 loc) · 122 KB
/
magic.mk
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
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
########################################################################
#
# The magic.makefile Copyright 2012
# by Jeff Koftinoff <[email protected]>
# J.D. Koftinoff Software Ltd.
# All rights reserved.
#
# Version 2012.08.23: http://wiki.github.com/jdkoftinoff/magicmake/
#
# Simplifies the building of a c/c++ library, tests, tools, examples,
# and documentation.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
MAGICMAKE_DIR=$(PROJECT_TOP_DIR)
########################################################################
# magic-project.mk:
# default project settings. These are usually originally set in project.mk
# PROJECT is the single word describing this project.
PROJECT?=project
M4_DEFS+="-Dm4_PROJECT=$(PROJECT)"
# PROJECT_NAME is a single line describing this project
PROJECT_NAME?=Project
M4_DEFS+="-Dm4_PROJECT_NAME=$(PROJECT_NAME)"
PROJECT_VARIANT?=
M4_DEFS+="-Dm4_PROJECT_VARIANT=$(PROJECT_VARIANT)"
ifneq ($(PROJECT_VARIANT),)
PROJECT_VARIANT_SUFFIX?=-$(PROJECT_VARIANT)
endif
M4_DEFS+="-Dm4_PROJECT_VARIANT_SUFFIX=$(PROJECT_VARIANT_SUFFIX)"
# PROJECT_VERSION defaults to the date, YYYYMMDD
PROJECT_VERSION_SHELL:=$(shell date +%Y%m%d)
PROJECT_VERSION?=$(PROJECT_VERSION_SHELL)
M4_DEFS+="-Dm4_PROJECT_VERSION=$(PROJECT_VERSION)"
PROJECT_RELEASE?=1
PROJECT_MAINTAINER?=project_maintainer
M4_DEFS+="-Dm4_PROJECT_MAINTAINER=$(PROJECT_MAINTAINER)"
PROJECT_COPYRIGHT?=project_copyright
M4_DEFS+="-Dm4_PROJECT_COPYRIGHT=$(PROJECT_COPYRIGHT)"
PROJECT_COMPANY?=project_companyname
M4_DEFS+="-Dm4_PROJECT_COMPANY=$(PROJECT_COMPANY)"
PROJECT_WEBSITE?=project_website
M4_DEFS+="-Dm4_PROJECT_WEBSITE=$(PROJECT_WEBSITE)"
PROJECT_DESCRIPTION?=project_description
M4_DEFS+="-Dm4_PROJECT_DESCRIPTION=$(PROJECT_DESCRIPTION)"
PROJECT_IDENTIFIER?=com.example.$(PROJECT)
M4_DEFS+="-Dm4_PROJECT_IDENTIFIER=$(PROJECT_IDENTIFIER)"
# disable precompiled headers by default
ENABLE_PRECOMPILED_HEADERS?=0
ifeq ($(TARGET_PLATFORM_MACOSX_UNIVERSAL)-$(ENABLE_PRECOMPILED_HEADERS),1-1)
override ENABLE_PRECOMPILED_HEADERS=0
endif
ifeq ($(ENABLE_PRECOMPILED_HEADERS),1)
PRECOMPILED_HEADER_LIST = $(PRECOMPILED_HEADER)
PRECOMPILED_HEADER_GCH = $(addprefix $(OUTPUT_OBJ_DIR)/,$(addsuffix .gch,$(notdir $(PRECOMPILED_HEADER_LIST))))
PREPROCESS_FLAGS+=
#-fpch-deps
PRECOMPILE_H_FLAGS?=-x c-header
PRECOMPILE_HH_FLAGS?=-x c++-header
endif
ETAGS_FLAGS?=
#ETAGS_LANGUAGE_FLAG?=-l c++
CTAGS_FLAGS?=
#CTAGS_LANGUAGE_FLAG?=-l c++
# We are not cross compiling by default
CROSS_COMPILING?=0
# PKG_CONFIG_PACKAGES contains lists of packages handled by pkg-config to be used
PKGCONFIG_PACKAGES?=
# Default to no packaging or install tool
PACKAGER?=tgz
#PACKAGE_CHOWN?=root:root
#PACKAGE_CHMOD?=go-w,u+rwX
PACKAGE_PROVIDES?=$(PROJECT)
# CONFIG_TOOLS are like PKGCONFIG_PACKAGES but not handled by 'pkg-config', they are called directly
CONFIG_TOOLS?=
# TOP_LIB_DIRS is a list of relative directories from the PROJECT_TOP_DIR that each contain
# an "include", "src", "tools", "tests" and other directories. Typically for a single project
# TOP_LIB_DIRS is set to '.' in project.mk
# LIB_DIRS is then calculated with the fully qualified directory name for each directory in TOP_LIB_DIRS
LIB_DIRS+=$(call add_top_dir_prefix,$(TOP_LIB_DIRS))
# by default do not build shared libraries
ENABLE_SHLIB?=0
# by default build static libraries
ENABLE_STATICLIB?=1
########################################################################
# magic-tools.mk
# RSYNC is the name of our rsync program.
RSYNC_SHELL:=$(shell which rsync)
RSYNC?=$(RSYNC_SHELL)
# RSYNC_OPTIONS are the rsync options we use to copy a tree of files/directories to another dir.
# We want ot exclude backup files and subversion and CVS control directories.
RSYNC_OPTIONS?=-a --exclude='*~' --exclude='.svn' --exclude='CVS'
TAR_EXCLUDE_LIST=--exclude '.svn' --exclude '*~' --exclude '.hg' --exclude 'CVS' --exclude '.git' --exclude '.DS_Store' --exclude '*~'
# When we build a config tool script, this is the file name we use.
PROJECT_CONFIG_TOOL?=$(PROJECT)-config
COMPILER?=gcc
ifeq ($(COMPILER),intel)
COMPILE_FLAGS+=
CXX=$(COMPILER_PREFIX)icc$(COMPILER_SUFFIX)
CC=$(COMPILER_PREFIX)icc$(COMPILER_SUFFIX)
AR=$(COMPILER_PREFIX)xiar$(COMPILER_SUFFIX)
LINK.cpp=$(COMPILER_PREFIX)icc$(COMPILER_SUFFIX)
LINK.c=$(COMPILER_PREFIX)icc$(COMPILER_SUFFIX)
LINK_FLAGS+=-cxxlib -lstdc++ -lm -lsvml
endif
ifeq ($(COMPILER),clang)
CXX=$(COMPILER_PREFIX)clang++$(COMPILER_SUFFIX)
CC=$(COMPILER_PREFIX)clang$(COMPILER_SUFFIX)
LINK.cpp?=$(CXX)
LINK.c?=$(CC)
endif
ifeq ($(COMPILER),gcc)
CXX=$(COMPILER_PREFIX)g++$(COMPILER_SUFFIX)
CC=$(COMPILER_PREFIX)gcc$(COMPILER_SUFFIX)
AR=$(COMPILER_PREFIX)ar$(COMPILER_SUFFIX)
RANLIB=$(COMPILER_PREFIX)ranlib$(COMPILER_SUFFIX)
LINK.cpp?=$(CXX)
LINK.c?=$(CC)
endif
ifdef COMPILER_FRONTEND_CC
CC:=$(COMPILER_FRONTEND_CC) $(CC)
endif
ifdef COMPILER_FRONTEND_CXX
CXX:=$(COMPILER_FRONTEND_CXX) $(CXX)
endif
PYTHON?=python
CHMOD?=chmod
CHOWN?=chown
SWIG:=$(shell which swig)
SWIG?=$(SWIG_SHELL)
SWIG_OPTIONS?=-python
OBJDUMP?=$(COMPILER_PREFIX)objdump
OBJDUMP_FLAGS?=-d -C
LIPO?=$(COMPILER_PREFIX)lipo
ZIP?=zip
ZIP_FLAGS=-rp
GZIP?=gzip
BZIP2?=bzip2
DPKG_SHELL:=$(shell which dpkg)
DPKG?=$(DPKG_SHELL)
FAKEROOT_SHELL:=$(shell which fakeroot)
FAKEROOT?=$(FAKEROOT_SHELL)
RUN_DPKG=$(FAKEROOT) $(DPKG)
M4_SHELL:=$(shell which m4)
M4?=$(M4_SHELL)
M4_OPTIONS=-P
RANLIB_SHELL:=$(shell which ranlib)
RANLIB?=$(RANLIB_SHELL)
RPMBUILD_SHELL:=$(shell which rpmbuild)
RPMBUILD?=$(RPMBUILD_SHELL)
EPM_SHELL:=$(shell which epm)
EPM?=$(EPM_SHELL)
MKEPMLIST_SHELL:=$(shell which mkepmlist)
MKEPMLIST?=$(MKEPMLIST_SHELL)
TAR?=tar
DOXYGEN_SHELL:=$(shell which doxygen)
DOXYGEN?=$(DOXYGEN_SHELL)
VALGRIND_SHELL:=$(shell which valgrind)
VALGRIND?=$(VALGRIND_SHELL)
CP?=cp
CP_FLAGS=-rpv
SCP?=scp
SCP_OPTIONS?=-rpqC
SHIP_TO?=.
QMAKE_SHELL:=$(shell which qmake)
QMAKE?=$(QMAKE_SHELL)
MKDIR?=mkdir
MKDIRS?=mkdir -p
RMDIRS?=rm -r -f
RM?=rm -f
INSTALL?=install
INSTALL_FLAGS?=-d
SSH?=ssh
SUDO?=sudo
SUDO_OPTIONS?=
CHECKINSTALL_SHELL:=$(shell which checkinstall)
CHECKINSTALL?=$(CHEKCINSTALL_SHELL)
SUDO_CHECKINSTALL?=$(SUDO) $(CHECKINSTALL)
CHECKINSTALL_OPTIONS+=--install=no --fstrans -y
STRIP?=$(COMPILER_PREFIX)strip
STRIP_OPTIONS?=
TEST_OUT_SUFFIX?=out
TEST_ERR_SUFFIX?=err
ifeq ($(RELEASE),1)
strip_if_release=$(STRIP) $(STRIP_OPTIONS) $(1)
else
strip_if_release=true
endif
########################################################################
#
# utility functions
# add_top_dir_prefix is a function that takes every directory and or wildcard pattern
# in arg1 and prefixes PROJECT_TOP_DIR to it, and then only expands the directories that actually exist.
add_top_dir_prefix=$(strip $(wildcard $(foreach lib,$(1),$(PROJECT_TOP_DIR)/$(lib))))
# subdirs_in_path is a function which takes 1 parameter:
# $(1) is a single directory
# it expands to a list of all directories in $(1)
subdirs_in_path=$(strip $(foreach d,$(wildcard $(1)/*/.),$(dir $(d))))
bare_subdirs_in_path=$(subst /,,$(subst $(1),,$(call subdirs_in_path,$(1))))
# suffix_platform_dirs is a function that takes 3 parameters:
# $(1) is a subdirectory name, like 'src'
# $(2) is a list of platform directories, like 'win32' or 'posix'
# $(3) is a list of main directory names, like '$(PROJECT_TOP_DIR)'
#
# suffix_platform_dirs expands all existing directories that match any of $(3)/$(1) or $(3)/$(1)/$(2)
suffix_platform_dirs=$(strip $(foreach dir,$(addsuffix /$(1),$(3)) $(foreach platform,$(2),$(addsuffix /$(1)/$(platform),$(3))),$(wildcard $(dir))))
# suffix_platform_only_dirs is a function that takes 3 parameters:
# $(1) is a subdirectory name, like 'src'
# $(2) is a list of platform directories, like 'win32' or 'posix'
# $(3) is a list of main directory names, like '$(PROJECT_TOP_DIR)'
#
# suffix_platform_only_dirs expands all existing directories that match any of $(3)/$(1)/$(2)
suffix_platform_only_dirs=$(strip $(foreach dir,$(foreach platform,$(2),$(addsuffix /$(1)/$(platform),$(3))),$(wildcard $(dir))))
# target_suffix_platform_dirs is a function which takes one parameter:
# $(1) is a subdirectory name, like 'src' or 'tool'
# it expands into all existing directories for the target platform sources
# including any variant suffix, like 'src/special' or 'tool/special'
target_suffix_platform_dirs=$(wildcard $(call suffix_platform_dirs,$(1),$(PLATFORM_DIRS) variant/$(PROJECT_VARIANT) common,$(LIB_DIRS)))
# target_suffix_platform_only_dirs is a function which takes one parameter:
# $(1) is a subdirectory name, like 'src' or 'tool'
# it expands into all existing directories for the target platform sources
# including any variant suffix, like 'src/special' or 'tool/special' and 'tool/common' but not
# any top level directory like target_suffix_platform_dirs would
target_suffix_platform_only_dirs=$(wildcard $(call suffix_platform_only_dirs,$(1),$(PLATFORM_DIRS) variant/$(PROJECT_VARIANT) common,$(LIB_DIRS)))
# native_suffix_platform_dirs is a function which takes one parameter:
# $(1) is a subdirectory name, like 'src' or 'tool'
# it expands into all existing directories for the native platform sources
native_suffix_platform_dirs=$(wildcard $(call suffix_platform_dirs,$(1),$(NATIVE_PLATFORM_DIRS),$(LIB_DIRS)))
# get_file_list is a function which takes two parameters:
# $(1) a list of directory names
# $(2) a file extension (without the dot)
# it expands into all the file names that are found in the listed directories which that file extension,
# and then removes all the directory names from the results.
get_file_list=$(strip $(notdir $(foreach dir,$(1),$(wildcard $(dir)/*.$(2)))))
# get_file_list_full is just like get_file_list but returns the full source path names instead of just the basenames
get_file_list_full=$(strip $(foreach dir,$(1),$(wildcard $(dir)/*.$(2))))
# get_src_file_list is a function which takes one parameter:
# $(1) is a file extension
# it expands into a list of all source files for the target platform that of that type
# (with the directory names removed)
get_src_file_list=$(call get_file_list,$(sort $(LIB_SRC_DIR)),$(1))
get_native_src_file_list=$(call get_file_list,$(sort $(NATIVE_LIB_SRC_DIR)),$(1))
# get_include_file_list is a function which takes one parameter:
# $(1) is a file extension
# it expands into a list of all include files for the target platform that of that type
# (with the directory names removed)
get_include_file_list=$(call get_file_list_full,$(call subdirs_in_path,$(LIB_INCLUDE_DIR)),$(1)) $(call get_file_list_full,$(LIB_INCLUDE_DIR),$(1))
# get_cpp_o_files is a function which takes one parameter:
# $(1) is a list of cpp files with no directory names
#
# it returns the full path names for all the required object files which are generated by cpp files.
# get_cc_o_files, get_c_o_files, get_m_o_files, and get_mm_o_files are the same as get_cpp_o_files
# except for C, Objective-C, and Objective-C++ respectively.
get_cpp_o_files=$(addprefix $(OUTPUT_OBJ_DIR)/,$(1:.cpp=.o))
get_cc_o_files=$(addprefix $(OUTPUT_OBJ_DIR)/,$(1:.cc=.o))
get_c_o_files=$(addprefix $(OUTPUT_OBJ_DIR)/,$(1:.c=.o))
get_m_o_files=$(addprefix $(OUTPUT_OBJ_DIR)/,$(1:.m=.o))
get_mm_o_files=$(addprefix $(OUTPUT_OBJ_DIR)/,$(1:.mm=.o))
get_rc_o_files=$(addprefix $(OUTPUT_OBJ_DIR)/,$(1:.rc=.o))
get_cpp_shlib_o_files=$(addprefix $(OUTPUT_SHOBJ_DIR)/,$(1:.cpp=.o))
get_cc_shlib_o_files=$(addprefix $(OUTPUT_SHOBJ_DIR)/,$(1:.cc=.o))
get_c_shlib_o_files=$(addprefix $(OUTPUT_SHOBJ_DIR)/,$(1:.c=.o))
get_m_shlib_o_files=$(addprefix $(OUTPUT_SHOBJ_DIR)/,$(1:.m=.o))
get_mm_shlib_o_files=$(addprefix $(OUTPUT_SHOBJ_DIR)/,$(1:.mm=.o))
get_rc_shlib_o_files=$(addprefix $(OUTPUT_SHOBJ_DIR)/,$(1:.rc=.o))
get_native_cpp_o_files=$(addprefix $(NATIVE_OUTPUT_OBJ_DIR)/,$(1:.cpp=.o))
get_native_cc_o_files=$(addprefix $(NATIVE_OUTPUT_OBJ_DIR)/,$(1:.cc=.o))
get_native_c_o_files=$(addprefix $(NATIVE_OUTPUT_OBJ_DIR)/,$(1:.c=.o))
get_native_m_o_files=$(addprefix $(NATIVE_OUTPUT_OBJ_DIR)/,$(1:.m=.o))
get_native_mm_o_files=$(addprefix $(NATIVE_OUTPUT_OBJ_DIR)/,$(1:.mm=.o))
get_native_rc_o_files=$(addprefix $(NATIVE_OUTPUT_OBJ_DIR)/,$(1:.rc=.o))
# calc_target_options is a function which takes 1 parameter:
# $(1) is a target platform suffix, such as MINGW32, POSIX, or LINUX
#
# it expands into makefile code which is to be ultimately eval'd -
# this means that if $(1) is LINUX, then for instance, COMPILE_FLAGS_LINUX
# will get appended to the current COMPILE_FLAGS.
# the variables set in this fashion include:
# LIB_SRC_DIR, DEFINES, COMPILE_FLAGS, LINK_FLAGS, LDLIBS,
define calc_target_options
# add the relevant top src dirs
LIB_SRC_DIR+=$$(call add_top_dir_prefix,$$(TOP_LIB_DIRS_$(1)))
# set the target platform macro definition
DEFINES+=TARGET_PLATFORM_$(1)=1
# set the platform specific project defines
DEFINES+=$$(DEFINES_$(1))
# set the platform specific project compile flags
COMPILE_FLAGS+=$$(COMPILE_FLAGS_$(1))
# set the platform specific project pre-process flags
PREPROCESS_FLAGS+=$$(PREPROCESS_FLAGS_$(1))
# set the platform specific project link flags
LINK_FLAGS+=$$(LINK_FLAGS_$(1))
# and for linking shlibs
SHLIB_LINK_FLAGS+=$$(SHLIB_LINK_FLAGS_$(1))
# set the platform specific project link libs
LDLIBS+=$$(LDLIBS_$(1))
endef
# calc_multi_target_options is a function which takes 1 parameter:
# $(1) is a list of target platform suffixes, such as POSIX or LINUX
# it takes each one and expands them via the calc_target_options function.
# this expansion is to be eval'd.
calc_multi_target_options=$(foreach suffix,$(1),$(call calc_target_options,$(suffix)))
# calc_native_options is a function which takes 1 parameter:
# $(1) is a native platform suffix, such as MINGW32, POSIX, or LINUX
#
# it expands into makefile code which is to be ultimately eval'd -
# this means that if $(1) is LINUX, then for instance, COMPILE_FLAGS_LINUX
# will get appended to the current NATIVE_COMPILE_FLAGS.
# the variables set in this fashion include:
# NATIVE_LIB_SRC_DIR, NATIVE_DEFINES, NATIVE_COMPILE_FLAGS,
# NATIVE_LINK_FLAGS, NATIVE_LDLIBS
define calc_native_options
# add the relevant top src dirs
NATIVE_LIB_SRC_DIR+=$$(call add_top_dir_prefix,$$(TOP_LIB_DIRS_$(1)))
# set the target platform macro definition
NATIVE_DEFINES+=TARGET_PLATFORM_$(1)=1
# set the platform specific project defines
NATIVE_DEFINES+=$$(DEFINES_$(1))
# set the platform specific project compile flags
NATIVE_COMPILE_FLAGS+=$$(COMPILE_FLAGS_$(1))
# set the platform specific project preprocess flags
NATIVE_PREPROCESS_FLAGS+=$$(PREPROCESS_FLAGS_$(1))
# set the platform specific project link flags
NATIVE_LINK_FLAGS+=$$(LINK_FLAGS_$(1))
# set the platform specific project link libs
NATIVE_LDLIBS+=$$(LDLIBS_$(1))
endef
# calc_multi_native_options is a function which takes 1 parameter:
# $(1) is a list of native platform suffixes, such as POSIX or LINUX
# it takes each one and expands them via the calc_native_options function.
# this expansion is to be eval'd.
calc_multi_native_options=$(foreach suffix,$(1),$(call calc_native_options,$(suffix)))
# search_program_group is a function which returns the makefile text required to find
# all source files in a specified directory class and construct the o file lists for them.
# Param $(1) is the class of program in capitals, for example TOOLS, TESTS, EXAMPLES
# the text returned by this function is then to be eval'd. The appropriate lists of
# source files and O files for this class are then created dynamically.
define search_program_group
LIB_$(1)_CPP_FILES=$$(call get_file_list,$$(LIB_$(1)_DIR),cpp)
LIB_$(1)_CC_FILES=$$(call get_file_list,$$(LIB_$(1)_DIR),cc)
LIB_$(1)_C_FILES=$$(call get_file_list,$$(LIB_$(1)_DIR),c)
LIB_$(1)_M_FILES=$$(call get_file_list,$$(LIB_$(1)_DIR),m)
LIB_$(1)_MM_FILES=$$(call get_file_list,$$(LIB_$(1)_DIR),mm)
LIB_$(1)_RC_FILES=$$(call get_file_list,$$(LIB_$(1)_DIR),rc)
LIB_$(1)_SH_FILES=$$(call get_file_list_full,$$(LIB_$(1)_DIR),sh)
LIB_$(1)_PY_FILES=$$(call get_file_list_full,$$(LIB_$(1)_DIR),py)
LIB_$(1)_O_FILES=$$(call get_cpp_o_files,$$(LIB_$(1)_CPP_FILES)) \
$$(call get_cc_o_files,$$(LIB_$(1)_CC_FILES)) \
$$(call get_c_o_files,$$(LIB_$(1)_C_FILES)) \
$$(call get_m_o_files,$$(LIB_$(1)_M_FILES)) \
$$(call get_mm_o_files,$$(LIB_$(1)_MM_FILES)) \
$$(call get_rc_o_files,$$(LIB_$(1)_RC_FILES))
LIB_$(1)_SHLIB_O_FILES=$$(call get_cpp_shlib_o_files,$$(LIB_$(1)_CPP_FILES)) \
$$(call get_cc_shlib_o_files,$$(LIB_$(1)_CC_FILES)) \
$$(call get_c_shlib_o_files,$$(LIB_$(1)_C_FILES)) \
$$(call get_m_shlib_o_files,$$(LIB_$(1)_M_FILES)) \
$$(call get_mm_shlib_o_files,$$(LIB_$(1)_MM_FILES)) \
$$(call get_rc_shlib_o_files,$$(LIB_$(1)_RC_FILES))
LIB_$(1)_DISASM_FILES=$$(LIB_$(1)_O_FILES:.o=.disasm)
LIB_$(1)_ASM_FILES=$$(LIB_$(1)_O_FILES:.o=.asm)
LIB_$(1)_EXE_FILES=$$(addprefix $$(OUTPUT_$(1)_DIR)/,$$(notdir $$(LIB_$(1)_O_FILES:.o=$$(EXE))))
LIB_$(1)_EXE_FILES+=$$(addprefix $$(OUTPUT_$(1)_DIR)/,$$(notdir $$(LIB_$(1)_PY_FILES)))
LIB_$(1)_EXE_FILES+=$$(addprefix $$(OUTPUT_$(1)_DIR)/,$$(notdir $$(LIB_$(1)_SH_FILES)))
ifeq ($(CROSS_COMPILING),1)
NATIVE_LIB_$(1)_CPP_FILES=$$(call get_file_list,$$(NATIVE_LIB_$(1)_DIR),cpp)
NATIVE_LIB_$(1)_CC_FILES=$$(call get_file_list,$$(NATIVE_LIB_$(1)_DIR),cc)
NATIVE_LIB_$(1)_C_FILES=$$(call get_file_list,$$(NATIVE_LIB_$(1)_DIR),c)
NATIVE_LIB_$(1)_M_FILES=$$(call get_file_list,$$(NATIVE_LIB_$(1)_DIR),m)
NATIVE_LIB_$(1)_MM_FILES=$$(call get_file_list,$$(NATIVE_LIB_$(1)_DIR),mm)
NATIVE_LIB_$(1)_SH_FILES=$$(call get_file_list_full,$$(NATIVE_LIB_$(1)_DIR),sh)
NATIVE_LIB_$(1)_RC_FILES=$$(call get_file_list,$$(NATIVE_LIB_$(1)_DIR),rc)
NATIVE_LIB_TOOLS_O_FILES=$$(call get_native_cpp_o_files,$$(NATIVE_LIB_$(1)_CPP_FILES)) \
$$(call get_native_cc_o_files,$$(NATIVE_LIB_$(1)_CC_FILES)) \
$$(call get_native_c_o_files,$$(NATIVE_LIB_$(1)_C_FILES)) \
$$(call get_native_m_o_files,$$(NATIVE_LIB_$(1)_M_FILES)) \
$$(call get_native_mm_o_files,$$(NATIVE_LIB_$(1)_MM_FILES)) \
$$(call get_native_rc_o_files,$$(NATIVE_LIB_$(1)_RC_FILES))
NATIVE_LIB_$(1)_EXE_FILES=$$(addprefix $$(NATIVE_OUTPUT_$(1)_DIR)/,$$(notdir $$(NATIVE_LIB_$(1)_O_FILES:.o=$$(NATIVE_EXE))))
endif
endef
# copy_file is a macro which copies a specified file to a new file name only if it originally exists
define copy_file
if [ -f "$(1)" ]; then $(CP) -p $(1) $(2); fi
endef
# copy_files is a macro which recursively copies files only if they exist from $(1) to dir $(2), potentially creating dir $(2)
define copy_files
for j in $(wildcard $(1)); do $(MKDIRS) $(2); $(CP) -p "$$j" $(2); done
endef
define copy_dirs
@for i in $(wildcard $(1)); do if [ -d "$$i" ]; then s="$$i"/; else s=`dirname "$$i"`; fi; ( $(MKDIRS) $(2); cd "$$s" && $(TAR) -c $(TAR_EXCLUDE_LIST) . | $(TAR) -C $(2) -xf - ); done
endef
ifeq ($(PACKAGE_CHOWN),)
define chown_dirs
@echo
endef
else
define chown_dirs
@for i in $(wildcard $(1)); do echo chown "$$i"; $(CHOWN) -R $(PACKAGE_CHOWN) "$$i"; $(CHOWN) -R $(PACKAGE_CHOWN) "$$i"; done
endef
endif
ifeq ($(PACKAGE_CHMOD),)
define chmod_dirs
@echo
endef
else
define chmod_dirs
@for i in $(wildcard $(1)); do $(CHMOD) -R $(PACKAGE_CHMOD) "$$i"; done
endef
endif
ifndef project-make-main-hook
define project-make-main-hook
endef
endif
ifndef project-make-dev-hook
define project-make-dev-hook
endef
endif
ifndef project-preinstall-main-hook
define project-preinstall-main-hook
endef
endif
ifndef project-preinstall-dev-hook
define project-preinstall-dev-hook
endef
endif
# erase_nondeployed_files is a macro which removes any files in dir $(1) and its subdirs that are not to be deployed
# such as .svn .hg .git and temp files
define erase_nondeployed_files
@find $(1) -type f -name '.*' -exec $(RM) \{\} \;
@find $(1) -type f -name '*~' -exec $(RM) \{\} \;
@find $(1) -type f -name '.svn' -exec $(RM) \{\} \;
@find $(1) -type f -name '.hg' -exec $(RM) \{\} \;
@find $(1) -type f -name '.git' -exec $(RM) \{\} \;
@find $(1) -type f -name '.DS_Store' -exec $(RM) \{\} \;
endef
########################################################################
# magic-options.mk
RSYNC_OPTIONS+=
SHIP_TO_ACCOUNT = $(firstword $(subst :, ,$(SHIP_TO)))
SHIP_TO_DIR = $(lastword $(subst :, ,$(SHIP_TO)))
ifeq ($(SHIP_TO_ACCOUNT),$(SHIP_TO_DIR))
SHIP_TO_USES_SSH=0
else
SHIP_TO_USES_SSH=1
endif
# compile options
# RELEASE=1 means optimize no debug
ifeq ($(RELEASE),1)
RELEASE_FLAGS?=
OPTIMIZE?=1
DEBUG?=0
COMPILE_FLAGS+=$(RELEASE_FLAGS)
endif
# having OPTIMIZE set to 1 means we compile with -O2 but you can override this by settings OPTIMIZE_FLAGS
ifeq ($(OPTIMIZE),1)
OPTIMIZE_FLAGS?=-O2
COMPILE_FLAGS+=$(OPTIMIZE_FLAGS)
endif
# having DEBUG set to 1 means we compile with -g and add preprocessor define DEBUG=1
ifeq ($(DEBUG),1)
DEBUG_FLAGS?=-g #-rdynamic
COMPILE_FLAGS+=$(DEBUG_FLAGS)
DEFINES+=DEBUG=1
LINK_FLAGS+=$(DEBUG_FLAGS)
endif
# having PROFILE set to 1 means we compile with -pg
ifeq ($(PROFILE),1)
PROFILE_FLAGS?=-pg
COMPILE_FLAGS+=$(PROFILE_FLAGS)
LINK_FLAGS+=$(PROFILE_FLAGS)
endif
# having WARNINGS set to 0 means we do not compile with -Wall. Default is 1
WARNINGS?=1
ifeq ($(WARNINGS),1)
WARNINGS_FLAGS=-Wall
COMPILE_FLAGS+=$(WARNINGS_FLAGS)
endif
ifeq ($(DISABLE_SSE),1)
SSE_COMPILE_FLAGS=
endif
CONFIG_TOOLS_PATHS:=$(foreach pkg,$(CONFIG_TOOLS),$(shell which $(pkg)))
INCLUDES_PACKAGES:=$(sort $(filter-out -Wstrict-prototypes,$(foreach pkg,$(PKGCONFIG_PACKAGES),$(shell pkg-config $(pkg) --cppflags)) $(foreach pkg,$(CONFIG_TOOLS),$(shell $(pkg) $(CONFIG_TOOLS_OPTIONS) --cppflags))))
COMPILE_FLAGS+=$(COMPILE_FLAGS_PACKAGES)
CFLAGS_PACKAGES:=$(foreach pkg,$(PKGCONFIG_PACKAGES),$(shell pkg-config $(pkg) --cflags)) $(foreach pkg,$(CONFIG_TOOLS),$(shell $(pkg) $(CONFIG_TOOLS_OPTIONS) --cflags))
CXXFLAGS_PACKAGES:=$(foreach pkg,$(PKGCONFIG_PACKAGES),$(shell pkg-config $(pkg) --cxxflags)) $(foreach pkg,$(CONFIG_TOOLS),$(shell $(pkg) $(CONFIG_TOOLS_OPTIONS) --cxxflags))
# all our */include directories
INCLUDES+=$(LIB_INCLUDE_DIR)
# our compiler defines
DEFINES?=
# The preprocessor flags is initially comprised of -I option for each include dir,
# and the -D option for each define
PREPROCESS_FLAGS+=$(addprefix -I,$(FIRST_INCLUDES)) $(addprefix -I,$(INCLUDES)) $(addprefix -D,$(DEFINES)) $(INCLUDES_PACKAGES)
SORTED_PREPROCESS_FLAGS=$(PREPROCESS_FLAGS) $(COMPILE_FLAGS_PACKAGES)
# the additional linker flags:
LDFLAGS_PACKAGES:=$(foreach pkg,$(PKGCONFIG_PACKAGES),$(shell pkg-config $(pkg) --ldflags)) $(foreach pkg,$(CONFIG_TOOLS),$(shell $(pkg) $(CONFIG_TOOLS_OPTIONS) --ldflags))
# the addition linker libraries:
LDLIBS_PACKAGES:=$(foreach pkg,$(PKGCONFIG_PACKAGES),$(shell pkg-config $(pkg) --libs)) $(foreach pkg,$(CONFIG_TOOLS),$(shell $(pkg) $(CONFIG_TOOLS_OPTIONS) --libs))
LDLIBS+=
INHERITED_LIBS+=$(LINK_FLAGS) $(LDLIBS_PACKAGES) $(LDFLAGS_PACKAGES)
# The preprocessor flags needed to generate dependency information:
DEPENDENCY_OPTIONS?=-MD
# NATIVE_RELEASE=1 means optimize no debug
ifeq ($(NATIVE_RELEASE),1)
NATIVE_OPTIMIZE?=1
NATIVE_DEBUG?=0
endif
# having OPTIMIZE set to 1 means we compile with -O2 but you can override this by settings OPTIMIZE_FLAGS
ifeq ($(NATIVE_OPTIMIZE),1)
NATIVE_OPTIMIZE_FLAGS?=-O2
NATIVE_COMPILE_FLAGS+=$(NATIVE_OPTIMIZE_FLAGS)
endif
# having DEBUG set to 1 means we compile with -g and add preprocessor define DEBUG=1
ifeq ($(NATIVE_DEBUG),1)
NATIVE_DEBUG_FLAGS?=-g
NATIVE_COMPILE_FLAGS+=$(NATIVE_DEBUG_FLAGS)
NATIVE_DEFINES+=DEBUG=1
endif
# having PROFILE set to 1 means we compile with -pg
ifeq ($(NATIVE_PROFILE),1)
NATIVE_PROFILE_FLAGS?=-pg
NATIVE_COMPILE_FLAGS+=$(NATIVE_PROFILE_FLAGS)
endif
# haviing WARNINGS set to 0 means we do not compile with -Wall. Default is 1
NATIVE_WARNINGS?=1
ifeq ($(NATIVE_WARNINGS),1)
NATIVE_WARNINGS_FLAGS=-Wall
NATIVE_COMPILE_FLAGS+=$(NATIVE_WARNINGS_FLAGS)
endif
# The native platform preprocessor flags is initially comprised of -I option for each include dir,
# and the -D option for each define
NATIVE_PREPROCESS_FLAGS=$(addprefix -I,$(INCLUDES)) $(addprefix -D,$(NATIVE_DEFINES))
SORTED_NATIVE_PREPROCESS_FLAGS=$(NATIVE_PREPROCESS_FLAGS)
# the additional linker flags:
NATIVE_LDFLAGS+=
# the addition linker libraries:
NATIVE_LDLIBS+=
LDLIBS_NO_OPTS=$(patsubst -%,,$(LDLIBS) $(LDLIBS_PACKAGES) $(PROJECT_LDLIB))
########################################################################
# magic-platform.mk
ifeq ($(QT4_MODE),1)
RAW_PLATFORM_DIRS+=qt4
endif
ifeq ($(WX_MODE),1)
RAW_PLATFORM_DIRS+=wx
endif
NATIVE_USE_AR?=1
NATIVE_USE_MACOSX_LIBTOOL?=0
# mingw32 is a subset of win32
ifeq ($(TARGET_PLATFORM_MINGW32),1)
PROJECT_ARCHITECTURE?=i386
TARGET_PLATFORM_NAME=win32-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=MINGW32 WIN32
EXE=.exe
RAW_PLATFORM_DIRS+=win32 mingw32
TARGET_PLATFORM_WIN32=1
# default to Windows XP target
WIN32_WINNT?=0x501
DEFINES+=_WIN32_WINNT=$(WIN32_WINNT)
endif
ifeq ($(TARGET_PLATFORM_MINGW32)$(RELEASE),11)
LDFLAGS+=-s
endif
# cygwin is really a subset of posix
ifeq ($(TARGET_PLATFORM_CYGWIN),1)
PROJECT_ARCHITECTURE?=i386
TARGET_PLATFORM_NAME=cygwin-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=CYGWIN POSIX
EXE=.exe
RAW_PLATFORM_DIRS+=cygwin posix
endif
# plain posix is just posix
ifeq ($(TARGET_PLATFORM_POSIX),1)
PROJECT_ARCHITECTURE?=unknown
TARGET_PLATFORM_NAME=posix-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX
RAW_PLATFORM_DIRS+=posix
endif
# linux is a subset of posix
ifeq ($(TARGET_PLATFORM_LINUX),1)
PROJECT_ARCHITECTURE_SHELL:=$(shell uname -m)
PROJECT_ARCHITECTURE?=$(PROJECT_ARCHITECTURE_SHELL)
TARGET_PLATFORM_NAME=linux-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX LINUX
RAW_PLATFORM_DIRS+=posix linux
TARGET_PLATFORM_POSIX=1
endif
# linux-i386 is a subset of linux, posix
ifeq ($(TARGET_PLATFORM_LINUX_I386),1)
PROJECT_ARCHITECTURE?=i386
TARGET_PLATFORM_NAME=linux-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX LINUX LINUX_I386
RAW_PLATFORM_DIRS+=posix linux linux-i386
TARGET_PLATFORM_LINUX?=1
TARGET_PLATFORM_POSIX=1
endif
# linux-x86_64 is a subset of linux, posix, linux-i386
ifeq ($(TARGET_PLATFORM_LINUX_X86_64),1)
PROJECT_ARCHITECTURE?=x86_64
TARGET_PLATFORM_NAME=linux-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX LINUX LINUX_I386 LINUX_X86_64
RAW_PLATFORM_DIRS+=posix linux linux-i386 linux-x86_64
LOCAL_COMPILE_FLAGS+=-m64
LOCAL_LINK_FLAGS+=-m64
TARGET_PLATFORM_LINUX_I386?=1
TARGET_PLATFORM_LINUX?=1
TARGET_PLATFORM_POSIX=1
endif
# linux-ppc is a subset of linux, posix
ifeq ($(TARGET_PLATFORM_LINUX_PPC),1)
PROJECT_ARCHITECTURE?=ppc
TARGET_PLATFORM_NAME=linux-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX LINUX LINUX_PPC
RAW_PLATFORM_DIRS+=posix linux linux-ppc
TARGET_PLATFORM_LINUX?=1
TARGET_PLATFORM_POSIX=1
endif
# linux-ppc64 is a subset of linux, linux-ppc posix
ifeq ($(TARGET_PLATFORM_LINUX_PPC64),1)
PROJECT_ARCHITECTURE?=ppc64
TARGET_PLATFORM_NAME=linux-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX LINUX LINUX_PPC LINUX_PPC64
RAW_PLATFORM_DIRS+=posix linux linux-ppc linux-ppc64
LOCAL_COMPILE_FLAGS+=-m64
LOCAL_LINK_FLAGS+=-m64
TARGET_PLATFORM_LINUX?=1
TARGET_PLATFORM_LINUX_PPC?=1
TARGET_PLATFORM_POSIX=1
endif
# xenomai is a subset of posix, linux
ifeq ($(TARGET_PLATFORM_XENOMAI),1)
PROJECT_ARCHITECTURE_SHELL:=$(shell uname -m)
PROJECT_ARCHITECTURE?=$(PROJECT_ARCHITECTURE_SHELL)
TARGET_PLATFORM_NAME=xenomai-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX LINUX XENOMAI
RAW_PLATFORM_DIRS+=posix linux xenomai
TARGET_PLATFORM_LINUX?=1
TARGET_PLATFORM_POSIX=1
endif
# xenomai-i386 is a subset of linux, posix
ifeq ($(TARGET_PLATFORM_XENOMAI_I386),1)
PROJECT_ARCHITECTURE?=i386
TARGET_PLATFORM_NAME=linux-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX LINUX LINUX_I386 XENOMAI XENOMAI_I386
RAW_PLATFORM_DIRS+=posix linux linux-i386 xenomai xenomai-i386
TARGET_PLATFORM_XENOMAI?=1
TARGET_PLATFORM_LINUX_I386?=1
TARGET_PLATFORM_LINUX?=1
TARGET_PLATFORM_POSIX=1
endif
# xenomai-x86_64 is a subset of linux, posix, linux-i386, xenomai xenomai-i386
ifeq ($(TARGET_PLATFORM_XENOMAI_X86_64),1)
PROJECT_ARCHITECTURE?=x86_64
TARGET_PLATFORM_NAME=xenomai-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX LINUX LINUX_X86_64 XENOMAI XENOMAI_I386 XENOMAI_X86_64
RAW_PLATFORM_DIRS+=posix linux linux-x86_64 xenomai xenomai-i386 xenomai-x86_64
LOCAL_COMPILE_FLAGS+=-m64
LOCAL_LINK_FLAGS+=-m64
TARGET_PLATFORM_XENOMAI_I386?=1
TARGET_PLATFORM_XENOMAI?=1
TARGET_PLATFORM_LINUX_X86_64?=1
TARGET_PLATFORM_LINUX_I386?=1
TARGET_PLATFORM_LINUX?=1
TARGET_PLATFORM_POSIX=1
endif
# xenomai-ppc is a subset of linux, posix, xenomai
ifeq ($(TARGET_PLATFORM_XENOMAI_PPC),1)
PROJECT_ARCHITECTURE?=ppc
TARGET_PLATFORM_NAME=xenomai-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX LINUX LINUX_PPC XENOMAI XENOMAI_PPC
RAW_PLATFORM_DIRS+=posix linux linux-ppc xenomai xenomai-ppc
TARGET_PLATFORM_XENOMAI_PPC?=1
TARGET_PLATFORM_XENOMAI?=1
TARGET_PLATFORM_LINUX_PPC?=1
TARGET_PLATFORM_LINUX?=1
TARGET_PLATFORM_POSIX=1
endif
# xenomai-ppc64 is a subset of linux, linux-ppc posix xenomai xenomai_ppc
ifeq ($(TARGET_PLATFORM_XENOMAI_PPC64),1)
PROJECT_ARCHITECTURE?=ppc64
TARGET_PLATFORM_NAME=xenomai-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX LINUX LINUX_PPC LINUX_PPC64 XENOMAI XENOMAI_PPC XENOMAI_PPC64
RAW_PLATFORM_DIRS+=posix linux linux-ppc linux-ppc64 xenomai xenomai-ppc xenomai-ppc64
LOCAL_COMPILE_FLAGS+=-m64
LOCAL_LINK_FLAGS+=-m64
TARGET_PLATFORM_XENOMAI_PPC?=1
TARGET_PLATFORM_XENOMAI?=1
TARGET_PLATFORM_LINUX_PPC64?=1
TARGET_PLATFORM_LINUX_PPC?=1
TARGET_PLATFORM_LINUX?=1
TARGET_PLATFORM_POSIX=1
endif
# bsd is a subset of posix
ifeq ($(TARGET_PLATFORM_BSD),1)
PROJECT_ARCHITECTURE?=unknown
TARGET_PLATFORM_NAME=bsd-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX BSD
RAW_PLATFORM_DIRS+=bsd posix
TARGET_PLATFORM_POSIX=1
endif
# freebsd is a subset of posix and bsd
ifeq ($(TARGET_PLATFORM_FREEBSD),1)
PROJECT_ARCHITECTURE?=unknown
TARGET_PLATFORM_NAME=freebsd-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX BSD FREEBSD
RAW_PLATFORM_DIRS+=bsd posix freebsd
TARGET_PLATFORM_POSIX=1
endif
# openbsd is a subset of posix and bsd
ifeq ($(TARGET_PLATFORM_OPENBSD),1)
PROJECT_ARCHITECTURE?=unknown
TARGET_PLATFORM_NAME=openbsd-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX BSD OPENBSD
RAW_PLATFORM_DIRS+=bsd posix openbsd
endif
# netbsd is a subset of posix and bsd
ifeq ($(TARGET_PLATFORM_NETBSD),1)
PROJECT_ARCHITECTURE?=unknown
TARGET_PLATFORM_NAME=netbsd-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX BSD NETBSD
RAW_PLATFORM_DIRS+=bsd posix netbsd
TARGET_PLATFORM_POSIX=1
endif
# solaris is a subset of posix
ifeq ($(TARGET_PLATFORM_SOLARIS),1)
PROJECT_ARCHITECTURE?=unknown
TARGET_PLATFORM_NAME=solaris-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX SOLARIS
RAW_PLATFORM_DIRS+=solaris posix
TARGET_PLATFORM_POSIX=1
endif
# macosx is a subset of posix
ifeq ($(TARGET_PLATFORM_MACOSX),1)
PROJECT_ARCHITECTURE_SHELL:=$(shell uname -p)
PROJECT_ARCHITECTURE?=$(PROJECT_ARCHITECTURE_SHELL)
TARGET_PLATFORM_NAME:=macosx-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX MACOSX
MACOSX_DEPLOYMENT_TARGET?=10.5
RAW_PLATFORM_DIRS+=posix macosx
DISASM=otool
DISASM_FLAGS=-t -v -V
COMPILE_FLAGS+=
LOCAL_LINK_FLAGS+=-mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET)
TARGET_PLATFORM_POSIX=1
endif
# macosx_ppc is a subset of macosx and posix
ifeq ($(TARGET_PLATFORM_MACOSX_PPC),1)
PROJECT_ARCHITECTURE?=ppc
TARGET_PLATFORM_NAME=macosx-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX MACOSX MACOSX_PPC
MACOSX_DEPLOYMENT_TARGET?=10.5
RAW_PLATFORM_DIRS+=posix macosx macosx-ppc
DISASM=otool
DISASM_FLAGS=-t -v -V
COMPILE_FLAGS+=
LOCAL_LINK_FLAGS+=-mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET)
TARGET_PLATFORM_MACOSX=1
TARGET_PLATFORM_POSIX=1
endif
# macosx_ppc64 is a subset of macosx and posix
ifeq ($(TARGET_PLATFORM_MACOSX_PPC64),1)
PROJECT_ARCHITECTURE?=ppc64
TARGET_PLATFORM_NAME=macosx-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX MACOSX MACOSX_PPC MACOSX_PPC64
MACOSX_DEPLOYMENT_TARGET?=10.5
RAW_PLATFORM_DIRS+=posix macosx macosx-ppc macosx-ppc64
DISASM=otool
DISASM_FLAGS=-t -v -V
LOCAL_COMPILE_FLAGS+=-m64
LOCAL_LINK_FLAGS+=-m64
LOCAL_LINK_FLAGS+=-mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET)
TARGET_PLATFORM_MACOSX_PPC=1
TARGET_PLATFORM_POSIX=1
endif
# macosx_i386 is a subset of macosx and posix
ifeq ($(TARGET_PLATFORM_MACOSX_I386),1)
PROJECT_ARCHITECTURE?=i386
TARGET_PLATFORM_NAME=macosx-$(PROJECT_ARCHITECTURE)
SUFFIXES_TARGET_PLATFORM=POSIX MACOSX MACOSX_I386
MACOSX_DEPLOYMENT_TARGET?=10.5
RAW_PLATFORM_DIRS+=posix macosx macosx-i386