-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·909 lines (684 loc) · 19.7 KB
/
configure
File metadata and controls
executable file
·909 lines (684 loc) · 19.7 KB
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
#!/bin/bash
# Configuration script for C/C++ (c) 2024-2025 Kaan Baydemir
# Out-of-source build is adopted
# shellcheck disable=SC2034
# shellcheck disable=SC2059
# shellcheck disable=SC1091
########################################
# Project (MODIFY HERE)
PROJECT="Nocterm"
PROJECT_BRIEF="Simple Terminal UI Library"
########################################
# Targets
# Chosen Targets - Do not modify!
TARGETS=""
# Available Targets (MODIFY HERE)
TARGETS_AVAILABLE="nocterm"
########################################
# Default Source Extensions (MODIFY HERE)
SRC_EXT="c"
########################################
# Functions
# config_validate_var_name "_var"
function config_validate_var_name(){
if test -z "$1"; then
return 1
fi
if grep -qP "^[a-zA-Z_][a-zA-Z0-9_]*$" <<< "$1"; then
return 0
else
return 1
fi
}
# config_validate_target_name "target-name"
function config_validate_target_name(){
if test -z "$1"; then
return 1
fi
if grep -qP "^([a-z][a-z0-9]*)(-([a-z][a-z0-9]*))*$" <<< "$1"; then
return 0
else
return 1
fi
}
# config_parse_semver "$(cat VERSION)" VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_PRERELEASE
function config_parse_semver(){
local version_full= # Default
if test -n "$1"; then
version_full=$1
else
return 1
fi
local IFS="-"
read -ra version <<< "${version_full}"
local parsed_count=${#version[@]}
if test "${parsed_count}" -ge "1" && test "${parsed_count}" -le 2; then
local regex_pattern_1="^([0]|[1-9][0-9]*)([.]([1-9]+|[0])){2}$"
grep -qP "${regex_pattern_1}" <<< "${version[0]}"
if test "$?" != "0"; then
return 1
fi
local mmp=
IFS="."
read -ra mmp <<< "${version[0]}"
if test ${#mmp[@]} != 3; then
return 1;
fi
if test "${parsed_count}" = "2"; then
local regex_pattern_2="^(([0]|[1-9][0-9]*)|([a-zA-Z][a-zA-Z0-9]*))"
regex_pattern_2+="([.](([0]|[1-9][0-9]*)|([a-zA-Z][a-zA-Z0-9]*)))*$"
grep -qP "${regex_pattern_2}" <<< "${version[1]}"
if test "$?" != "0"; then
return 1
fi
fi
else
return 1
fi
if test -n "$2" && config_validate_var_name "$2"; then
eval "$2=\"${version[0]}${version[1]:+-${version[1]}}\""
fi
if test -n "$3" && config_validate_var_name "$3"; then
eval "$3=\"${mmp[0]}\""
fi
if test -n "$4" && config_validate_var_name "$4"; then
eval "$4=\"${mmp[1]}\""
fi
if test -n "$5" && config_validate_var_name "$5"; then
eval "$5=\"${mmp[2]}\""
fi
if test -n "$6" && config_validate_var_name "$6"; then
if test -n "${version[1]}"; then
eval "$6=\"${version[1]}\""
else
eval "$6=\"\""
fi
fi
return 0;
}
# config_build_in "makefile.in" "build/makefile"
function config_build_in(){
if ! test -f "$1"; then
return 1
fi
if test -z "$2"; then
return 1
fi
local build_dir
build_dir=$(dirname "$2")
if ! test -d "${build_dir}"; then
mkdir -p "${build_dir}"
fi
local template_variables
template_variables=$(grep -oP "@[A-Z_]+@" "$1")
if test -z "${template_variables}"; then
config_log WARN "$1 does not contain template variables"
return 0
fi
local template_variables_trimmed=
local trimmed_variable=
local i=
for i in $template_variables; do
trimmed_variable="${i:1:-1}"
if ! test -v "${trimmed_variable}"; then
config_log WARN "${trimmed_variable} is not set in the script"
return 1
fi
template_variables_trimmed="${template_variables_trimmed} ${trimmed_variable} "
done
local substitute_expression="sed"
for i in $template_variables_trimmed; do
substitute_expression+=" -e \"s|@$i@|${!i}|g\""
done
substitute_expression+=" \"$1\" > \"$2\""
eval "${substitute_expression}"
return 0
}
# config_log PASS "Build"
function config_log(){
if test "$OPTION_SUPRESS_LOGS" = "true"; then
return 0
fi
if test -z "$1"; then
return 1
fi
if test $# -ne 2; then
return 1
fi
local output_stdout=""
local output_file=""
output_stdout+="\033[3mconfigure\033[0m ["
output_file="configure ["
case $1 in
INFO)
output_stdout+="\033[34mINFO"
output_file+=INFO
;;
WARN)
output_stdout+="\033[33mWARN"
output_file+=WARN
;;
FAIL)
output_stdout+="\033[31mFAIL"
output_file+="FAIL"
;;
PASS)
output_stdout+="\033[32mPASS"
output_file+="PASS"
;;
DEBG)
output_stdout+="\033[35mDEBG"
output_file+="DEBG"
;;
*)
return 1
;;
esac
output_stdout+="\033[0m]: "
output_file+="]: "
shift
output_stdout+="$*"
output_file+="$*"
printf "$(date "+%d/%m/%Y %X.%06N") ${output_stdout}\n"
printf "$(date "+%d/%m/%Y %X.%06N") %s\n" "${output_file}" >> "${CONFIG_LOG_FILE}"
return 0
}
# config_softlink here go/there
function config_softlink(){
if test -e "$2" && ! test -L "$2"; then
config_log WARN "'$2' is not a symbolic link"
return 1
fi
rm -f "$2"
mkdir -p "$(dirname "$2")"
ln -s "$1" "$2"
return 0
}
# EXT is used for overriding SRC_EXT variable
# EXT="c" config_sources "TARGET" "src files" test
function config_sources(){
if test $# -lt 2; then
return 1
fi
if ! config_validate_target_name "$1"; then
return 1
fi
if ! config_check_target_available "$1"; then
return 1
fi
if (! test "${EXT}" && ! test "${SRC_EXT}"); then
return 1
fi
if ! test "${EXT}"; then
EXT="${SRC_EXT}"
fi
local MK_TARGET="$1"
local MK_TARGET_SRC
MK_TARGET_SRC="$(sed s/-/_/g <<< "$(config_uppercase "${MK_TARGET}")_SRC")"
local MK_TARGET_OBJ
MK_TARGET_OBJ="$(sed s/-/_/g <<< "$(config_uppercase "${MK_TARGET}")_OBJ")"
shift
local SRC_CONF=""
local SRC_CONF_FIND=""
local MK_SRC_CONF=""
local SRC_CONF_FIND_ARR=
local i=
for i in "$@"; do
if test -f "$i" && grep -qP ".+[.]${EXT}" <<< "$(basename "$i")"; then
SRC_CONF+="\"$(readlink -f "$i")\" "
elif test -d "$i"; then
SRC_CONF_FIND=$(find "$i" -type f -name "*.${EXT}" -printf "\"%p\" ")
eval "SRC_CONF_FIND_ARR=($(echo "${SRC_CONF_FIND}"))"
for j in "${SRC_CONF_FIND_ARR[@]}"; do
SRC_CONF+="\"$(readlink -f "$j")\" "
done
fi
done
local SRC_CONF_ARR=
eval "SRC_CONF_ARR=(${SRC_CONF})"
for i in "${SRC_CONF_ARR[@]}"; do
MK_SRC_CONF+="${MK_TARGET_SRC} += $i"
MK_SRC_CONF+=$'\n'
done
config_file_append "${BUILD_DIR}/sources.mk" ".PHONY: ${MK_TARGET} ${MK_TARGET}-objects"
config_file_append "${BUILD_DIR}/sources.mk" "${MK_SRC_CONF}"
config_file_append "${BUILD_DIR}/sources.mk" "${MK_TARGET_OBJ} = \$(patsubst \${ROOT_DIR}/%, \${BUILD_OBJ_DIR}/%, \${${MK_TARGET_SRC}:.${EXT}=.o})"
config_file_append "${BUILD_DIR}/sources.mk" "${MK_TARGET}-objects: \${${MK_TARGET_OBJ}}"
config_file_append "${BUILD_DIR}/sources.mk" "${MK_TARGET}: ${MK_TARGET}-objects"
return 0
}
# config_text X << EOF
# hello world
# EOF
#
# config_text << EOF
# hello world
# EOF
function config_text(){
if test $# != 1 && test $# != 0; then
return 1
fi
if test $# = 1; then
if ! config_validate_var_name "$1"; then
return 1
fi
fi
local output=""
while IFS= read -r line; do
if test -n "${output}"; then
output+=$'\n'
fi
output+="${line}"
done
if test $# = 1; then
local cmd="$1=\"$output\""
eval "$cmd"
else
printf "%s" "$output"
fi
return 0
}
# config_file_write "new_file.txt" "$output"
#
# config_file_write "new_file.txt" << EOF
# hello there
# EOF
function config_file_write(){
if test $# = 1; then
local output=""
while IFS= read -r line; do
if test -n "${output}"; then
output+=$'\n'
fi
output+="${line}"
done
if test -z "$output"; then
return 1
fi
mkdir -p "$(dirname "$1")"
printf "%s\n" "$output" > "$1"
return 0
elif test $# = 2; then
mkdir -p "$(dirname "$1")"
printf "%s\n" "$2" > "$1"
else
return 1
fi
}
# config_file_append "new_file.txt" "$output"
#
# config_file_append "new_file.txt" << EOF
# hello there
# EOF
function config_file_append(){
if test $# = 1; then
local output=" "
while IFS= read -r line; do
if test -n "${output}"; then
output+=$'\n'
fi
output+="${line}"
done
if test -z "$output"; then
return 1
fi
mkdir -p "$(dirname "$1")"
printf "%s\n" "$output" >> "$1"
return 0
elif test $# = 2; then
mkdir -p "$(dirname "$1")"
printf "%s\n" "$2" >> "$1"
else
return 1
fi
}
# config_debug "something wrong"
function config_debug(){
if test -z "$@"; then
return 1
fi
if test "${OPTION_DEBUG}" = true; then
config_log DEBG "$@"
fi
return 0
}
# config_debug X
function config_uppercase(){
if test $# != 1; then
return 1
fi
echo "$1" | tr '[:lower:]' '[:upper:]'
return 0
}
# config_search_text "hello" "hello input"
function config_search_text(){
if test $# != 2; then
return 1
fi
if grep -q "$1" <<< "$2"
then
return 0
else
return 1
fi
}
# config_check_target_set "TARGET"
function config_check_target_set(){
if test $# != 1; then
return 1
fi
if ! config_validate_target_name "$1"; then
return 1
fi
local target_set=
IFS=" " read -ra target_set <<< "${TARGETS}"
local i=
for i in "${target_set[@]}"; do
if test "$i" = "$1"; then
return 0
fi
done
return 1
}
# config_check_target_available "TARGET"
function config_check_target_available(){
if test $# != 1; then
return 1
fi
if ! config_validate_target_name "$1"; then
return 1
fi
local target_available=
IFS=" " read -ra target_available <<< "${TARGETS_AVAILABLE}"
local i=
for i in "${target_available[@]}"; do
if test "$i" = "$1"; then
return 0
fi
done
return 1
}
function config_banner(){
printf "\nConfiguring Project: \033[34m\033[1m%s\033[0m\nTime: \033[32m%s\033[0m\n\n" "${PROJECT}" "$(date "+%d/%m/%Y %X.%06N")"
printf "\nConfiguring Project: %s\nTime: %s\n\n" "${PROJECT}" "$(date "+%d/%m/%Y %X.%06N")" >> "${CONFIG_LOG_FILE}"
return 0
}
function config_builddir_create(){
if ! test -d "${BUILD_DIR}"; then
mkdir -p "${BUILD_DIR}"
touch "${MARKER}"
mkdir -p "${BUILD_OBJ_DIR}"
mkdir -p "${BUILD_LIB_DIR}"
mkdir -p "${BUILD_BIN_DIR}"
mkdir -p "${BUILD_DOC_DIR}"
mkdir -p "${BUILD_PKG_DIR}"
fi
return
}
function config_builddir_sanity_check(){
if ! test -f "${MARKER}" && test -d "${BUILD_DIR}"; then
config_log FAIL "This repository is not configured with configure script"
return 1
else
return 0
fi
}
function config_builddir_clean(){
# Clean well-known files and directories
rm -f "${BUILD_DIR:?}/makefile"
rm -f "${BUILD_DIR:?}/configs.mk"
rm -f "${BUILD_DIR:?}/sources.mk"
rm -f "${BUILD_DIR:?}/makefile.mk"
rm -f "${BUILD_DIR:?}/config.log"
rm -f "${BUILD_DIR:?}/build.log"
rm -rf "${BUILD_OBJ_DIR:?}/*"
rm -rf "${BUILD_BIN_DIR:?}/*"
rm -rf "${BUILD_LIB_DIR:?}/*"
rm -rf "${BUILD_DOC_DIR:?}/*"
rm -rf "${BUILD_PKG_DIR:?}/*"
# Clean all symbolic links
for i in "${BUILD_DIR}"/*; do
if test -L "$i"; then
rm -f "$i"
fi
done
}
function config_kconfig_targets(){
if test "${OPTION_KCONFIG}" = "false"; then
return
fi
source "${BUILD_DIR}/.config" 2>/dev/null
if test $? = 0; then
for i in ${TARGETS}; do
target_name_sanitized="$(sed s/-/_/g <<< "$(config_uppercase "${i}")")"
target_kconfig_option_key="CONFIG_TARGET_${target_name_sanitized}_CC"
target_kconfig_option_value="${!target_kconfig_option_key}"
if test -n "${target_kconfig_option_value}"; then
config_file_append "${BUILD_DIR}/configs.mk" <<< "${i}: CC=${target_kconfig_option_value}"
fi
target_kconfig_option_key="CONFIG_TARGET_${target_name_sanitized}_CXX"
target_kconfig_option_value="${!target_kconfig_option_key}"
if test -n "${target_kconfig_option_value}"; then
config_file_append "${BUILD_DIR}/configs.mk" <<< "${i}: CXX=${target_kconfig_option_value}"
fi
target_kconfig_option_key="CONFIG_TARGET_${target_name_sanitized}_CFLAGS"
target_kconfig_option_value="${!target_kconfig_option_key}"
if test -n "${target_kconfig_option_value}"; then
config_file_append "${BUILD_DIR}/configs.mk" <<< "${i}: CFLAGS=${target_kconfig_option_value}"
fi
target_kconfig_option_key="CONFIG_TARGET_${target_name_sanitized}_CPPFLAGS"
target_kconfig_option_value="${!target_kconfig_option_key}"
if test -n "${target_kconfig_option_value}"; then
config_file_append "${BUILD_DIR}/configs.mk" <<< "${i}: CPPFLAGS=${target_kconfig_option_value}"
fi
target_kconfig_option_key="CONFIG_TARGET_${target_name_sanitized}_CXXFLAGS"
target_kconfig_option_value="${!target_kconfig_option_key}"
if test -n "${target_kconfig_option_value}"; then
config_file_append "${BUILD_DIR}/configs.mk" <<< "${i}: CXXFLAGS=${target_kconfig_option_value}"
fi
target_kconfig_option_key="CONFIG_TARGET_${target_name_sanitized}_LDFLAGS"
target_kconfig_option_value="${!target_kconfig_option_key}"
if test -n "${target_kconfig_option_value}"; then
config_file_append "${BUILD_DIR}/configs.mk" <<< "${i}: LDFLAGS=${target_kconfig_option_value}"
fi
done
fi
return
}
function config_doxygen(){
if test "${OPTION_DOXYGEN}" = "false"; then
return
fi
if test "$(command -v doxygen)" && test -f "${ROOT_DIR}/Doxyfile.in"; then
if config_build_in "${ROOT_DIR}/Doxyfile.in" "${BUILD_DIR}/Doxyfile"; then
config_log PASS "Doxyfile.in"
else
config_log FAIL "Doxyfile.in"
fi
doxygen "${BUILD_DIR}/Doxyfile" 1>/dev/null 2>/dev/null
else
config_log WARN "doxygen is not found or Doxyfile is missing"
fi
exit 0
}
function config_kconfig_menu(){
if test "${OPTION_KCONFIG_MENU}" = "false"; then
return
fi
if test "$(command -v menuconfig)" && test -f "${ROOT_DIR}/Kconfig"; then
KCONFIG_CONFIG="${BUILD_DIR}/.config" menuconfig
config_log INFO "Kconfig Menu Configuration"
else
config_log WARN "menuconfig is not found or Kconfig is missing"
fi
exit 0
}
########################################
# Root Directory Detection
ROOT_DIR=$(cd "$(dirname -- "$0")" || exit; pwd)
if ! test "$ROOT_DIR" = "$PWD"; then
exit 1
fi
########################################
# Default Compiler, Preprocessor,
# and Linker Flags
CC="gcc"
CXX="g++"
CFLAGS="-Wall -Werror -I\"${ROOT_DIR}/include\""
CPPFLAGS=""
CXXFLAGS=""
LDFLAGS="-static"
########################################
# Directories
BUILD_DIR="${ROOT_DIR}/build"
BUILD_OBJ_DIR="${BUILD_DIR}/obj"
BUILD_BIN_DIR="${BUILD_DIR}/bin"
BUILD_LIB_DIR="${BUILD_DIR}/lib"
BUILD_DOC_DIR="${BUILD_DIR}/docs"
BUILD_PKG_DIR="${BUILD_DIR}/pkg"
########################################
# Build Directory Marker
MARKER="${BUILD_DIR}/auto-configure-marker"
########################################
# Logging
CONFIG_LOG_FILE="${BUILD_DIR}/config.log"
########################################
# Options
OPTION_DEBUG=false
OPTION_SUPRESS_LOGS=false
OPTION_TARGETS=""
OPTION_KCONFIG_MENU=false
OPTION_DOXYGEN=false
# Based on Main Programming Language (MODIFY HERE)
OPTION_DOXYGEN_OPTIMIZE_OUTPUT_FOR_C=YES
########################################
# Extra Options (MODIFY HERE)
OPTION_DOXYGEN_EXAMPLE_PATH="examples"
OPTION_DOXYGEN_INPUT="docs src include"
OPTION_DOXYGEN_EXCLUDE="docs/doxygen-theme"
########################################
# Sanity Check Before Creating Build Dir
if ! config_builddir_sanity_check; then
exit 1
fi
config_builddir_create
########################################
# Add options when necessary
# Some defaults can be overrided here
for opt do
optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
case "$opt" in
# Opens up the Kconfig Menu and exits
--kconfig-menu)
OPTION_KCONFIG_MENU=true
;;
# Creates documentation from Doxyfile and exits
--doxygen)
OPTION_DOXYGEN=true
;;
# Optimize Doxygen output for C language
--doxygen-optimize-c)
OPTION_DOXYGEN_OPTIMIZE_OUTPUT_FOR_C=YES
;;
--doxygen-input)
OPTION_DOXYGEN_INPUT="$optarg"
;;
# Deletes build directory
--clean)
rm -rf "${BUILD_DIR:?}"
exit 0
;;
# Shows extra information
--debug)
OPTION_DEBUG=true
;;
# Override Makefile Default CC
--cc=*)
CC="$optarg"
;;
# Override Makefile Default CXX
--cxx=*)
CXX="$optarg"
;;
# Override Makefile Default CFLAGS
--cflags=*)
CFLAGS="$optarg"
;;
# Override Makefile Default CPPFLAGS
--cppflags=*)
CPPFLAGS="$optarg"
;;
# Override Makefile Default CXXFLAGS
--cxxflags=*)
CXXFLAGS="$optarg"
;;
# Override Makefile Default LDFLAGS
--ldflags=*)
LDFLAGS="$optarg"
;;
# Disables log outputs
--suppress-logs)
OPTION_SUPRESS_LOGS=true
;;
# Select Targets
--targets=*)
if test "$optarg" = "*" || test "$optarg" = "all"; then
TARGETS="${TARGETS_AVAILABLE}"
else
IFS="," read -ra OPTION_TARGETS <<< "$optarg"
for i in "${OPTION_TARGETS[@]}"; do
if ! config_check_target_available "$i"; then
config_log WARN "${i} is not a valid target."
exit 1
fi
TARGETS+="$i "
done
fi
;;
*)
config_log FAIL "Unknown option specified: '${opt}'"
exit 1
;;
esac
done
config_builddir_clean
########################################
# Default Configuration
config_banner
if config_parse_semver "$(cat VERSION)" \
VERSION \
VERSION_MAJOR \
VERSION_MINOR \
VERSION_PATCH \
VERSION_PRERELEASE;
then
config_log PASS "Parse semantic version"
else
config_log FAIL "Parse semantic version"
exit 1
fi
config_doxygen
config_kconfig_menu
if test -z "$TARGETS"; then
config_log WARN "No target specified"
exit 1
fi
if config_build_in "base.mk.in" "${BUILD_DIR}/base.mk"; then
config_log PASS "base.mk"
else
config_log FAIL "base.mk"
fi
config_kconfig_targets
########################################
# Target Configuration (MODIFY HERE)
for target in ${TARGETS}; do
case "$target" in
nocterm)
if config_sources "$target" "src"; then
config_log PASS "${PROJECT} sources"
else
config_log FAIL "${PROJECT} sources"
fi
;;
esac
done