d49db1
build system: major overhaul: removed sysinfo, integrated ccenv.
@@ -51,29 +51,29 @@ DVIDIR = @dvidir@
|
|
51
51
|
PDFDIR = @pdfdir@
|
52
52
|
PSDIR = @psdir@
|
53
53
|
|
54
|
-
CFLAGS_COMMON
|
55
|
-
CFLAGS_DEBUG
|
56
|
-
CFLAGS_CMDLINE
|
57
|
-
CFLAGS_CONFIG
|
58
|
-
CFLAGS_SYSROOT
|
59
|
-
CFLAGS_OS
|
60
|
-
CFLAGS_SITE
|
61
|
-
CFLAGS_PATH
|
62
|
-
CFLAGS_STRICT
|
63
|
-
CFLAGS_UTIL
|
64
|
-
CFLAGS_LAST
|
65
|
-
CFLAGS_ONCE
|
66
|
-
|
67
|
-
LDFLAGS_COMMON
|
68
|
-
LDFLAGS_DEBUG
|
69
|
-
LDFLAGS_CMDLINE
|
70
|
-
LDFLAGS_CONFIG
|
71
|
-
LDFLAGS_SYSROOT
|
72
|
-
LDFLAGS_PATH
|
73
|
-
LDFLAGS_STRICT
|
74
|
-
LDFLAGS_UTIL
|
75
|
-
LDFLAGS_LAST
|
76
|
-
LDFLAGS_ONCE
|
54
|
+
CFLAGS_COMMON += @cflags_common@
|
55
|
+
CFLAGS_DEBUG += @cflags_debug@
|
56
|
+
CFLAGS_CMDLINE += @cflags_cmdline@
|
57
|
+
CFLAGS_CONFIG += @cflags_config@
|
58
|
+
CFLAGS_SYSROOT += @cflags_sysroot@
|
59
|
+
CFLAGS_OS += @cflags_os@
|
60
|
+
CFLAGS_SITE += @cflags_site@
|
61
|
+
CFLAGS_PATH += @cflags_path@
|
62
|
+
CFLAGS_STRICT += @cflags_strict@
|
63
|
+
CFLAGS_UTIL += @cflags_util@
|
64
|
+
CFLAGS_LAST += @cflags_last@
|
65
|
+
CFLAGS_ONCE += @cflags_once@
|
66
|
+
|
67
|
+
LDFLAGS_COMMON += @ldflags_common@
|
68
|
+
LDFLAGS_DEBUG += @ldflags_debug@
|
69
|
+
LDFLAGS_CMDLINE += @ldflags_cmdline@
|
70
|
+
LDFLAGS_CONFIG += @ldflags_config@
|
71
|
+
LDFLAGS_SYSROOT += @ldflags_sysroot@
|
72
|
+
LDFLAGS_PATH += @ldflags_path@
|
73
|
+
LDFLAGS_STRICT += @ldflags_strict@
|
74
|
+
LDFLAGS_UTIL += @ldflags_util@
|
75
|
+
LDFLAGS_LAST += @ldflags_last@
|
76
|
+
LDFLAGS_ONCE += @ldflags_once@
|
77
77
|
|
78
78
|
USER_CC = @user_cc@
|
79
79
|
USER_CPP = @user_cpp@
|
@@ -87,15 +87,10 @@ ELF_EH_FRAME = @elf_eh_frame@
|
|
87
87
|
ELF_HASH_STYLE = @elf_hash_style@
|
88
88
|
ELF_CONFIG_DEFS = @elf_config_defs@
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
90
|
+
NATIVE_HOST = @native_host@
|
91
|
+
NATIVE_CFGHOST = @native_cfghost@
|
92
|
+
NATIVE_CFLAGS = @native_cflags@
|
93
|
+
NATIVE_LDFLAGS = @native_ldflags@
|
94
|
-
NATIVE_CC_LDFLAGS = @native_cc_ldflags@
|
95
|
-
|
96
|
-
NATIVE_OS = @native_os@
|
97
|
-
NATIVE_OS_BITS = @native_os_bits@
|
98
|
-
NATIVE_OS_UNDERSCORE = @native_os_underscore@
|
99
94
|
|
100
95
|
ALL_SHARED = @all_shared@
|
101
96
|
ALL_STATIC = @all_static@
|
@@ -114,10 +109,8 @@ static:
|
|
114
109
|
install-extras:
|
115
110
|
install-app-extras:
|
116
111
|
|
117
|
-
include
|
118
|
-
include
|
112
|
+
include ./ccenv/host.mk
|
113
|
+
include ./ccenv/native.mk
|
119
|
-
include $(PROJECT_DIR)/sysinfo/toolchain/$(TOOLCHAIN).mk
|
120
|
-
include $(PROJECT_DIR)/sysinfo/os/$(OS).mk
|
121
114
|
|
122
115
|
include ./cfgdefs.mk
|
123
116
|
include ./usrdefs.mk
|
@@ -259,7 +252,7 @@ host.tag: Makefile
|
|
259
252
|
mv host.tmp host.tag
|
260
253
|
|
261
254
|
version.tag: $(GIT_REFERENCE_INDEX) dirs.tag
|
262
|
-
$(PROJECT_DIR)/
|
255
|
+
$(PROJECT_DIR)/sofort/version.sh \
|
263
256
|
-s $(SOURCE_DIR) \
|
264
257
|
-o build/$(PACKAGE)_version.h \
|
265
258
|
-p $(PACKAGE)
|
@@ -424,10 +417,13 @@ clean: clean-implib
|
|
424
417
|
|
425
418
|
.display-build:
|
426
419
|
@echo NATIVE_CC:' '$(NATIVE_CC)
|
427
|
-
@echo
|
428
|
-
@echo
|
429
|
-
|
430
|
-
@echo
|
420
|
+
@echo NATIVE_CPP:' '$(NATIVE_CPP)
|
421
|
+
@echo NATIVE_CXX:' '$(NATIVE_CXX)
|
422
|
+
|
423
|
+
@echo NATIVE_HOST:' '$(NATIVE_HOST)
|
424
|
+
@echo NATIVE_CFGHOST:' '$(NATIVE_CFGHOST)
|
425
|
+
@echo NATIVE_CFLAGS:' '$(NATIVE_CFLAGS)
|
426
|
+
@echo NATIVE_LDFLAGS:' '$(NATIVE_LDFLAGS)
|
431
427
|
@echo
|
432
428
|
@echo NATIVE_OS:' '$(NATIVE_OS)
|
433
429
|
@echo NATIVE_OS_BITS:' '$(NATIVE_OS_BITS)
|
@@ -154,10 +154,13 @@ supported variables:
|
|
154
154
|
ELF_CONFIG_DEFS
|
155
155
|
|
156
156
|
NATIVE_CC
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
157
|
+
NATIVE_CPP
|
158
|
+
NATIVE_CXX
|
159
|
+
|
160
|
+
NATIVE_HOST
|
161
|
+
NATIVE_CFGHOST
|
162
|
+
NATIVE_CFLAGS
|
163
|
+
NATIVE_LDFLAGS
|
161
164
|
|
162
165
|
NATIVE_OS
|
163
166
|
NATIVE_OS_BITS
|
@@ -69,6 +69,18 @@ init_vars()
|
|
69
69
|
eval "$mb_expr"
|
70
70
|
done
|
71
71
|
|
72
|
+
# ccenv
|
73
|
+
. $mb_project_dir/sofort/ccenv/ccenv.sh
|
74
|
+
|
75
|
+
if ! readlink ./ccenv > /dev/null; then
|
76
|
+
if [ -d ./ccenv ]; then
|
77
|
+
rm -f ./ccenv/host.mk
|
78
|
+
rm -f ./ccenv/native.mk
|
79
|
+
rmdir ./ccenv
|
80
|
+
fi
|
81
|
+
fi
|
82
|
+
|
83
|
+
# config.project
|
72
84
|
if [ -z "$mb_config" ]; then
|
73
85
|
. $mb_project_dir/config.project
|
74
86
|
else
|
@@ -169,19 +181,18 @@ init_vars()
|
|
169
181
|
mb_elf_config_defs=$ELF_CONFIG_DEFS
|
170
182
|
|
171
183
|
# overrides
|
172
|
-
mb_native_cc=$NATIVE_CC
|
173
|
-
mb_native_cc_host=$NATIVE_CC_HOST
|
174
|
-
mb_native_cc_cfghost=$NATIVE_CC_CFGHOST
|
175
|
-
mb_native_cc_cflags=$NATIVE_CC_CFLAGS
|
176
|
-
mb_native_cc_ldflags=$NATIVE_CC_LDFLAGS
|
177
|
-
|
178
|
-
mb_native_os=$NATIVE_OS
|
179
|
-
mb_native_os_bits=$NATIVE_OS_BITS
|
180
|
-
mb_native_os_underscore=$NATIVE_OS_UNDERSCORE
|
181
|
-
|
182
184
|
mb_user_cc=$CC
|
183
185
|
mb_user_cpp=$CPP
|
184
186
|
mb_user_cxx=$CXX
|
187
|
+
|
188
|
+
mb_native_cc=$NATIVE_CC
|
189
|
+
mb_native_cpp=$NATIVE_CPP
|
190
|
+
mb_native_cxx=$NATIVE_CXX
|
191
|
+
|
192
|
+
mb_native_host=$NATIVE_HOST
|
193
|
+
mb_native_cfghost=$NATIVE_CFGHOST
|
194
|
+
mb_native_cflags=$NATIVE_CFLAGS
|
195
|
+
mb_native_ldflags=$NATIVE_LDFLAGS
|
185
196
|
}
|
186
197
|
|
187
198
|
|
@@ -351,132 +362,6 @@ common_defaults()
|
|
351
362
|
mb_cflags_debug='-g3 -O0'
|
352
363
|
fi
|
353
364
|
fi
|
354
|
-
|
355
|
-
# toolchain
|
356
|
-
if [ -z "$mb_toolchain" ]; then
|
357
|
-
mb_toolchain='binutils'
|
358
|
-
fi
|
359
|
-
|
360
|
-
# fallback host recipe
|
361
|
-
if [ -n "$mb_host" ]; then
|
362
|
-
if ! [ -f $mb_project_dir/sysinfo/host/$mb_host.mk ]; then
|
363
|
-
if [ -z "$mb_cross_compile" ]; then
|
364
|
-
mb_cross_compile=$mb_host-
|
365
|
-
fi
|
366
|
-
|
367
|
-
mb_host='any-host';
|
368
|
-
fi
|
369
|
-
fi
|
370
|
-
|
371
|
-
# fallback compiler recipe
|
372
|
-
if [ -n "$mb_compiler" ]; then
|
373
|
-
if ! [ -f $mb_project_dir/sysinfo/compiler/$mb_compiler.mk ]; then
|
374
|
-
mb_compiler='any-compiler'
|
375
|
-
fi
|
376
|
-
fi
|
377
|
-
}
|
378
|
-
|
379
|
-
|
380
|
-
native_defaults()
|
381
|
-
{
|
382
|
-
# CC (when set, must be valid)
|
383
|
-
if [ -n "$CC" ]; then
|
384
|
-
$CC -dM -E - < /dev/null > /dev/null
|
385
|
-
fi
|
386
|
-
|
387
|
-
# compiler
|
388
|
-
[ -z "$mb_native_cc" ] && mb_native_cc='cc'
|
389
|
-
$mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
|
390
|
-
|
391
|
-
[ -z "$mb_native_cc" ] && mb_native_cc='gcc'
|
392
|
-
$mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
|
393
|
-
|
394
|
-
[ -z "$mb_native_cc" ] && mb_native_cc='clang'
|
395
|
-
$mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
|
396
|
-
|
397
|
-
[ -z "$mb_native_cc" ] && mb_native_cc='cparser'
|
398
|
-
$mb_native_cc -dM -E - < /dev/null > /dev/null 2>/dev/null || mb_native_cc=
|
399
|
-
|
400
|
-
if [ -z "$mb_native_cc" ]; then
|
401
|
-
echo "configure: info: could not find a working native compiler."
|
402
|
-
mb_native_cc='false'
|
403
|
-
fi
|
404
|
-
|
405
|
-
if [ -z "$mb_native_cc_host" ]; then
|
406
|
-
mb_native_cc_host=$($mb_native_cc $mb_native_cc_cflags -dumpmachine)
|
407
|
-
fi
|
408
|
-
|
409
|
-
if [ -z "$mb_compiler" ]; then
|
410
|
-
$mb_native_cc -dM -E - < /dev/null | grep -q '__clang__' && mb_compiler='clang'
|
411
|
-
fi
|
412
|
-
|
413
|
-
if [ -z "$mb_compiler" ]; then
|
414
|
-
$mb_native_cc -dM -E - < /dev/null | grep -q '__GCC' && mb_compiler='gcc'
|
415
|
-
fi
|
416
|
-
|
417
|
-
if [ -z "$mb_compiler" ]; then
|
418
|
-
$mb_native_cc -dM -E - < /dev/null | grep -q "^gcc" && mb_compiler='gcc'
|
419
|
-
fi
|
420
|
-
|
421
|
-
if [ -z "$mb_compiler" ]; then
|
422
|
-
$mb_native_cc -dM -E - < /dev/null | grep -q '__CPARSER__' && mb_compiler='cparser'
|
423
|
-
fi
|
424
|
-
|
425
|
-
if [ -z "$mb_compiler" ]; then
|
426
|
-
echo "configure: info: could not identify the native compiler."
|
427
|
-
mb_compiler='any-compiler'
|
428
|
-
fi
|
429
|
-
|
430
|
-
|
431
|
-
# host
|
432
|
-
if [ -z "$mb_host" ]; then
|
433
|
-
mb_host='native'
|
434
|
-
fi
|
435
|
-
|
436
|
-
|
437
|
-
# target
|
438
|
-
if [ -z "$mb_target" ]; then
|
439
|
-
mb_target='native'
|
440
|
-
fi
|
441
|
-
|
442
|
-
|
443
|
-
# os
|
444
|
-
if [ -z "$mb_native_os" ]; then
|
445
|
-
mb_native_os=$(uname | tr '[:upper:]' '[:lower:]')
|
446
|
-
fi
|
447
|
-
|
448
|
-
mb_native_os_sizeof_pointer=$($mb_native_cc -dM -E - < /dev/null \
|
449
|
-
| awk '$2 == "__SIZEOF_POINTER__" { print $3 }')
|
450
|
-
|
451
|
-
mb_native_os_bits=$((8 * ${mb_native_os_sizeof_pointer:-0}))
|
452
|
-
|
453
|
-
if [ $mb_native_os_bits = 32 ]; then
|
454
|
-
mb_native_os_underscore='_'
|
455
|
-
else
|
456
|
-
mb_native_os_underscore=''
|
457
|
-
fi
|
458
|
-
|
459
|
-
if [ -z "$mb_native_os_sizeof_pointer" ]; then
|
460
|
-
warning_msg "config error: could not determine size of pointer on native system."
|
461
|
-
fi
|
462
|
-
|
463
|
-
# grumpily support crooked uname output
|
464
|
-
if ! [ -f $mb_project_dir/sysinfo/os/$mb_native_os.mk ]; then
|
465
|
-
mb_native_os=$(echo $mb_native_os | cut -d'_' -f1)
|
466
|
-
fi
|
467
|
-
|
468
|
-
# fallback os recipe
|
469
|
-
if ! [ -f $mb_project_dir/sysinfo/os/$mb_native_os.mk ]; then
|
470
|
-
mb_native_os='any-os';
|
471
|
-
fi
|
472
|
-
}
|
473
|
-
|
474
|
-
|
475
|
-
cross_defaults()
|
476
|
-
{
|
477
|
-
if [ -z "$mb_cross_compile" ] && [ "$mb_host" != native ]; then
|
478
|
-
mb_cross_compile=$mb_host'-'
|
479
|
-
fi
|
480
365
|
}
|
481
366
|
|
482
367
|
|
@@ -517,23 +402,18 @@ config_copy()
|
|
517
402
|
$mb_project_dir/Makefile.in \
|
518
403
|
| sed -e 's/[ \t]*$//g' \
|
519
404
|
> $mb_pwd/Makefile.tmp
|
405
|
+
}
|
520
406
|
|
521
|
-
if [ -z "$mb_cchost" ]; then
|
522
|
-
if [ "$mb_host" = 'native' ]; then
|
523
|
-
if [ -n "$mb_user_cc" ]; then
|
524
|
-
mbt_cc="$mb_user_cc"
|
525
|
-
else
|
526
|
-
mbt_cc="$mb_native_cc"
|
527
|
-
fi
|
528
407
|
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
408
|
+
config_ccenv()
|
409
|
+
{
|
410
|
+
mkdir -p ./ccenv
|
411
|
+
touch ./ccenv/host.mk
|
412
|
+
touch ./ccenv/native.mk
|
534
|
-
fi
|
535
|
-
}
|
536
413
|
|
414
|
+
ccenv_set_host_variables
|
415
|
+
ccenv_set_native_variables
|
416
|
+
}
|
537
417
|
|
538
418
|
config_custom()
|
539
419
|
{
|
@@ -631,7 +511,32 @@ verify_build_directory
|
|
631
511
|
two: args
|
632
512
|
for arg ; do
|
633
513
|
case "$arg" in
|
634
|
-
--help)
|
514
|
+
--help)
|
515
|
+
usage
|
516
|
+
;;
|
517
|
+
--help=ccenv)
|
518
|
+
ccenv_usage
|
519
|
+
;;
|
520
|
+
|
521
|
+
# ccenv
|
522
|
+
--cross-compile=*)
|
523
|
+
mb_cross_compile=${arg#*=}
|
524
|
+
;;
|
525
|
+
--compiler=*)
|
526
|
+
mb_compiler=${arg#*=}
|
527
|
+
;;
|
528
|
+
--toolchain=*)
|
529
|
+
mb_toolchain=${arg#*=}
|
530
|
+
;;
|
531
|
+
--zealous)
|
532
|
+
mb_agnostic=yes
|
533
|
+
mb_zealous=
|
534
|
+
;;
|
535
|
+
--zealous=*)
|
536
|
+
mb_zealous=${arg#*=}
|
537
|
+
;;
|
538
|
+
--ccenv=*)
|
539
|
+
mb_ccenv=${arg#*=}
|
635
540
|
;;
|
636
541
|
|
637
542
|
# dirs
|
@@ -724,18 +629,9 @@ for arg ; do
|
|
724
629
|
--arch=*)
|
725
630
|
mb_arch=${arg#*=}
|
726
631
|
;;
|
727
|
-
--compiler=*)
|
728
|
-
mb_compiler=${arg#*=}
|
729
|
-
;;
|
730
|
-
--toolchain=*)
|
731
|
-
mb_toolchain=${arg#*=}
|
732
|
-
;;
|
733
632
|
--sysroot=*)
|
734
633
|
mb_sysroot=${arg#*=}
|
735
634
|
;;
|
736
|
-
--cross-compile=*)
|
737
|
-
mb_cross_compile=${arg#*=}
|
738
|
-
;;
|
739
635
|
--shell=*)
|
740
636
|
mb_shell=${arg#*=}
|
741
637
|
;;
|
@@ -867,14 +763,12 @@ fi
|
|
867
763
|
|
868
764
|
four: defaults
|
869
765
|
common_defaults
|
870
|
-
native_defaults
|
871
|
-
cross_defaults
|
872
|
-
|
873
766
|
|
874
767
|
|
875
768
|
five: config
|
876
769
|
config_flags
|
877
770
|
config_copy
|
771
|
+
config_ccenv
|
878
772
|
config_custom
|
879
773
|
config_cfghost
|
880
774
|
config_support
|
@@ -0,0 +1,85 @@
|
|
1
|
+
@ccenv_cfgtype@ system flavor
|
2
|
+
OS = @ccenv_os@
|
3
|
+
OS_SEMANTICS = @ccenv_os_semantics@
|
4
|
+
|
5
|
+
OS_DSO_EXRULES = @ccenv_os_dso_exrules@
|
6
|
+
OS_DSO_LINKAGE = @ccenv_os_dso_linkage@
|
7
|
+
|
8
|
+
OS_APP_PREFIX = @ccenv_os_app_prefix@
|
9
|
+
OS_APP_SUFFIX = @ccenv_os_app_suffix@
|
10
|
+
|
11
|
+
OS_LIB_PREFIX = @ccenv_os_lib_prefix@
|
12
|
+
OS_LIB_SUFFIX = @ccenv_os_lib_suffix@
|
13
|
+
|
14
|
+
OS_IMPLIB_EXT = @ccenv_os_implib_ext@
|
15
|
+
OS_LIBDEF_EXT = @ccenv_os_libdef_ext@
|
16
|
+
|
17
|
+
OS_ARCHIVE_EXT = @ccenv_os_archive_ext@
|
18
|
+
OS_SONAME = @ccenv_os_soname@
|
19
|
+
|
20
|
+
OS_LIB_PREFIXED_SUFFIX = @ccenv_os_lib_prefixed_suffix@
|
21
|
+
OS_LIB_SUFFIXED_SUFFIX = @ccenv_os_lib_suffixed_suffix@
|
22
|
+
|
23
|
+
@ccenv_cfgtype@ characteristics
|
24
|
+
CC_HOST = @ccenv_cc_host@
|
25
|
+
CC_BITS = @ccenv_cc_bits@
|
26
|
+
|
27
|
+
CC_BINFMT = @ccenv_cc_binfmt@
|
28
|
+
CC_UNDERSCORE = @ccenv_cc_underscore@
|
29
|
+
|
30
|
+
CC_ARCH_BFD = @ccenv_cc_arch_bfd@
|
31
|
+
CC_ARCH_LLVM = @ccenv_cc_arch_llvm@
|
32
|
+
|
33
|
+
incompatible tool variants
|
34
|
+
AS_ASM = @ccenv_as_asm@
|
35
|
+
AS_LL = @ccenv_as_ll@
|
36
|
+
AS_MC = @ccenv_as_mc@
|
37
|
+
|
38
|
+
LD_BFD = @ccenv_ld_bfd@
|
39
|
+
LD_GOLD = @ccenv_ld_gold@
|
40
|
+
LD_LLD = @ccenv_ld_lld@
|
41
|
+
|
42
|
+
OBJDUMP_BFD = @ccenv_objdump_bfd@
|
43
|
+
OBJDUMP_LLVM = @ccenv_objdump_llvm@
|
44
|
+
|
45
|
+
READELF_BFD = @ccenv_readelf_bfd@
|
46
|
+
READELF_LLVM = @ccenv_readelf_llvm@
|
47
|
+
|
48
|
+
@ccenv_cfgtype@ primary tools
|
49
|
+
CC = @ccenv_cc@
|
50
|
+
CPP = @ccenv_cpp@
|
51
|
+
CXX = @ccenv_cxx@
|
52
|
+
|
53
|
+
AR = @ccenv_ar@
|
54
|
+
NM = @ccenv_nm@
|
55
|
+
OBJDUMP = @ccenv_objdump@
|
56
|
+
RANLIB = @ccenv_ranlib@
|
57
|
+
SIZE = @ccenv_size@
|
58
|
+
STRIP = @ccenv_strip@
|
59
|
+
STRINGS = @ccenv_strings@
|
60
|
+
|
61
|
+
ADDR2LINE = @ccenv_addr2line@
|
62
|
+
COV = @ccenv_cov@
|
63
|
+
CXXFILT = @ccenv_cxxfilt@
|
64
|
+
OBJCOPY = @ccenv_objcopy@
|
65
|
+
|
66
|
+
ELFEDIT = @ccenv_elfedit@
|
67
|
+
READELF = @ccenv_readelf@
|
68
|
+
READOBJ = @ccenv_readobj@
|
69
|
+
|
70
|
+
PERK = @ccenv_perk@
|
71
|
+
MDSO = @ccenv_mdso@
|
72
|
+
DLLTOOL = @ccenv_dlltool@
|
73
|
+
|
74
|
+
WINDMC = @ccenv_windmc@
|
75
|
+
WINDRC = @ccenv_windrc@
|
76
|
+
|
77
|
+
@ccenv_cfgtype@ secondary tools
|
78
|
+
# note: the direct use of $(@ccenv_makevar_prefix@LD) is highly discouraged
|
79
|
+
AS = @ccenv_as@
|
80
|
+
LD = @ccenv_ld@
|
81
|
+
|
82
|
+
@ccenv_cfgtype@ cflags
|
83
|
+
CFLAGS_OS += @ccenv_cflags_os@
|
84
|
+
CFLAGS_PIC += @ccenv_cflags_pic@
|
85
|
+
|
@@ -0,0 +1,1021 @@
|
|
1
|
+
# ccenv.sh: sofort's tool-finding bits,
|
2
|
+
# invoked from within the project-agnostic configure script.
|
3
|
+
|
4
|
+
# invocation and names of binary tools:
|
5
|
+
# agnostic names (ar, nm, objdump, ...);
|
6
|
+
# target-prefixed agnostic names (x86_64-nt64-midipix-ar, ...);
|
7
|
+
# branded names (llvm-ar, llvm-nm, llvm-objdump, ...);
|
8
|
+
# target-prefixed branded names (x86_64-linux-gnu-gcc-ar, ...);
|
9
|
+
# target-specifying branded tools (llvm-ar --target=x86_64-linux, ...).
|
10
|
+
|
11
|
+
# cross-compilation: default search order:
|
12
|
+
# target-prefixed agnostic tools;
|
13
|
+
# target-prefixed branded tools, starting with the prefix
|
14
|
+
# most commonly associated with the selected compiler (that is,
|
15
|
+
# ``gcc'' when using gcc, and ``llvm'' when using clang);
|
16
|
+
# target-speficying branded tools, starting once again with the
|
17
|
+
# prefix most commonly associated with the selected compiler.
|
18
|
+
|
19
|
+
# internal variables of interest:
|
20
|
+
# ccenv_cfgtype: the type of host being tested (host/native)
|
21
|
+
# ccenv_cfgfile: the configuration file for the host being tested
|
22
|
+
# ccenv_cflags: the comprehensive cflags for the host being tested
|
23
|
+
# ccenv_cchost: the host being tested, as reported by -dumpmachine
|
24
|
+
|
25
|
+
|
26
|
+
ccenv_usage()
|
27
|
+
{
|
28
|
+
cat "$mb_project_dir"/sofort/ccenv/ccenv.usage
|
29
|
+
exit 0
|
30
|
+
}
|
31
|
+
|
32
|
+
|
33
|
+
ccenv_newline()
|
34
|
+
{
|
35
|
+
printf '\n' >> "$ccenv_cfgfile"
|
36
|
+
}
|
37
|
+
|
38
|
+
|
39
|
+
ccenv_comment()
|
40
|
+
{
|
41
|
+
ccenv_internal_str='#'
|
42
|
+
|
43
|
+
for ccenv_internal_arg ; do
|
44
|
+
ccenv_internal_str="$ccenv_internal_str $ccenv_internal_arg"
|
45
|
+
done
|
46
|
+
|
47
|
+
printf '%s\n' "$ccenv_internal_str" >> "$ccenv_cfgfile"
|
48
|
+
}
|
49
|
+
|
50
|
+
|
51
|
+
ccenv_find_tool()
|
52
|
+
{
|
53
|
+
if [ -z "$ccenv_prefixes" ]; then
|
54
|
+
for ccenv_tool in $ccenv_candidates; do
|
55
|
+
command -v "$ccenv_tool" > /dev/null && return 0
|
56
|
+
done
|
57
|
+
|
58
|
+
ccenv_tool=false
|
59
|
+
|
60
|
+
return 0
|
61
|
+
fi
|
62
|
+
|
63
|
+
for ccenv_prefix in $ccenv_prefixes; do
|
64
|
+
for ccenv_candidate in $ccenv_candidates; do
|
65
|
+
ccenv_tool="$ccenv_prefix$ccenv_candidate"
|
66
|
+
command -v "$ccenv_tool" > /dev/null && return 0
|
67
|
+
done
|
68
|
+
done
|
69
|
+
|
70
|
+
for ccenv_tool in $ccenv_candidates; do
|
71
|
+
command -v "$ccenv_tool" > /dev/null && return 0
|
72
|
+
done
|
73
|
+
|
74
|
+
ccenv_tool=false
|
75
|
+
|
76
|
+
return 0
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
ccenv_set_primary_tools()
|
81
|
+
{
|
82
|
+
ccenv_core_tools="ar nm objdump ranlib size strip strings objcopy"
|
83
|
+
ccenv_hack_tools="addr2line cov elfedit readelf readobj"
|
84
|
+
ccenv_peep_tools="perk mdso dlltool windmc windres"
|
85
|
+
|
86
|
+
for __tool in $ccenv_core_tools $ccenv_hack_tools $ccenv_peep_tools; do
|
87
|
+
if [ -n "$mb_agnostic" ]; then
|
88
|
+
ccenv_candidates=" $__tool"
|
89
|
+
|
90
|
+
elif [ -n "$mb_zealous" ]; then
|
91
|
+
ccenv_candidates="$mb_zealous-$__tool"
|
92
|
+
|
93
|
+
elif [ "$mb_toolchain" = 'gcc' ]; then
|
94
|
+
ccenv_candidates="gcc-$__tool"
|
95
|
+
ccenv_candidates="$ccenv_candidates $__tool"
|
96
|
+
ccenv_candidates="$ccenv_candidates llvm-$__tool"
|
97
|
+
|
98
|
+
elif [ "$mb_toolchain" = 'llvm' ]; then
|
99
|
+
ccenv_candidates="llvm-$__tool"
|
100
|
+
ccenv_candidates="$ccenv_candidates $__tool"
|
101
|
+
ccenv_candidates="$ccenv_candidates gcc-$__tool"
|
102
|
+
|
103
|
+
elif [ -n "$mb_toolchain" ]; then
|
104
|
+
ccenv_candidates="$mb_toolchain-$__tool"
|
105
|
+
ccenv_candidates="$ccenv_candidates $__tool"
|
106
|
+
ccenv_candidates="$ccenv_candidates gcc-$__tool"
|
107
|
+
ccenv_candidates="$ccenv_candidates llvm-$__tool"
|
108
|
+
|
109
|
+
else
|
110
|
+
ccenv_candidates="$__tool"
|
111
|
+
ccenv_candidates="$ccenv_candidates gcc-$__tool"
|
112
|
+
ccenv_candidates="$ccenv_candidates llvm-$__tool"
|
113
|
+
fi
|
114
|
+
|
115
|
+
if [ "$ccenv_cfgtype" = 'host' ]; then
|
116
|
+
ccenv_var_prefix='mb_'
|
117
|
+
else
|
118
|
+
ccenv_var_prefix='mb_native_'
|
119
|
+
fi
|
120
|
+
|
121
|
+
ccenv_var_name=$ccenv_var_prefix$__tool
|
122
|
+
ccenv_var_expr='${'$ccenv_var_name':-}'
|
123
|
+
eval ccenv_var_val=$ccenv_var_expr
|
124
|
+
|
125
|
+
if [ -n "$ccenv_var_val" ]; then
|
126
|
+
eval ccenv_$__tool="$ccenv_var_val"
|
127
|
+
else
|
128
|
+
ccenv_find_tool
|
129
|
+
eval ccenv_$__tool="$ccenv_tool"
|
130
|
+
fi
|
131
|
+
done
|
132
|
+
|
133
|
+
# windrc
|
134
|
+
ccenv_windrc="$ccenv_windres"
|
135
|
+
}
|
136
|
+
|
137
|
+
ccenv_set_tool_variants()
|
138
|
+
{
|
139
|
+
# as (asm)
|
140
|
+
ccenv_candidates=as
|
141
|
+
ccenv_find_tool
|
142
|
+
|
143
|
+
if [ "$ccenv_tool" = false ]; then
|
144
|
+
ccenv_as_asm=
|
145
|
+
else
|
146
|
+
$ccenv_tool --help | grep -i '.bc assembler' \
|
147
|
+
|| ccenv_as_asm="$ccenv_tool"
|
148
|
+
fi
|
149
|
+
|
150
|
+
# as (ll)
|
151
|
+
ccenv_candidates=llvm-as
|
152
|
+
ccenv_find_tool
|
153
|
+
|
154
|
+
if [ "$ccenv_tool" != false ]; then
|
155
|
+
ccenv_as_ll="$ccenv_tool"
|
156
|
+
fi
|
157
|
+
|
158
|
+
# as (mc)
|
159
|
+
ccenv_candidates=llvm-mc
|
160
|
+
ccenv_find_tool
|
161
|
+
|
162
|
+
if [ "$ccenv_tool" != false ]; then
|
163
|
+
ccenv_as_mc="$ccenv_tool"
|
164
|
+
fi
|
165
|
+
|
166
|
+
# ld (bfd)
|
167
|
+
ccenv_candidates=ld.bfd
|
168
|
+
ccenv_find_tool
|
169
|
+
|
170
|
+
if [ "$ccenv_tool" != false ]; then
|
171
|
+
ccenv_ld_bfd="$ccenv_tool"
|
172
|
+
fi
|
173
|
+
|
174
|
+
# ld (gold)
|
175
|
+
ccenv_candidates=ld.gold
|
176
|
+
ccenv_find_tool
|
177
|
+
|
178
|
+
if [ "$ccenv_tool" != false ]; then
|
179
|
+
ccenv_ld_gold="$ccenv_tool"
|
180
|
+
fi
|
181
|
+
|
182
|
+
# ld (lld)
|
183
|
+
ccenv_candidates=lld
|
184
|
+
ccenv_find_tool
|
185
|
+
|
186
|
+
if [ "$ccenv_tool" != false ]; then
|
187
|
+
ccenv_ld_lld="$ccenv_tool"
|
188
|
+
fi
|
189
|
+
|
190
|
+
# objdump (bfd)
|
191
|
+
ccenv_candidates=objdump
|
192
|
+
ccenv_find_tool
|
193
|
+
|
194
|
+
$ccenv_tool --version | grep -i Binutils \
|
195
|
+
> /dev/null \
|
196
|
+
&& ccenv_objdump_bfd="$ccenv_tool"
|
197
|
+
|
198
|
+
# objdump (llvm)
|
199
|
+
ccenv_candidates=llvm-objdump
|
200
|
+
ccenv_find_tool
|
201
|
+
|
202
|
+
$ccenv_tool --version | grep -i LLVM \
|
203
|
+
> /dev/null \
|
204
|
+
&& ccenv_objdump_llvm="$ccenv_tool"
|
205
|
+
|
206
|
+
# readelf (bfd)
|
207
|
+
ccenv_candidates=readelf
|
208
|
+
ccenv_find_tool
|
209
|
+
|
210
|
+
$ccenv_tool --version | grep -i Binutils \
|
211
|
+
> /dev/null \
|
212
|
+
&& ccenv_readelf_bfd="$ccenv_tool"
|
213
|
+
|
214
|
+
# readelf (llvm)
|
215
|
+
ccenv_candidates=llvm-readelf
|
216
|
+
ccenv_find_tool
|
217
|
+
|
218
|
+
$ccenv_tool --version | grep -i LLVM \
|
219
|
+
> /dev/null \
|
220
|
+
&& ccenv_readelf_llvm="$ccenv_tool"
|
221
|
+
|
222
|
+
# as
|
223
|
+
if [ -n "$ccenv_cc" ]; then
|
224
|
+
ccenv_as='$('"$ccenv_makevar_prefix"'CC) -x assembler'
|
225
|
+
elif [ -n "$mb_agnostic" ]; then
|
226
|
+
ccenv_as='$('"$ccenv_makevar_prefix"'AS_ASM)'
|
227
|
+
elif [ "$mb_zealous" = 'gcc' ]; then
|
228
|
+
ccenv_as='$('"$ccenv_makevar_prefix"'AS_ASM)'
|
229
|
+
elif [ -n "$mb_zealous" = 'llvm' ]; then
|
230
|
+
ccenv_as='$('"$ccenv_makevar_prefix"'AS_MC)'
|
231
|
+
elif [ "$mb_toolchain" = 'gcc' ]; then
|
232
|
+
ccenv_as='$('"$ccenv_makevar_prefix"'AS_ASM)'
|
233
|
+
elif [ "$mb_toolchain" = 'llvm' ]; then
|
234
|
+
ccenv_as='$('"$ccenv_makevar_prefix"'AS_MC)'
|
235
|
+
fi
|
236
|
+
|
237
|
+
# ld
|
238
|
+
if [ -n "$ccenv_cc" ]; then
|
239
|
+
ccenv_ld='$('"$ccenv_makevar_prefix"'CC) -nostdlib -nostartfiles'
|
240
|
+
fi
|
241
|
+
}
|
242
|
+
|
243
|
+
ccenv_set_c_compiler_candidates()
|
244
|
+
{
|
245
|
+
if [ -n "$mb_compiler" ]; then
|
246
|
+
ccenv_candidates="$mb_compiler"
|
247
|
+
|
248
|
+
elif [ -n "$mb_agnostic" ]; then
|
249
|
+
ccenv_candidates="c99 c11 cc"
|
250
|
+
|
251
|
+
elif [ "$mb_zealous" = 'gcc' ]; then
|
252
|
+
ccenv_candidates="gcc"
|
253
|
+
|
254
|
+
elif [ "$mb_zealous" = 'llvm' ]; then
|
255
|
+
ccenv_candidates="clang"
|
256
|
+
|
257
|
+
elif [ "$mb_toolchain" = 'gcc' ]; then
|
258
|
+
ccenv_candidates="gcc c99 c11 cc clang"
|
259
|
+
|
260
|
+
elif [ "$mb_toolchain" = 'llvm' ]; then
|
261
|
+
ccenv_candidates="clang c99 c11 cc gcc"
|
262
|
+
|
263
|
+
elif [ -n "$mb_toolchain" ]; then
|
264
|
+
ccenv_candidates="$mb_toolchain c99 c11 cc gcc clang"
|
265
|
+
|
266
|
+
else
|
267
|
+
ccenv_candidates="c99 c11 cc gcc clang"
|
268
|
+
fi
|
269
|
+
}
|
270
|
+
|
271
|
+
|
272
|
+
ccenv_set_cc()
|
273
|
+
{
|
274
|
+
if [ -z "$ccenv_cc" ]; then
|
275
|
+
ccenv_set_c_compiler_candidates
|
276
|
+
ccenv_find_tool
|
277
|
+
ccenv_cc="$ccenv_tool"
|
278
|
+
fi
|
279
|
+
|
280
|
+
if [ "$ccenv_cc" = false ] && [ -n "$mb_compiler" ]; then
|
281
|
+
ccenv_cc="$mb_compiler"
|
282
|
+
fi
|
283
|
+
|
284
|
+
ccenv_cc_cmd="$ccenv_cc"
|
285
|
+
|
286
|
+
if [ "$ccenv_cfgtype" = 'native' ]; then
|
287
|
+
return 0
|
288
|
+
fi
|
289
|
+
|
290
|
+
if [ -n "$mb_cchost" ]; then
|
291
|
+
ccenv_host="$mb_cchost"
|
292
|
+
elif [ -n "$mb_host" ]; then
|
293
|
+
ccenv_host="$mb_host"
|
294
|
+
else
|
295
|
+
ccenv_host=
|
296
|
+
fi
|
297
|
+
|
298
|
+
if [ -z "$ccenv_host" ]; then
|
299
|
+
ccenv_host=$($ccenv_cc $ccenv_cflags -dumpmachine 2>/dev/null)
|
300
|
+
ccenv_cchost=$ccenv_host
|
301
|
+
else
|
302
|
+
ccenv_tmp=$(mktemp)
|
303
|
+
ccenv_cmd="$ccenv_cc --target=$ccenv_host -E -xc -"
|
304
|
+
|
305
|
+
if [ -z "$mb_user_cc" ]; then
|
306
|
+
$ccenv_cmd < /dev/null > /dev/null \
|
307
|
+
2>"$ccenv_tmp" || true
|
308
|
+
|
309
|
+
ccenv_errors=$(cat "$ccenv_tmp")
|
310
|
+
|
311
|
+
if [ -z "$ccenv_errors" ]; then
|
312
|
+
ccenv_tflags="--target=$ccenv_host"
|
313
|
+
ccenv_cc="$ccenv_cc $ccenv_tflags"
|
314
|
+
fi
|
315
|
+
fi
|
316
|
+
|
317
|
+
ccenv_cchost=$($ccenv_cc $ccenv_cflags -dumpmachine 2>/dev/null)
|
318
|
+
fi
|
319
|
+
|
320
|
+
if [ "$ccenv_cchost" != "$ccenv_host" ]; then
|
321
|
+
printf 'ccenv:\n' >&2
|
322
|
+
printf 'ccenv: ccenv_host: %s \n' $ccenv_host >&2
|
323
|
+
printf 'ccenv: ccenv_cchost: %s \n' $ccenv_cchost >&2
|
324
|
+
|
325
|
+
if [ -z "$ccenv_tflags" ]; then
|
326
|
+
printf 'ccenv:\n' >&2
|
327
|
+
printf 'ccenv: ccenv_host and ccenv_cchost do not match, most likely because:\n' >&2
|
328
|
+
printf 'ccenv: (1) you explicitly set CC (or passed --compiler=...)\n' >&2
|
329
|
+
printf 'ccenv: (2) the selected compiler does not accept --target=...\n' >&2
|
330
|
+
printf 'ccenv: (3) the host reported by -dumpmachine differs from the one you requested.\n' >&2
|
331
|
+
fi
|
332
|
+
|
333
|
+
if [ -n "$ccenv_errors" ]; then
|
334
|
+
printf 'ccenv:\n' >&2
|
335
|
+
printf 'ccenv: something went wrong, see the command and compiler message below.\n\n' >&2
|
336
|
+
printf 'cmd: %s < /dev/null > /dev/null\n' "$ccenv_cmd" >&2
|
337
|
+
printf '%s\n\n' "$ccenv_errors" >&2
|
338
|
+
else
|
339
|
+
printf 'ccenv:\n' >&2
|
340
|
+
printf 'ccenv: something went wrong, bailing out.\n\n' >&2
|
341
|
+
fi
|
342
|
+
|
343
|
+
return 2
|
344
|
+
fi
|
345
|
+
}
|
346
|
+
|
347
|
+
ccenv_set_cpp()
|
348
|
+
{
|
349
|
+
case "$ccenv_cc_cmd" in
|
350
|
+
cc | c99 | c11 | gcc)
|
351
|
+
ccenv_cpp_prefix=
|
352
|
+
ccenv_candidates="cpp" ;;
|
353
|
+
|
354
|
+
clang )
|
355
|
+
ccenv_cpp_prefix=
|
356
|
+
ccenv_candidates="clang-cpp" ;;
|
357
|
+
|
358
|
+
*-cc )
|
359
|
+
ccenv_cpp_prefix=${ccenv_cc_cmd%-cc*}-
|
360
|
+
ccenv_candidates="${ccenv_cpp_prefix}cpp" ;;
|
361
|
+
|
362
|
+
*-c99 )
|
363
|
+
ccenv_cpp_prefix=${ccenv_cc_cmd%-c99*}-
|
364
|
+
ccenv_candidates="${ccenv_cpp_prefix}cpp" ;;
|
365
|
+
|
366
|
+
*-c11 )
|
367
|
+
ccenv_cpp_prefix=${ccenv_cc_cmd%-c11*}-
|
368
|
+
ccenv_candidates="${ccenv_cpp_prefix}cpp" ;;
|
369
|
+
|
370
|
+
*-gcc )
|
371
|
+
ccenv_cpp_prefix=${ccenv_cc_cmd%-gcc*}-
|
372
|
+
ccenv_candidates="${ccenv_cpp_prefix}cpp" ;;
|
373
|
+
|
374
|
+
*-clang )
|
375
|
+
ccenv_cpp_prefix=${ccenv_cc_cmd%-clang*}-
|
376
|
+
ccenv_candidates="${ccenv_cpp_prefix}clang-cpp" ;;
|
377
|
+
|
378
|
+
* )
|
379
|
+
ccenv_cpp="$ccenv_cc -E"
|
380
|
+
return 0
|
381
|
+
esac
|
382
|
+
|
383
|
+
ccenv_find_tool
|
384
|
+
|
385
|
+
if [ "$ccenv_tool" = false ]; then
|
386
|
+
ccenv_cpp="$ccenv_cc -E"
|
387
|
+
elif [ -n "$ccenv_tflags" ]; then
|
388
|
+
ccenv_cpp="$ccenv_tool $ccenv_tflags"
|
389
|
+
else
|
390
|
+
ccenv_cpp="$ccenv_tool"
|
391
|
+
fi
|
392
|
+
}
|
393
|
+
|
394
|
+
ccenv_set_cxx()
|
395
|
+
{
|
396
|
+
case "$ccenv_cc_cmd" in
|
397
|
+
cc | c99 | c11 )
|
398
|
+
ccenv_cxx_prefix=
|
399
|
+
ccenv_candidates="cxx c++" ;;
|
400
|
+
|
401
|
+
gcc )
|
402
|
+
ccenv_cxx_prefix=
|
403
|
+
ccenv_candidates="g++" ;;
|
404
|
+
|
405
|
+
clang )
|
406
|
+
ccenv_cxx_prefix=
|
407
|
+
ccenv_candidates="clang++" ;;
|
408
|
+
|
409
|
+
*-gcc )
|
410
|
+
ccenv_cpp_prefix=${ccenv_cc_cmd%-gcc*}-
|
411
|
+
ccenv_candidates="${ccenv_cpp_prefix}g++" ;;
|
412
|
+
|
413
|
+
*-clang )
|
414
|
+
ccenv_cpp_prefix=${ccenv_cc_cmd%-clang*}-
|
415
|
+
ccenv_candidates="${ccenv_cpp_prefix}clang++" ;;
|
416
|
+
|
417
|
+
*cc )
|
418
|
+
ccenv_cxx_prefix=${ccenv_cc_cmd%cc*}
|
419
|
+
ccenv_candidates="${ccenv_cpp_prefix}++" ;;
|
420
|
+
|
421
|
+
* )
|
422
|
+
ccenv_cxx="$ccenv_cc -xc++"
|
423
|
+
return 0
|
424
|
+
esac
|
425
|
+
|
426
|
+
ccenv_find_tool
|
427
|
+
|
428
|
+
if [ "$ccenv_tool" = false ]; then
|
429
|
+
ccenv_cxx="$ccenv_cc -xc++"
|
430
|
+
elif [ -n "$ccenv_tflags" ]; then
|
431
|
+
ccenv_cxx="$ccenv_tool $ccenv_tflags"
|
432
|
+
else
|
433
|
+
ccenv_cxx="$ccenv_tool"
|
434
|
+
fi
|
435
|
+
}
|
436
|
+
|
437
|
+
ccenv_set_cc_host()
|
438
|
+
{
|
439
|
+
ccenv_cc_host="$ccenv_cchost"
|
440
|
+
}
|
441
|
+
|
442
|
+
ccenv_set_cc_bits()
|
443
|
+
{
|
444
|
+
ccenv_internal_size=
|
445
|
+
ccenv_internal_type='void *'
|
446
|
+
ccenv_internal_test='char x[(sizeof(%s) == %s/8) ? 1 : -1];'
|
447
|
+
|
448
|
+
for ccenv_internal_guess in 64 32 128; do
|
449
|
+
if [ -z $ccenv_internal_size ]; then
|
450
|
+
ccenv_internal_str=$(printf "$ccenv_internal_test" \
|
451
|
+
"$ccenv_internal_type" \
|
452
|
+
"$ccenv_internal_guess")
|
453
|
+
|
454
|
+
printf '%s' "$ccenv_internal_str" \
|
455
|
+
| $ccenv_cc -S -xc - -o - \
|
456
|
+
$ccenv_cflags \
|
457
|
+
> /dev/null 2>/dev/null \
|
458
|
+
&& ccenv_internal_size=$ccenv_internal_guess
|
459
|
+
fi
|
460
|
+
done
|
461
|
+
|
462
|
+
ccenv_cc_bits=$ccenv_internal_size
|
463
|
+
}
|
464
|
+
|
465
|
+
ccenv_set_cc_underscore()
|
466
|
+
{
|
467
|
+
ccenv_fn_name='ZmYaXyWbVe_UuTnSdReQrPsOcNoNrLe'
|
468
|
+
ccenv_fn_code='int %s(void){return 0;}'
|
469
|
+
|
470
|
+
printf "$ccenv_fn_code" $ccenv_fn_name \
|
471
|
+
| $ccenv_cc -xc - -S -o - \
|
472
|
+
| grep _$ccenv_fn_name \
|
473
|
+
> /dev/null \
|
474
|
+
&& ccenv_cc_underscore='_'
|
475
|
+
|
476
|
+
return 0
|
477
|
+
}
|
478
|
+
|
479
|
+
ccenv_create_framework_executable()
|
480
|
+
{
|
481
|
+
if [ -f $ccenv_image ]; then
|
482
|
+
mv $ccenv_image $ccenv_image.tmp
|
483
|
+
rm -f $ccenv_image.tmp
|
484
|
+
fi
|
485
|
+
|
486
|
+
printf 'int main(void){return 0;}' \
|
487
|
+
| $ccenv_cc -xc - \
|
488
|
+
-o $ccenv_image \
|
489
|
+
|| return 1
|
490
|
+
|
491
|
+
return 0
|
492
|
+
}
|
493
|
+
|
494
|
+
ccenv_create_freestanding_executable()
|
495
|
+
{
|
496
|
+
if [ -f $ccenv_image ]; then
|
497
|
+
mv $ccenv_image $ccenv_image.tmp
|
498
|
+
rm -f $ccenv_image.tmp
|
499
|
+
fi
|
500
|
+
|
501
|
+
if [ -z "ccenv_cc_underscore" ]; then
|
502
|
+
ccenv_start_fn='_start'
|
503
|
+
else
|
504
|
+
ccenv_start_fn='start'
|
505
|
+
fi
|
506
|
+
|
507
|
+
printf 'int %s(void){return 0;}' "$ccenv_start_fn" \
|
508
|
+
| $ccenv_cc -xc - \
|
509
|
+
-ffreestanding \
|
510
|
+
-nostdlib -nostartfiles \
|
511
|
+
-o $ccenv_image \
|
512
|
+
|| return 1
|
513
|
+
|
514
|
+
ccenv_freestd=yes
|
515
|
+
|
516
|
+
return 0
|
517
|
+
}
|
518
|
+
|
519
|
+
ccenv_set_cc_binfmt()
|
520
|
+
{
|
521
|
+
ccenv_use_perk=
|
522
|
+
ccenv_use_readelf=
|
523
|
+
ccenv_use_readobj=
|
524
|
+
ccenv_use_bfd_objdump=
|
525
|
+
ccenv_use_llvm_objdump=
|
526
|
+
|
527
|
+
ccenv_create_framework_executable \
|
528
|
+
|| ccenv_create_freestanding_executable \
|
529
|
+
|| return 0
|
530
|
+
|
531
|
+
# PE / perk
|
532
|
+
if [ -n "$ccenv_perk" ]; then
|
533
|
+
$ccenv_perk $ccenv_image 2>/dev/null \
|
534
|
+
&& ccenv_cc_binfmt='PE' \
|
535
|
+
&& ccenv_use_perk=yes
|
536
|
+
fi
|
537
|
+
|
538
|
+
# ELF / readelf
|
539
|
+
if [ -n "$ccenv_readelf" ] && [ -z "$ccenv_cc_binfmt" ]; then
|
540
|
+
$ccenv_readelf -h $ccenv_image 2>/dev/null \
|
541
|
+
| grep 'Magic:' | sed -e 's/[ ]*//g' \
|
542
|
+
| grep 'Magic:7f454c46' \
|
543
|
+
> /dev/null \
|
544
|
+
&& ccenv_cc_binfmt='ELF' \
|
545
|
+
&& ccenv_use_readelf=yes
|
546
|
+
fi
|
547
|
+
|
548
|
+
# a marble of astonishing design:
|
549
|
+
# llvm-readelf also parses PE and Mach-O
|
550
|
+
|
551
|
+
if [ -n "$ccenv_readelf_llvm" ]; then
|
552
|
+
ccenv_readany="$ccenv_readelf_llvm"
|
553
|
+
else
|
554
|
+
ccenv_readany="$ccenv_readelf"
|
555
|
+
fi
|
556
|
+
|
557
|
+
# PE / readelf
|
558
|
+
if [ -n "$ccenv_readany" ] && [ -z "$ccenv_cc_binfmt" ]; then
|
559
|
+
$ccenv_readany -h $ccenv_image 2>/dev/null \
|
560
|
+
| grep 'Magic:' | sed -e 's/[ ]*//g' \
|
561
|
+
| grep 'Magic:MZ' \
|
562
|
+
> /dev/null \
|
563
|
+
&& ccenv_cc_binfmt='PE' \
|
564
|
+
&& ccenv_use_readelf=yes
|
565
|
+
fi
|
566
|
+
|
567
|
+
# MACHO-64 / readelf
|
568
|
+
if [ -n "$ccenv_readany" ] && [ -z "$ccenv_cc_binfmt" ]; then
|
569
|
+
$ccenv_readany -h $ccenv_image 2>/dev/null \
|
570
|
+
| grep -i 'Magic:' | sed -e 's/[ ]*//g' \
|
571
|
+
| grep -i '(0xfeedfacf)' \
|
572
|
+
> /dev/null \
|
573
|
+
&& ccenv_cc_binfmt='MACHO' \
|
574
|
+
&& ccenv_use_readelf=yes
|
575
|
+
fi
|
576
|
+
|
577
|
+
# MACHO-32 / readelf
|
578
|
+
if [ -n "$ccenv_readany" ] && [ -z "$ccenv_cc_binfmt" ]; then
|
579
|
+
$ccenv_readany -h $ccenv_image 2>/dev/null \
|
580
|
+
| grep -i 'Magic:' | sed -e 's/[ ]*//g' \
|
581
|
+
| grep -i '(0xcafebabe)' \
|
582
|
+
> /dev/null \
|
583
|
+
&& ccenv_cc_binfmt='MACHO' \
|
584
|
+
&& ccenv_use_readelf=yes
|
585
|
+
fi
|
586
|
+
|
587
|
+
# MACHO / readobj
|
588
|
+
if [ -n "$ccenv_readobj" ] && [ -z "$ccenv_cc_binfmt" ]; then
|
589
|
+
$ccenv_readobj $ccenv_image 2>/dev/null \
|
590
|
+
| grep -i 'Format:' | sed 's/ /_/g' \
|
591
|
+
| grep -i '_Mach-O_' \
|
592
|
+
> /dev/null \
|
593
|
+
&& ccenv_cc_binfmt='MACHO' \
|
594
|
+
&& ccenv_use_readobj=yes
|
595
|
+
fi
|
596
|
+
|
597
|
+
# MACHO / objdump (llvm)
|
598
|
+
if [ -n "$ccenv_objdump" ] && [ -z "$ccenv_cc_binfmt" ]; then
|
599
|
+
$ccenv_objdump -section-headers $ccenv_image \
|
600
|
+
2>/dev/null \
|
601
|
+
| grep -i 'file format Mach-O' \
|
602
|
+
> /dev/null \
|
603
|
+
&& ccenv_cc_binfmt='MACHO' \
|
604
|
+
&& ccenv_use_objdump=yes
|
605
|
+
fi
|
606
|
+
|
607
|
+
# MACHO / objdump (bfd)
|
608
|
+
if [ -n "$ccenv_objdump" ] && [ -z "$ccenv_cc_binfmt" ]; then
|
609
|
+
$ccenv_objdump -h $ccenv_image 2>/dev/null \
|
610
|
+
| grep -i 'file format Mach-O' \
|
611
|
+
> /dev/null \
|
612
|
+
&& ccenv_cc_binfmt='MACHO' \
|
613
|
+
&& ccenv_use_objdump=yes
|
614
|
+
fi
|
615
|
+
|
616
|
+
# PE / objdump (bfd)
|
617
|
+
if [ -n "$ccenv_objdump" ] && [ -z "$ccenv_cc_binfmt" ]; then
|
618
|
+
$ccenv_objdump -h $ccenv_image 2>/dev/null \
|
619
|
+
| grep -i 'file format pei-' \
|
620
|
+
> /dev/null \
|
621
|
+
&& ccenv_cc_binfmt='PE' \
|
622
|
+
&& ccenv_use_bfd_objdump=yes
|
623
|
+
fi
|
624
|
+
}
|
625
|
+
|
626
|
+
ccenv_set_os_pe()
|
627
|
+
{
|
628
|
+
if [ -n "$ccenv_freestd" ]; then
|
629
|
+
case "$ccenv_cchost" in
|
630
|
+
*-midipix | *-midipix-* )
|
631
|
+
ccenv_os='midipix' ;;
|
632
|
+
*-mingw | *-mingw32 | *-mingw64 )
|
633
|
+
ccenv_os='mingw' ;;
|
634
|
+
*-mingw-* | *-mingw32-* | *-mingw64 )
|
635
|
+
ccenv_os='mingw' ;;
|
636
|
+
*-msys | *-msys2 | *-msys-* | *-msys2-* )
|
637
|
+
ccenv_os='msys' ;;
|
638
|
+
*-cygwin | *-cygwin-* )
|
639
|
+
ccenv_os='cygwin' ;;
|
640
|
+
esac
|
641
|
+
fi
|
642
|
+
|
643
|
+
if [ -n "$ccenv_os" ]; then
|
644
|
+
return 0
|
645
|
+
fi
|
646
|
+
|
647
|
+
if [ -n "$ccenv_use_perk" ]; then
|
648
|
+
ccenv_framework=$($ccenv_perk -y $ccenv_image)
|
649
|
+
ccenv_os=${ccenv_framework#*-*-*-*}
|
650
|
+
fi
|
651
|
+
|
652
|
+
if [ -z "$ccenv_os" ] && [ -n "$ccenv_objdump_bfd" ]; then
|
653
|
+
$ccenv_objdump_bfd -x $ccenv_image | grep -i 'DLL Name' \
|
654
|
+
| grep 'cygwin1.dll' > /dev/null \
|
655
|
+
&& ccenv_os='cygwin'
|
656
|
+
fi
|
657
|
+
|
658
|
+
if [ -z "$ccenv_os" ] && [ -n "$ccenv_objdump_bfd" ]; then
|
659
|
+
$ccenv_objdump_bfd -x $ccenv_image | grep -i 'DLL Name' \
|
660
|
+
| grep 'msys-2.0.dll' > /dev/null \
|
661
|
+
&& ccenv_os='msys'
|
662
|
+
fi
|
663
|
+
|
664
|
+
if [ -z "$ccenv_os" ] && [ -n "$ccenv_objdump_bfd" ]; then
|
665
|
+
$ccenv_objdump_bfd -x $ccenv_image \
|
666
|
+
| grep -i 'DLL Name' | grep '.CRT' \
|
667
|
+
> /dev/null \
|
668
|
+
&& $ccenv_objdump_bfd -x $ccenv_image \
|
669
|
+
| grep -i 'DLL Name' | grep '.bss' \
|
670
|
+
> /dev/null \
|
671
|
+
&& $ccenv_objdump_bfd -x $ccenv_image \
|
672
|
+
| grep -i 'DLL Name' | grep '.tls' \
|
673
|
+
> /dev/null \
|
674
|
+
&& ccenv_os='mingw'
|
675
|
+
fi
|
676
|
+
}
|
677
|
+
|
678
|
+
ccenv_set_os_macho()
|
679
|
+
{
|
680
|
+
case "$ccenv_cchost" in
|
681
|
+
*-apple-darwin* )
|
682
|
+
ccenv_os='darwin' ;;
|
683
|
+
esac
|
684
|
+
}
|
685
|
+
|
686
|
+
ccenv_set_os()
|
687
|
+
{
|
688
|
+
case "$ccenv_cc_binfmt" in
|
689
|
+
PE )
|
690
|
+
ccenv_set_os_pe ;;
|
691
|
+
MACHO )
|
692
|
+
ccenv_set_os_macho ;;
|
693
|
+
esac
|
694
|
+
|
695
|
+
if [ -n "$ccenv_os" ]; then
|
696
|
+
return 0
|
697
|
+
fi
|
698
|
+
|
699
|
+
case "$ccenv_cchost" in
|
700
|
+
*-*-*-* )
|
701
|
+
ccenv_tip=${ccenv_host%-*}
|
702
|
+
ccenv_os=${ccenv_tip#*-*-}
|
703
|
+
;;
|
704
|
+
|
705
|
+
*-*-* )
|
706
|
+
ccenv_tip=${ccenv_host%-*}
|
707
|
+
ccenv_os=${ccenv_tip#*-}
|
708
|
+
;;
|
709
|
+
esac
|
710
|
+
|
711
|
+
if [ -z "$ccenv_os" ]; then
|
712
|
+
ccenv_os='anyos'
|
713
|
+
fi
|
714
|
+
}
|
715
|
+
|
716
|
+
ccenv_set_os_flags()
|
717
|
+
{
|
718
|
+
case "$ccenv_os" in
|
719
|
+
darwin )
|
720
|
+
ccenv_cflags_os='-D_DARWIN_C_SOURCE'
|
721
|
+
ccenv_cflags_pic='-fPIC'
|
722
|
+
;;
|
723
|
+
midipix )
|
724
|
+
ccenv_cflags_os=
|
725
|
+
ccenv_cflags_pic='-fPIC'
|
726
|
+
;;
|
727
|
+
cygwin )
|
728
|
+
ccenv_cflags_os=
|
729
|
+
ccenv_cflags_pic=
|
730
|
+
;;
|
731
|
+
msys | msys* | mingw | mingw* )
|
732
|
+
ccenv_cflags_os='-U__STRICT_ANSI__'
|
733
|
+
ccenv_cflags_pic=
|
734
|
+
;;
|
735
|
+
* )
|
736
|
+
ccenv_cflags_os=
|
737
|
+
ccenv_cflags_pic='-fPIC'
|
738
|
+
;;
|
739
|
+
esac
|
740
|
+
}
|
741
|
+
|
742
|
+
ccenv_set_os_semantics()
|
743
|
+
{
|
744
|
+
# binary_format - core_api - ex_api - dependency_resolution
|
745
|
+
|
746
|
+
case "$ccenv_os" in
|
747
|
+
linux )
|
748
|
+
ccenv_os_semantics='elf-posix-linux-ldso'
|
749
|
+
;;
|
750
|
+
bsd )
|
751
|
+
ccenv_os_semantics='elf-posix-bsd-ldso'
|
752
|
+
;;
|
753
|
+
darwin )
|
754
|
+
ccenv_os_semantics='macho-posix-osx-ldso'
|
755
|
+
;;
|
756
|
+
midipix )
|
757
|
+
ccenv_os_semantics='pe-posix-winnt-ldso'
|
758
|
+
;;
|
759
|
+
cygwin )
|
760
|
+
ccenv_os_semantics='pe-hybrid-winnt-unsafe'
|
761
|
+
;;
|
762
|
+
msys )
|
763
|
+
ccenv_os_semantics='pe-hybrid-winnt-unsafe'
|
764
|
+
;;
|
765
|
+
mingw )
|
766
|
+
ccenv_os_semantics='pe-win32-winnt-unsafe'
|
767
|
+
;;
|
768
|
+
esac
|
769
|
+
|
770
|
+
if [ -n "$ccenv_os_semantics" ]; then
|
771
|
+
return 0
|
772
|
+
fi
|
773
|
+
|
774
|
+
if [ -n "$ccenv_cc_binfmt" ]; then
|
775
|
+
ccenv_os_semantics_pattern='%s-posix-anyos-unknown'
|
776
|
+
ccenv_os_semantics=$(printf \
|
777
|
+
"$ccenv_os_semantics_pattern" \
|
778
|
+
"$ccenv_cc_binfmt" \
|
779
|
+
| tr '[:upper:]' '[:lower:]')
|
780
|
+
else
|
781
|
+
ccenv_os_semantics='unknown-posix-anyos-unknown'
|
782
|
+
fi
|
783
|
+
}
|
784
|
+
|
785
|
+
ccenv_set_os_dso_exrules()
|
786
|
+
{
|
787
|
+
case "$ccenv_os" in
|
788
|
+
midipix )
|
789
|
+
ccenv_os_dso_exrules='pe-mdso'
|
790
|
+
;;
|
791
|
+
* )
|
792
|
+
if [ "$ccenv_cc_binfmt" = 'PE' ]; then
|
793
|
+
ccenv_os_dso_exrules='pe-dlltool'
|
794
|
+
else
|
795
|
+
ccenv_os_dso_exrules='default'
|
796
|
+
fi
|
797
|
+
esac
|
798
|
+
}
|
799
|
+
|
800
|
+
ccenv_set_os_dso_linkage()
|
801
|
+
{
|
802
|
+
# todo: PIC, PIE, and friends
|
803
|
+
ccenv_os_dso_linkage='default'
|
804
|
+
}
|
805
|
+
|
806
|
+
ccenv_set_os_dso_patterns_darwin()
|
807
|
+
{
|
808
|
+
ccenv_os_app_prefix=
|
809
|
+
ccenv_os_app_suffix=
|
810
|
+
|
811
|
+
ccenv_os_lib_prefix=lib
|
812
|
+
ccenv_os_lib_suffix=.dylib
|
813
|
+
|
814
|
+
ccenv_os_implib_ext=.invalid
|
815
|
+
ccenv_os_libdef_ext=.invalid
|
816
|
+
|
817
|
+
ccenv_os_archive_ext=.a
|
818
|
+
ccenv_os_soname=symlink
|
819
|
+
|
820
|
+
ccenv_os_lib_prefixed_suffix=
|
821
|
+
ccenv_os_lib_suffixed_suffix='$(OS_LIB_SUFFIX)'
|
822
|
+
}
|
823
|
+
|
824
|
+
ccenv_set_os_dso_patterns_mdso()
|
825
|
+
{
|
826
|
+
ccenv_os_app_prefix=
|
827
|
+
ccenv_os_app_suffix=
|
828
|
+
|
829
|
+
ccenv_os_lib_prefix=lib
|
830
|
+
ccenv_os_lib_suffix=.so
|
831
|
+
|
832
|
+
ccenv_os_implib_ext=.lib.a
|
833
|
+
ccenv_os_libdef_ext=.so.def
|
834
|
+
|
835
|
+
ccenv_os_archive_ext=.a
|
836
|
+
ccenv_os_soname=symlink
|
837
|
+
|
838
|
+
ccenv_os_lib_prefixed_suffix='$(OS_LIB_SUFFIX)'
|
839
|
+
ccenv_os_lib_suffixed_suffix=
|
840
|
+
}
|
841
|
+
|
842
|
+
ccenv_set_os_dso_patterns_dlltool()
|
843
|
+
{
|
844
|
+
ccenv_os_app_prefix=
|
845
|
+
ccenv_os_app_suffix=.exe
|
846
|
+
|
847
|
+
ccenv_os_lib_prefix=lib
|
848
|
+
ccenv_os_lib_suffix=.dll
|
849
|
+
|
850
|
+
ccenv_os_implib_ext=.dll.a
|
851
|
+
ccenv_os_libdef_ext=.def
|
852
|
+
|
853
|
+
ccenv_os_archive_ext=.a
|
854
|
+
ccenv_os_soname=copy
|
855
|
+
|
856
|
+
ccenv_os_lib_prefixed_suffix='$(OS_LIB_SUFFIX)'
|
857
|
+
ccenv_os_lib_suffixed_suffix=
|
858
|
+
}
|
859
|
+
|
860
|
+
ccenv_set_os_dso_patterns_default()
|
861
|
+
{
|
862
|
+
ccenv_os_app_prefix=
|
863
|
+
ccenv_os_app_suffix=
|
864
|
+
|
865
|
+
ccenv_os_lib_prefix=lib
|
866
|
+
ccenv_os_lib_suffix=.so
|
867
|
+
|
868
|
+
ccenv_os_implib_ext=.invalid
|
869
|
+
ccenv_os_libdef_ext=.invalid
|
870
|
+
|
871
|
+
ccenv_os_archive_ext=.a
|
872
|
+
ccenv_os_soname=symlink
|
873
|
+
|
874
|
+
ccenv_os_lib_prefixed_suffix='$(OS_LIB_SUFFIX)'
|
875
|
+
ccenv_os_lib_suffixed_suffix=
|
876
|
+
}
|
877
|
+
|
878
|
+
ccenv_set_os_dso_patterns()
|
879
|
+
{
|
880
|
+
# sover: .so.x.y.z
|
881
|
+
# verso: .x.y.z.so
|
882
|
+
|
883
|
+
case "$ccenv_os" in
|
884
|
+
darwin )
|
885
|
+
ccenv_set_os_dso_patterns_darwin
|
886
|
+
;;
|
887
|
+
midipix )
|
888
|
+
ccenv_set_os_dso_patterns_mdso
|
889
|
+
;;
|
890
|
+
cygwin | msys | mingw )
|
891
|
+
ccenv_set_os_dso_patterns_dlltool
|
892
|
+
;;
|
893
|
+
* )
|
894
|
+
ccenv_set_os_dso_patterns_default
|
895
|
+
;;
|
896
|
+
esac
|
897
|
+
}
|
898
|
+
|
899
|
+
ccenv_output_defs()
|
900
|
+
{
|
901
|
+
ccenv_in="$mb_project_dir/sofort/ccenv/ccenv.in"
|
902
|
+
ccenv_mk="$mb_pwd/ccenv/$ccenv_cfgtype.mk"
|
903
|
+
|
904
|
+
if [ $ccenv_cfgtype = 'native' ]; then
|
905
|
+
|
906
|
+
ccenv_tmp=$(mktemp)
|
907
|
+
|
908
|
+
sed \
|
909
|
+
-e 's/^\s*$/@/g' \
|
910
|
+
-e 's/^/NATIVE_/' \
|
911
|
+
-e 's/NATIVE_@//g' \
|
912
|
+
-e 's/NATIVE_#/#/g' \
|
913
|
+
-e 's/ =/=/g' \
|
914
|
+
-e 's/ +=/+=/g' \
|
915
|
+
"$ccenv_in" > "$ccenv_tmp"
|
916
|
+
|
917
|
+
ccenv_in="$ccenv_tmp"
|
918
|
+
fi
|
919
|
+
|
920
|
+
ccenv_vars=$(cut -d'=' -f1 "$mb_project_dir/sofort/ccenv/ccenv.vars" \
|
921
|
+
| grep -v '^#')
|
922
|
+
|
923
|
+
ccenv_exvars="ccenv_cfgtype ccenv_makevar_prefix"
|
924
|
+
|
925
|
+
ccenv_sed_substs=" \
|
926
|
+
$(for __var in $ccenv_vars $ccenv_exvars; do \
|
927
|
+
printf '%s"$%s"%s' "-e 's/@$__var@/'" \
|
928
|
+
"$__var" "'/g' "; \
|
929
|
+
done)"
|
930
|
+
|
931
|
+
eval sed $ccenv_sed_substs "$ccenv_in" \
|
932
|
+
| sed -e 's/[ \t]*$//g' \
|
933
|
+
> "$ccenv_mk"
|
934
|
+
|
935
|
+
return 0
|
936
|
+
}
|
937
|
+
|
938
|
+
ccenv_clean_up()
|
939
|
+
{
|
940
|
+
rm -f $ccenv_image
|
941
|
+
}
|
942
|
+
|
943
|
+
ccenv_common_init()
|
944
|
+
{
|
945
|
+
. "$mb_project_dir/sofort/ccenv/ccenv.vars"
|
946
|
+
|
947
|
+
ccenv_cfgtype=$1
|
948
|
+
ccenv_cfgfile="$mb_pwd/ccenv/$ccenv_cfgtype.mk"
|
949
|
+
ccenv_freestd=
|
950
|
+
|
951
|
+
if [ $ccenv_cfgtype = 'native' ]; then
|
952
|
+
ccenv_makevar_prefix='NATIVE_'
|
953
|
+
ccenv_image='./ccenv/native.a.out'
|
954
|
+
else
|
955
|
+
ccenv_makevar_prefix=
|
956
|
+
ccenv_image='./ccenv/host.a.out'
|
957
|
+
fi
|
958
|
+
|
959
|
+
if [ $ccenv_cfgtype = 'native' ]; then
|
960
|
+
ccenv_prefixes=
|
961
|
+
elif [ -n "$mb_cross_compile" ]; then
|
962
|
+
ccenv_prefixes="$mb_cross_compile"
|
963
|
+
elif [ -n "$mb_host" ]; then
|
964
|
+
ccenv_prefixes="$mb_host-"
|
965
|
+
else
|
966
|
+
ccenv_prefixes=
|
967
|
+
fi
|
968
|
+
|
969
|
+
if [ $ccenv_cfgtype = 'host' ]; then
|
970
|
+
ccenv_tflags=
|
971
|
+
ccenv_cflags=$(make -s -f "$mb_pwd/Makefile.tmp" .display-cflags)
|
972
|
+
ccenv_cc="$mb_user_cc"
|
973
|
+
ccenv_cpp="$mb_user_cpp"
|
974
|
+
ccenv_cxx="$mb_user_cxx"
|
975
|
+
else
|
976
|
+
ccenv_tflags=
|
977
|
+
ccenv_cflags="$mb_native_cflags"
|
978
|
+
ccenv_cc="$mb_native_cc"
|
979
|
+
ccenv_cpp="$mb_native_cpp"
|
980
|
+
ccenv_cxx="$mb_native_cxx"
|
981
|
+
fi
|
982
|
+
}
|
983
|
+
|
984
|
+
ccenv_set_characteristics()
|
985
|
+
{
|
986
|
+
ccenv_set_cc_host
|
987
|
+
ccenv_set_cc_bits
|
988
|
+
ccenv_set_cc_underscore
|
989
|
+
ccenv_set_cc_binfmt
|
990
|
+
}
|
991
|
+
|
992
|
+
ccenv_set_toolchain_variables()
|
993
|
+
{
|
994
|
+
ccenv_common_init $1
|
995
|
+
ccenv_set_cc
|
996
|
+
ccenv_set_cpp
|
997
|
+
ccenv_set_cxx
|
998
|
+
ccenv_set_primary_tools
|
999
|
+
ccenv_set_tool_variants
|
1000
|
+
ccenv_set_characteristics
|
1001
|
+
|
1002
|
+
ccenv_set_os
|
1003
|
+
ccenv_set_os_flags
|
1004
|
+
ccenv_set_os_semantics
|
1005
|
+
ccenv_set_os_dso_exrules
|
1006
|
+
ccenv_set_os_dso_linkage
|
1007
|
+
ccenv_set_os_dso_patterns
|
1008
|
+
|
1009
|
+
ccenv_output_defs
|
1010
|
+
ccenv_clean_up
|
1011
|
+
}
|
1012
|
+
|
1013
|
+
ccenv_set_host_variables()
|
1014
|
+
{
|
1015
|
+
ccenv_set_toolchain_variables 'host'
|
1016
|
+
}
|
1017
|
+
|
1018
|
+
ccenv_set_native_variables()
|
1019
|
+
{
|
1020
|
+
ccenv_set_toolchain_variables 'native'
|
1021
|
+
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
A few words on sofort's tool-finding logic
|
2
|
+
==========================================
|
3
|
+
|
4
|
+
# the goals of sofort's tool-finding logic are:
|
5
|
+
- follow a clear, transparent, and consistent logic
|
6
|
+
- allow users to easily specify per-build preferences
|
7
|
+
- allow distros to easily and cleanly use site-wide settings
|
8
|
+
|
9
|
+
|
10
|
+
three-way terminology:
|
11
|
+
- native machine: where make(1) will be running.
|
12
|
+
- host machine: where the package's program or libraries will execute.
|
13
|
+
- target machine: where code generated by the host package will execute.
|
14
|
+
|
15
|
+
! NOTE, however, that the host/target distinction is only relevant
|
16
|
+
when building a code-generating utility (e.g. a compiler), and that
|
17
|
+
the two are otherwise rather synonymous. Moreover, in practice it
|
18
|
+
is much more common to see configure scripts being invoked with a
|
19
|
+
--target=<machine> argument specifying the host, than with a
|
20
|
+
--host=<machine> argument.
|
21
|
+
|
22
|
+
|
23
|
+
invocation and names of binary tools:
|
24
|
+
- agnostic names (ar, nm, objdump, ...)
|
25
|
+
- branded names (llvm-ar, llvm-nm, llvm-objdump, ...)
|
26
|
+
- machine-prefixed agnostic names (x86_64-nt64-midipix-ar, ...)
|
27
|
+
- machine-prefixed branded names (x86_64-linux-gnu-gcc-ar, ...)
|
28
|
+
- machine-specifying branded tools, as in
|
29
|
+
llvm-ar --target=x86_64-linux.
|
30
|
+
|
31
|
+
|
32
|
+
cross-compilation: default search order:
|
33
|
+
- machine-prefixed agnostic tools
|
34
|
+
- machine-prefixed branded tools, starting with the prefix
|
35
|
+
most commonly associated with the selected compiler (that is,
|
36
|
+
``gcc'' when using gcc, and ``llvm'' when using clang)
|
37
|
+
- (machine-specifying) agnostic tools
|
38
|
+
- (machine-speficying) branded tools, starting once again with the
|
39
|
+
prefix most commonly associated with the selected compiler
|
40
|
+
|
41
|
+
|
42
|
+
native builds: default search order:
|
43
|
+
- agnostic tools
|
44
|
+
- machine-prefixed agnostic tools
|
45
|
+
- machine-prefixed branded tools
|
46
|
+
- branded tools
|
47
|
+
|
48
|
+
|
49
|
+
# using an alternate search order:
|
50
|
+
- --toolchain=<prefix> (e.g. --toolchain=llvm) --> search for tools
|
51
|
+
that begin with <prefix> before searching for agnostic tools
|
52
|
+
|
53
|
+
|
54
|
+
restricting which tools may be searched:
|
55
|
+
- --zealous --> only search for agnostic tools
|
56
|
+
- --zealous=<prefix> --> only search for <prefix>-branded tools
|
57
|
+
|
58
|
+
|
59
|
+
per-tool overrides, by example of the ``ar'' tool:
|
60
|
+
- AR=ar --> set AR to $(command -v ar)
|
61
|
+
- AR=/path/to/ar --> set AR to the specified absolute path
|
62
|
+
|
63
|
+
|
64
|
+
consistency:
|
65
|
+
- in the above case of AR=ar, using $(command -v ar) ensures
|
66
|
+
that the same tool is used throughout the lifetime of the
|
67
|
+
build project.
|
68
|
+
|
69
|
+
|
70
|
+
host generated config file and variable names:
|
71
|
+
- ccenv/host.mk
|
72
|
+
- AR, NM, OBJDUMP, ...
|
73
|
+
|
74
|
+
|
75
|
+
native generated config file and variable names:
|
76
|
+
- ccenv/native.mk
|
77
|
+
- NATIVE_AR, NATIVE_NM, NATIVE_OBJDUMP, ...
|
78
|
+
|
79
|
+
|
80
|
+
distro: site-wide preferences
|
81
|
+
- --ccenv=/path/to/site-specific/ccenv
|
82
|
+
- use the above to create ccenv as a symlink to
|
83
|
+
/path/to/site-specific/ccenv, and to accordingly
|
84
|
+
skip configure's tool-finding step.
|
@@ -0,0 +1,82 @@
|
|
1
|
+
system flavor
|
2
|
+
ccenv_os=
|
3
|
+
ccenv_os_semantics=
|
4
|
+
|
5
|
+
ccenv_os_dso_exrules=
|
6
|
+
ccenv_os_dso_linkage=
|
7
|
+
|
8
|
+
ccenv_os_app_prefix=
|
9
|
+
ccenv_os_app_suffix=
|
10
|
+
|
11
|
+
ccenv_os_lib_prefix=
|
12
|
+
ccenv_os_lib_suffix=
|
13
|
+
|
14
|
+
ccenv_os_implib_ext=
|
15
|
+
ccenv_os_libdef_ext=
|
16
|
+
|
17
|
+
ccenv_os_archive_ext=
|
18
|
+
ccenv_os_soname=
|
19
|
+
|
20
|
+
ccenv_os_lib_prefixed_suffix=
|
21
|
+
ccenv_os_lib_suffixed_suffix=
|
22
|
+
|
23
|
+
characteristics
|
24
|
+
ccenv_cc_host=
|
25
|
+
ccenv_cc_bits=
|
26
|
+
|
27
|
+
ccenv_cc_binfmt=
|
28
|
+
ccenv_cc_underscore=
|
29
|
+
|
30
|
+
ccenv_cc_arch_bfd=
|
31
|
+
ccenv_cc_arch_llvm=
|
32
|
+
|
33
|
+
incompatible tool variants
|
34
|
+
ccenv_as_asm=
|
35
|
+
ccenv_as_ll=
|
36
|
+
ccenv_as_mc=
|
37
|
+
|
38
|
+
ccenv_ld_bfd=
|
39
|
+
ccenv_ld_gold=
|
40
|
+
ccenv_ld_lld=
|
41
|
+
|
42
|
+
ccenv_objdump_bfd=
|
43
|
+
ccenv_objdump_llvm=
|
44
|
+
|
45
|
+
ccenv_readelf_bfd=
|
46
|
+
ccenv_readelf_llvm=
|
47
|
+
|
48
|
+
tool variables
|
49
|
+
ccenv_cc=
|
50
|
+
ccenv_cpp=
|
51
|
+
ccenv_cxx=
|
52
|
+
|
53
|
+
ccenv_as=
|
54
|
+
ccenv_ld=
|
55
|
+
|
56
|
+
ccenv_ar=
|
57
|
+
ccenv_nm=
|
58
|
+
ccenv_objdump=
|
59
|
+
ccenv_ranlib=
|
60
|
+
ccenv_size=
|
61
|
+
ccenv_strip=
|
62
|
+
ccenv_strings=
|
63
|
+
|
64
|
+
ccenv_addr2line=
|
65
|
+
ccenv_cov=
|
66
|
+
ccenv_cxxfilt=
|
67
|
+
ccenv_objcopy=
|
68
|
+
|
69
|
+
ccenv_elfedit=
|
70
|
+
ccenv_readelf=
|
71
|
+
ccenv_readobj=
|
72
|
+
|
73
|
+
ccenv_perk=
|
74
|
+
ccenv_mdso=
|
75
|
+
ccenv_dlltool=
|
76
|
+
|
77
|
+
ccenv_windmc=
|
78
|
+
ccenv_windrc=
|
79
|
+
|
80
|
+
cflags
|
81
|
+
ccenv_cflags_os=
|
82
|
+
ccenv_cflags_pic=
|
@@ -23,6 +23,7 @@ target
|
|
23
23
|
arch
|
24
24
|
compiler
|
25
25
|
toolchain
|
26
|
+
zealous
|
26
27
|
sysroot
|
27
28
|
cross_compile
|
28
29
|
shell
|
@@ -94,14 +95,13 @@ elf_hash_style
|
|
94
95
|
elf_config_defs
|
95
96
|
|
96
97
|
native_cc
|
97
|
-
|
98
|
-
|
98
|
+
native_cpp
|
99
|
+
native_cxx
|
99
|
-
native_cc_cflags
|
100
|
-
native_cc_ldflags
|
101
100
|
|
102
|
-
|
103
|
-
|
104
|
-
|
101
|
+
native_host
|
102
|
+
native_cfghost
|
103
|
+
native_cflags
|
104
|
+
native_ldflags
|
105
105
|
|
106
106
|
all_shared
|
107
107
|
all_static
|
@@ -2,5 +2,7 @@ DSO_REF_VER = $(SHARED_LIB)
|
|
2
2
|
DSO_REF_SONAME = $(SHARED_SONAME)
|
3
3
|
DSO_REF_SOLINK = $(SHARED_SOLINK)
|
4
4
|
|
5
|
-
LDFLAGS_SHARED
|
6
|
-
LDFLAGS_SHARED
|
5
|
+
LDFLAGS_SHARED += -Wl,-soname
|
6
|
+
LDFLAGS_SHARED += -Wl,$(DSO_SONAME)
|
7
|
+
|
8
|
+
|
@@ -37,63 +37,3 @@ clean-implib:
|
|
37
37
|
rm -f $(IMPLIB_VER)
|
38
38
|
rm -f $(IMPLIB_SONAME)
|
39
39
|
rm -f $(IMPLIB_SOLINK)
|
40
|
-
|
41
|
-
|
42
|
-
ifeq ($(OS_IMPLIB_TOOL),mdso)
|
43
|
-
|
44
|
-
$(IMPLIB_VER): $(IMPLIB_DEF)
|
45
|
-
$(MDSO) -m $(HOST_BITS) -i $(IMPLIB_VER) -n $(DSO_VER) -l $(DSO_LIBPATH) $<
|
46
|
-
|
47
|
-
else ifeq ($(OS_IMPLIB_TOOL),dlltool)
|
48
|
-
|
49
|
-
$(IMPLIB_VER): $(IMPLIB_DEF)
|
50
|
-
$(DLLTOOL) -l $(IMPLIB_VER) -d $(IMPLIB_DEF) -D $(DSO_VER)
|
51
|
-
|
52
|
-
endif
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
ifeq ($(AVOID_VERSION),yes)
|
57
|
-
|
58
|
-
package-implib-soname:
|
59
|
-
package-implib-solink:
|
60
|
-
package-install-implib-soname:
|
61
|
-
package-install-implib-solink:
|
62
|
-
|
63
|
-
else
|
64
|
-
|
65
|
-
package-implib-soname: implib-soname
|
66
|
-
package-implib-solink: implib-solink
|
67
|
-
package-install-implib-soname: install-implib-soname
|
68
|
-
package-install-implib-solink: install-implib-solink
|
69
|
-
|
70
|
-
|
71
|
-
ifeq ($(OS_IMPLIB_TOOL),mdso)
|
72
|
-
|
73
|
-
$(IMPLIB_SONAME): $(IMPLIB_DEF)
|
74
|
-
$(MDSO) -m $(HOST_BITS) -i $(IMPLIB_SONAME) -n $(DSO_SONAME) $(IMPLIB_DEF)
|
75
|
-
|
76
|
-
else ifeq ($(OS_IMPLIB_TOOL),dlltool)
|
77
|
-
|
78
|
-
$(IMPLIB_SONAME): $(IMPLIB_DEF)
|
79
|
-
$(DLLTOOL) -l $(IMPLIB_SONAME) -d $(IMPLIB_DEF) -D $(DSO_SONAME)
|
80
|
-
|
81
|
-
endif
|
82
|
-
|
83
|
-
|
84
|
-
$(IMPLIB_SOLINK): $(IMPLIB_SONAME)
|
85
|
-
rm -f $(IMPLIB_SOLINK).tmp
|
86
|
-
ln -s $(IMP_SONAME) $(IMPLIB_SOLINK).tmp
|
87
|
-
mv $(IMPLIB_SOLINK).tmp $(IMPLIB_SOLINK)
|
88
|
-
|
89
|
-
install-implib-soname: implib-soname
|
90
|
-
mkdir -p $(DESTDIR)$(LIBDIR)
|
91
|
-
cp $(IMPLIB_SONAME) $(DESTDIR)$(LIBDIR)
|
92
|
-
|
93
|
-
install-implib-solink: implib-soname
|
94
|
-
mkdir -p $(DESTDIR)$(LIBDIR)
|
95
|
-
rm -f $(IMPLIB_SOLINK).tmp
|
96
|
-
ln -s $(IMP_SONAME) $(IMPLIB_SOLINK).tmp
|
97
|
-
mv $(IMPLIB_SOLINK).tmp $(DESTDIR)$(LIBDIR)/$(IMP_SOLINK)
|
98
|
-
|
99
|
-
endif
|
@@ -0,0 +1,15 @@
|
|
1
|
+
include $(PROJECT_DIR)/sofort/exrules/pe-common.mk
|
2
|
+
|
3
|
+
$(IMPLIB_VER): $(IMPLIB_DEF)
|
4
|
+
$(DLLTOOL) -l $(IMPLIB_VER) -d $(IMPLIB_DEF) -D $(DSO_VER)
|
5
|
+
|
6
|
+
ifeq ($(AVOID_VERSION),yes)
|
7
|
+
|
8
|
+
else
|
9
|
+
|
10
|
+
$(IMPLIB_SONAME): $(IMPLIB_DEF)
|
11
|
+
$(DLLTOOL) -l $(IMPLIB_SONAME) -d $(IMPLIB_DEF) -D $(DSO_SONAME)
|
12
|
+
|
13
|
+
endif
|
14
|
+
|
15
|
+
include $(PROJECT_DIR)/sofort/exrules/pe-version.mk
|
@@ -0,0 +1,15 @@
|
|
1
|
+
include $(PROJECT_DIR)/sofort/exrules/pe-common.mk
|
2
|
+
|
3
|
+
$(IMPLIB_VER): $(IMPLIB_DEF)
|
4
|
+
$(MDSO) -m $(CC_BITS) -i $(IMPLIB_VER) -n $(DSO_VER) -l $(DSO_LIBPATH) $<
|
5
|
+
|
6
|
+
ifeq ($(AVOID_VERSION),yes)
|
7
|
+
|
8
|
+
else
|
9
|
+
|
10
|
+
$(IMPLIB_SONAME): $(IMPLIB_DEF)
|
11
|
+
$(MDSO) -m $(CC_BITS) -i $(IMPLIB_SONAME) -n $(DSO_SONAME) $(IMPLIB_DEF)
|
12
|
+
|
13
|
+
endif
|
14
|
+
|
15
|
+
include $(PROJECT_DIR)/sofort/exrules/pe-version.mk
|
@@ -0,0 +1,31 @@
|
|
1
|
+
ifeq ($(AVOID_VERSION),yes)
|
2
|
+
|
3
|
+
package-implib-soname:
|
4
|
+
package-implib-solink:
|
5
|
+
package-install-implib-soname:
|
6
|
+
package-install-implib-solink:
|
7
|
+
|
8
|
+
else
|
9
|
+
|
10
|
+
package-implib-soname: implib-soname
|
11
|
+
package-implib-solink: implib-solink
|
12
|
+
package-install-implib-soname: install-implib-soname
|
13
|
+
package-install-implib-solink: install-implib-solink
|
14
|
+
|
15
|
+
|
16
|
+
$(IMPLIB_SOLINK): $(IMPLIB_SONAME)
|
17
|
+
rm -f $(IMPLIB_SOLINK).tmp
|
18
|
+
ln -s $(IMP_SONAME) $(IMPLIB_SOLINK).tmp
|
19
|
+
mv $(IMPLIB_SOLINK).tmp $(IMPLIB_SOLINK)
|
20
|
+
|
21
|
+
install-implib-soname: implib-soname
|
22
|
+
mkdir -p $(DESTDIR)$(LIBDIR)
|
23
|
+
cp $(IMPLIB_SONAME) $(DESTDIR)$(LIBDIR)
|
24
|
+
|
25
|
+
install-implib-solink: implib-soname
|
26
|
+
mkdir -p $(DESTDIR)$(LIBDIR)
|
27
|
+
rm -f $(IMPLIB_SOLINK).tmp
|
28
|
+
ln -s $(IMP_SONAME) $(IMPLIB_SOLINK).tmp
|
29
|
+
mv $(IMPLIB_SOLINK).tmp $(DESTDIR)$(LIBDIR)/$(IMP_SOLINK)
|
30
|
+
|
31
|
+
endif
|
@@ -14,6 +14,9 @@ mb_exec_prefix_set
|
|
14
14
|
|
15
15
|
mb_bindir_basename
|
16
16
|
|
17
|
+
ccenv
|
18
|
+
mb_agnostic
|
19
|
+
|
17
20
|
cfgtest
|
18
21
|
mb_cfgtest_cc
|
19
22
|
mb_cfgtest_cflags
|
@@ -1,13 +1,7 @@
|
|
1
|
-
|
2
|
-
include $(PROJECT_DIR)/
|
1
|
+
ifneq ($(OS_DSO_EXRULES),)
|
2
|
+
include $(PROJECT_DIR)/sofort/exrules/$(OS_DSO_EXRULES).mk
|
3
3
|
endif
|
4
4
|
|
5
|
-
ifeq ($(OS_BINFMT),ELF)
|
6
|
-
include $(PROJECT_DIR)/sysinfo/os/elf.mk
|
7
|
-
endif
|
8
|
-
|
9
|
-
|
10
|
-
|
11
5
|
ifeq ($(DISABLE_STATIC),yes)
|
12
6
|
package-static:
|
13
7
|
package-install-static:
|
@@ -1,29 +0,0 @@
|
|
1
|
-
ifeq ($(CROSS_COMPILE)x,x)
|
2
|
-
CROSS_HOST =
|
3
|
-
CROSS_HOST_SPEC =
|
4
|
-
else
|
5
|
-
CROSS_HOST =
|
6
|
-
CROSS_HOST_SPEC =
|
7
|
-
endif
|
8
|
-
|
9
|
-
|
10
|
-
ifeq ($(USER_CC)x,x)
|
11
|
-
CC = $(NATIVE_CC) $(CROSS_HOST_SPEC)
|
12
|
-
else
|
13
|
-
CC = $(USER_CC) $(CROSS_HOST_SPEC)
|
14
|
-
endif
|
15
|
-
|
16
|
-
ifeq ($(USER_CPP)x,x)
|
17
|
-
CPP = $(NATIVE_CC) $(CROSS_HOST_SPEC) -E
|
18
|
-
else
|
19
|
-
CPP = $(USER_CPP) $(CROSS_HOST_SPEC) -E
|
20
|
-
endif
|
21
|
-
|
22
|
-
ifeq ($(USER_CXX)x,x)
|
23
|
-
CXX = $(NATIVE_CC) $(CROSS_HOST_SPEC) -std=c++
|
24
|
-
else
|
25
|
-
CXX = $(USER_CXX) $(CROSS_HOST_SPEC) -std=c++
|
26
|
-
endif
|
27
|
-
|
28
|
-
|
29
|
-
CFLAGS_PIC = -fPIC
|
@@ -1,31 +0,0 @@
|
|
1
|
-
ifeq ($(CROSS_COMPILE)x,x)
|
2
|
-
CROSS_HOST =
|
3
|
-
CROSS_HOST_SPEC =
|
4
|
-
else ifeq ($(CROSS_HOST)x,x)
|
5
|
-
CROSS_HOST = $(HOST)
|
6
|
-
CROSS_HOST_SPEC = --target=$(HOST)
|
7
|
-
else
|
8
|
-
CROSS_HOST_SPEC = --target=$(CROSS_HOST)
|
9
|
-
endif
|
10
|
-
|
11
|
-
|
12
|
-
ifeq ($(USER_CC)x,x)
|
13
|
-
CC = $(NATIVE_CC) $(CROSS_HOST_SPEC)
|
14
|
-
else
|
15
|
-
CC = $(USER_CC) $(CROSS_HOST_SPEC)
|
16
|
-
endif
|
17
|
-
|
18
|
-
ifeq ($(USER_CPP)x,x)
|
19
|
-
CPP = $(NATIVE_CC) $(CROSS_HOST_SPEC) -E
|
20
|
-
else
|
21
|
-
CPP = $(USER_CPP) $(CROSS_HOST_SPEC) -E
|
22
|
-
endif
|
23
|
-
|
24
|
-
ifeq ($(USER_CXX)x,x)
|
25
|
-
CXX = $(NATIVE_CC)++ $(CROSS_HOST_SPEC)
|
26
|
-
else
|
27
|
-
CXX = $(USER_CXX) $(CROSS_HOST_SPEC)
|
28
|
-
endif
|
29
|
-
|
30
|
-
|
31
|
-
CFLAGS_PIC = -fPIC
|
@@ -1,31 +0,0 @@
|
|
1
|
-
ifeq ($(CROSS_COMPILE)x,x)
|
2
|
-
CROSS_HOST =
|
3
|
-
CROSS_HOST_SPEC =
|
4
|
-
else ifeq ($(CROSS_HOST)x,x)
|
5
|
-
CROSS_HOST = $(HOST)
|
6
|
-
CROSS_HOST_SPEC = --target=$(HOST)
|
7
|
-
else
|
8
|
-
CROSS_HOST_SPEC = --target=$(CROSS_HOST)
|
9
|
-
endif
|
10
|
-
|
11
|
-
|
12
|
-
ifeq ($(USER_CC)x,x)
|
13
|
-
CC = $(NATIVE_CC) $(CROSS_HOST_SPEC) -Wno-experimental -integrated-cpp
|
14
|
-
else
|
15
|
-
CC = $(USER_CC) $(CROSS_HOST_SPEC) -Wno-experimental -integrated-cpp
|
16
|
-
endif
|
17
|
-
|
18
|
-
ifeq ($(USER_CPP)x,x)
|
19
|
-
CPP = $(NATIVE_CC) $(CROSS_HOST_SPEC) -Wno-experimental -integrated-cpp -E
|
20
|
-
else
|
21
|
-
CPP = $(USER_CPP) $(CROSS_HOST_SPEC) -Wno-experimental -integrated-cpp -E
|
22
|
-
endif
|
23
|
-
|
24
|
-
ifeq ($(USER_CXX)x,x)
|
25
|
-
CXX = $(NATIVE_CC) $(CROSS_HOST_SPEC) -Wno-experimental -integrated-cpp -std=c++
|
26
|
-
else
|
27
|
-
CXX = $(USER_CXX) $(CROSS_HOST_SPEC) -Wno-experimental -integrated-cpp -std=c++
|
28
|
-
endif
|
29
|
-
|
30
|
-
|
31
|
-
CFLAGS_PIC = -fPIC
|
@@ -1,24 +0,0 @@
|
|
1
|
-
ifeq ($(USER_CC)x,x)
|
2
|
-
ifeq ($(CROSS_COMPILE)x,x)
|
3
|
-
CC = $(CROSS_COMPILE)$(NATIVE_CC)
|
4
|
-
else
|
5
|
-
CC = $(CROSS_COMPILE)gcc
|
6
|
-
endif
|
7
|
-
else
|
8
|
-
CC = $(USER_CC)
|
9
|
-
endif
|
10
|
-
|
11
|
-
ifeq ($(USER_CPP)x,x)
|
12
|
-
CPP = $(CROSS_COMPILE)cpp
|
13
|
-
else
|
14
|
-
CPP = $(USER_CPP)
|
15
|
-
endif
|
16
|
-
|
17
|
-
ifeq ($(USER_CXX)x,x)
|
18
|
-
CXX = $(CROSS_COMPILE)c++
|
19
|
-
else
|
20
|
-
CXX = $(USER_CXX)
|
21
|
-
endif
|
22
|
-
|
23
|
-
|
24
|
-
CFLAGS_PIC = -fPIC
|
@@ -1,7 +0,0 @@
|
|
1
|
-
include $(PROJECT_DIR)/sysinfo/os/any-os.mk
|
2
|
-
|
3
|
-
ARCH =
|
4
|
-
HOST_BITS =
|
5
|
-
HOST_UNDERSCORE =
|
6
|
-
|
7
|
-
CROSS_HOST = $(TARGET)
|
@@ -1,5 +0,0 @@
|
|
1
|
-
include $(PROJECT_DIR)/sysinfo/os/midipix.mk
|
2
|
-
|
3
|
-
ARCH = nt32
|
4
|
-
HOST_BITS = 32
|
5
|
-
HOST_UNDERSCORE = '_'
|
@@ -1,5 +0,0 @@
|
|
1
|
-
include $(PROJECT_DIR)/sysinfo/os/mingw.mk
|
2
|
-
|
3
|
-
ARCH = w32
|
4
|
-
HOST_BITS = 32
|
5
|
-
HOST_UNDERSCORE = '_'
|
@@ -1,45 +0,0 @@
|
|
1
|
-
include $(PROJECT_DIR)/sysinfo/os/$(NATIVE_OS).mk
|
2
|
-
|
3
|
-
OS = $(NATIVE_OS)
|
4
|
-
HOST_BITS = $(NATIVE_OS_BITS)
|
5
|
-
HOST_UNDERSCORE = $(NATIVE_OS_UNDERSCORE)
|
6
|
-
|
7
|
-
ifeq ($(OS),linux)
|
8
|
-
ifeq ($(HOST_BITS),32)
|
9
|
-
ARCH = i386
|
10
|
-
else ifeq ($(HOST_BITS),64)
|
11
|
-
ARCH = x86_64
|
12
|
-
endif
|
13
|
-
endif
|
14
|
-
|
15
|
-
ifeq ($(OS),midipix)
|
16
|
-
ifeq ($(HOST_BITS),32)
|
17
|
-
ARCH = nt32
|
18
|
-
else ifeq ($(HOST_BITS),64)
|
19
|
-
ARCH = nt64
|
20
|
-
endif
|
21
|
-
endif
|
22
|
-
|
23
|
-
ifeq ($(OS),mingw)
|
24
|
-
ifeq ($(HOST_BITS),32)
|
25
|
-
ARCH = w32
|
26
|
-
else ifeq ($(HOST_BITS),64)
|
27
|
-
ARCH = w64
|
28
|
-
endif
|
29
|
-
endif
|
30
|
-
|
31
|
-
ifeq ($(OS),bsd)
|
32
|
-
ifeq ($(HOST_BITS),32)
|
33
|
-
ARCH = bsd32
|
34
|
-
else ifeq ($(HOST_BITS),64)
|
35
|
-
ARCH = bsd64
|
36
|
-
endif
|
37
|
-
endif
|
38
|
-
|
39
|
-
ifeq ($(OS),darwin)
|
40
|
-
ifeq ($(HOST_BITS),32)
|
41
|
-
ARCH = dw32
|
42
|
-
else ifeq ($(HOST_BITS),64)
|
43
|
-
ARCH = dw64
|
44
|
-
endif
|
45
|
-
endif
|
@@ -1,5 +0,0 @@
|
|
1
|
-
include $(PROJECT_DIR)/sysinfo/os/midipix.mk
|
2
|
-
|
3
|
-
ARCH = nt64
|
4
|
-
HOST_BITS = 64
|
5
|
-
HOST_UNDERSCORE = ''
|
@@ -1,5 +0,0 @@
|
|
1
|
-
include $(PROJECT_DIR)/sysinfo/os/mingw.mk
|
2
|
-
|
3
|
-
ARCH = w64
|
4
|
-
HOST_BITS = 64
|
5
|
-
HOST_UNDERSCORE = ''
|
@@ -1,16 +0,0 @@
|
|
1
|
-
OS = any-os
|
2
|
-
OS_APP_PREFIX =
|
3
|
-
OS_APP_SUFFIX =
|
4
|
-
OS_LIB_PREFIX = lib
|
5
|
-
OS_LIB_SUFFIX = .so
|
6
|
-
OS_IMPLIB_EXT = .invalid
|
7
|
-
OS_LIBDEF_EXT = .invalid
|
8
|
-
OS_ARCHIVE_EXT = .a
|
9
|
-
OS_SONAME = symlink
|
10
|
-
OS_BINFMT = ELF
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
# dso suffix notation
|
15
|
-
OS_LIB_PREFIXED_SUFFIX = $(OS_LIB_SUFFIX)
|
16
|
-
OS_LIB_SUFFIXED_SUFFIX =
|
@@ -1,17 +0,0 @@
|
|
1
|
-
OS = cygwin
|
2
|
-
OS_APP_PREFIX =
|
3
|
-
OS_APP_SUFFIX = .exe
|
4
|
-
OS_LIB_PREFIX = lib
|
5
|
-
OS_LIB_SUFFIX = .dll
|
6
|
-
OS_IMPLIB_EXT = .dll.a
|
7
|
-
OS_LIBDEF_EXT = .def
|
8
|
-
OS_ARCHIVE_EXT = .a
|
9
|
-
OS_SONAME = copy
|
10
|
-
OS_BINFMT = PE
|
11
|
-
OS_IMPLIB_TOOL = dlltool
|
12
|
-
|
13
|
-
CFLAGS_PIC =
|
14
|
-
|
15
|
-
# dso suffix notation
|
16
|
-
OS_LIB_PREFIXED_SUFFIX = $(OS_LIB_SUFFIX)
|
17
|
-
OS_LIB_SUFFIXED_SUFFIX =
|
@@ -1,15 +0,0 @@
|
|
1
|
-
OS = midipix
|
2
|
-
OS_APP_PREFIX =
|
3
|
-
OS_APP_SUFFIX =
|
4
|
-
OS_LIB_PREFIX = lib
|
5
|
-
OS_LIB_SUFFIX = .so
|
6
|
-
OS_IMPLIB_EXT = .lib.a
|
7
|
-
OS_LIBDEF_EXT = .so.def
|
8
|
-
OS_ARCHIVE_EXT = .a
|
9
|
-
OS_SONAME = symlink
|
10
|
-
OS_BINFMT = PE
|
11
|
-
OS_IMPLIB_TOOL = mdso
|
12
|
-
|
13
|
-
# dso suffix notation
|
14
|
-
OS_LIB_PREFIXED_SUFFIX = $(OS_LIB_SUFFIX)
|
15
|
-
OS_LIB_SUFFIXED_SUFFIX =
|
@@ -1,18 +0,0 @@
|
|
1
|
-
OS = mingw
|
2
|
-
OS_APP_PREFIX =
|
3
|
-
OS_APP_SUFFIX = .exe
|
4
|
-
OS_LIB_PREFIX = lib
|
5
|
-
OS_LIB_SUFFIX = .dll
|
6
|
-
OS_IMPLIB_EXT = .dll.a
|
7
|
-
OS_LIBDEF_EXT = .def
|
8
|
-
OS_ARCHIVE_EXT = .a
|
9
|
-
OS_SONAME = copy
|
10
|
-
OS_BINFMT = PE
|
11
|
-
OS_IMPLIB_TOOL = dlltool
|
12
|
-
|
13
|
-
CFLAGS_PIC =
|
14
|
-
CFLAGS_OS += -U__STRICT_ANSI__
|
15
|
-
|
16
|
-
# dso suffix notation
|
17
|
-
OS_LIB_PREFIXED_SUFFIX = $(OS_LIB_SUFFIX)
|
18
|
-
OS_LIB_SUFFIXED_SUFFIX =
|
@@ -1 +0,0 @@
|
|
1
|
-
include $(PROJECT_DIR)/sysinfo/os/mingw.mk
|
@@ -1 +0,0 @@
|
|
1
|
-
include $(PROJECT_DIR)/sysinfo/os/mingw.mk
|
@@ -1,18 +0,0 @@
|
|
1
|
-
OS = msys
|
2
|
-
OS_APP_PREFIX =
|
3
|
-
OS_APP_SUFFIX = .exe
|
4
|
-
OS_LIB_PREFIX = lib
|
5
|
-
OS_LIB_SUFFIX = .dll
|
6
|
-
OS_IMPLIB_EXT = .dll.a
|
7
|
-
OS_LIBDEF_EXT = .def
|
8
|
-
OS_ARCHIVE_EXT = .a
|
9
|
-
OS_SONAME = copy
|
10
|
-
OS_BINFMT = PE
|
11
|
-
OS_IMPLIB_TOOL = dlltool
|
12
|
-
|
13
|
-
CFLAGS_PIC =
|
14
|
-
CFLAGS_OS += -U__STRICT_ANSI__
|
15
|
-
|
16
|
-
# dso suffix notation
|
17
|
-
OS_LIB_PREFIXED_SUFFIX = $(OS_LIB_SUFFIX)
|
18
|
-
OS_LIB_SUFFIXED_SUFFIX =
|
@@ -1,22 +0,0 @@
|
|
1
|
-
AS = $(CROSS_COMPILE)as
|
2
|
-
AR = $(CROSS_COMPILE)ar
|
3
|
-
LD = $(CROSS_COMPILE)ld
|
4
|
-
NM = $(CROSS_COMPILE)nm
|
5
|
-
OBJDUMP = $(CROSS_COMPILE)objdump
|
6
|
-
RANLIB = $(CROSS_COMPILE)ranlib
|
7
|
-
SIZE = $(CROSS_COMPILE)size
|
8
|
-
STRIP = $(CROSS_COMPILE)strip
|
9
|
-
STRINGS = $(CROSS_COMPILE)strings
|
10
|
-
|
11
|
-
|
12
|
-
ADDR2LINE = $(CROSS_COMPILE)addr2line
|
13
|
-
COV = $(CROSS_COMPILE)gcov
|
14
|
-
CXXFILT = $(CROSS_COMPILE)c++filt
|
15
|
-
ELFEDIT = $(CROSS_COMPILE)elfedit
|
16
|
-
OBJCOPY = $(CROSS_COMPILE)objcopy
|
17
|
-
READELF = $(CROSS_COMPILE)readelf
|
18
|
-
DLLTOOL = $(CROSS_COMPILE)dlltool
|
19
|
-
MDSO = $(CROSS_COMPILE)mdso
|
20
|
-
PERK = $(CROSS_COMPILE)perk
|
21
|
-
MC = $(CROSS_COMPILE)windmc
|
22
|
-
RC = $(CROSS_COMPILE)windres
|
@@ -1,22 +0,0 @@
|
|
1
|
-
AS = llvm-mc -filetype=obj
|
2
|
-
AR = llvm-ar
|
3
|
-
LD = lld
|
4
|
-
NM = llvm-nm
|
5
|
-
OBJDUMP = llvm-objdump
|
6
|
-
RANLIB = llvm-ranlib
|
7
|
-
SIZE = llvm-size
|
8
|
-
STRIP = $(CROSS_COMPILE)strip
|
9
|
-
STRINGS = $(CROSS_COMPILE)strings
|
10
|
-
|
11
|
-
|
12
|
-
ADDR2LINE = $(CROSS_COMPILE)addr2line
|
13
|
-
COV = $(CROSS_COMPILE)gcov
|
14
|
-
CXXFILT = $(CROSS_COMPILE)c++filt
|
15
|
-
ELFEDIT = $(CROSS_COMPILE)elfedit
|
16
|
-
OBJCOPY = $(CROSS_COMPILE)objcopy
|
17
|
-
READELF = $(CROSS_COMPILE)readelf
|
18
|
-
DLLTOOL = $(CROSS_COMPILE)dlltool
|
19
|
-
MDSO = $(CROSS_COMPILE)mdso
|
20
|
-
PERK = $(CROSS_COMPILE)perk
|
21
|
-
MC = $(CROSS_COMPILE)windmc
|
22
|
-
RC = $(CROSS_COMPILE)windres
|