forked from Bareflank/hypervisor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·692 lines (574 loc) · 21.5 KB
/
configure
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
#!/bin/bash -e
#
# Bareflank Hypervisor
#
# Copyright (C) 2015 Assured Information Security, Inc.
# Author: Rian Quinn <[email protected]>
# Author: Brendan Kerrigan <[email protected]>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
version=1
# ------------------------------------------------------------------------------
# Colors
# ------------------------------------------------------------------------------
CB='\033[1;34m'
CR='\033[1;91m'
CE='\033[0m'
# ------------------------------------------------------------------------------
# Environment
# ------------------------------------------------------------------------------
# The "-nt" only has second resolution which causes problems so this function
# provides a nanosecond resolution. It has to be broken up into two comparisons
# because putting them together makes for a number larger than 64bits.
nt() {
if [[ ! -f $1 ]]; then
return 1
fi
if [[ ! -f $2 ]]; then
return 0
fi
file1_ts=`date +"%y%m%d%H%M%S" -r $1`
file2_ts=`date +"%y%m%d%H%M%S" -r $2`
if [[ $((10#$file1_ts)) -eq $((10#$file2_ts)) ]]; then
file1_ts=`date +"%N" -r $1`
file2_ts=`date +"%N" -r $2`
if [[ $((10#$file1_ts)) -gt $((10#$file2_ts)) ]]; then
return 0
else
return 1
fi
else
if [[ $((10#$file1_ts)) -gt $((10#$file2_ts)) ]]; then
return 0
else
return 1
fi
fi
}
# ------------------------------------------------------------------------------
# Environment
# ------------------------------------------------------------------------------
# We still need to do version change detection when a "-u" is being done, and
# fix things
# It's also not detecting when a makefile has changed
check_version() {
if [[ -f "$BUILD_ABS/build_version" ]]; then
current_version=`cat $BUILD_ABS/build_version`
else
return 0
fi
if [[ $((version)) -lt $((current_version)) ]]; then
warn_version_change="true"
fi
if [[ $((version)) -ne $((current_version)) ]]; then
version_change="true"
fi
}
check_env() {
if [[ ! -f "$BUILD_ABS/env.sh" ]]; then
echo -e "creating script:$CB env.sh$CE"
echo "export BUILD_ABS=\"$BUILD_ABS\"" >> $BUILD_ABS/env.sh
echo "export HYPER_ABS=\"$HYPER_ABS\"" >> $BUILD_ABS/env.sh
echo "export LLVM_RELEASE=\"release_38\"" >> $BUILD_ABS/env.sh
echo "export module_file=\"$module_file\"" >> $BUILD_ABS/env.sh
echo "export compiler=\"$compiler\"" >> $BUILD_ABS/env.sh
printf "export extensions=\"" >> $BUILD_ABS/env.sh
printf "%s;" "${extensions[@]}" >> $BUILD_ABS/env.sh
printf "\"\n" >> $BUILD_ABS/env.sh
fi
echo "$version" > $BUILD_ABS/build_version
}
check_git_working_tree() {
if [[ ! -f "$BUILD_ABS/git_working_tree.sh" ]]; then
echo -e "creating script:$CB git_working_tree.sh$CE"
echo "export GIT_DIR=\"$HYPER_ABS/.git\"" >> $BUILD_ABS/git_working_tree.sh
echo "export GIT_WORK_TREE=\"$HYPER_ABS\"" >> $BUILD_ABS/git_working_tree.sh
fi
}
setup_environment_variables() {
local dirname=`dirname $0`
BUILD_ABS=`pwd`;
BUILD_REL=`pwd`;
HYPER_ABS=`cd "$dirname"; pwd`;
HYPER_REL=`cd "$dirname"; pwd`;
if [[ -z "$module_file" ]]; then
module_file=$HYPER_ABS/bfm/bin/native/vmm.modules
fi
if [[ -z "$compiler" ]]; then
compiler=gcc_520
fi
}
# ------------------------------------------------------------------------------
# Options
# ------------------------------------------------------------------------------
option_help() {
echo -e "Usage: configure [OPTION]"
echo -e "Configures the Bareflank out-of-tree build environment"
echo -e ""
echo -e " -h, --help show this help menu"
echo -e " -c, --clean remove build components"
echo -e " -u, --update_all updates all files"
echo -e " -s, --update_scripts updates everything minus makefiles"
echo -e " -r, --update_makefiles updates makefiles only"
echo -e " -m, --module_file <filename> module_file to use"
echo -e " -e, --extension <dirname> directory of extension"
echo -e " -g, --compiler <dirname> directory of cross compiler"
echo -e ""
}
option_distclean() {
if [[ -z "$BUILD_ABS" ]]; then
echo "FATAL ERROR: BUILD_ABS not set"
exit 1
fi
if [[ ! $PWD == "$BUILD_ABS"* ]]; then
echo "ERROR: Build system has moved which is not supported!!!"
exit 3
fi
if [[ -d "$BUILD_ABS/makefiles" ]]; then
echo -e "removing:$CB makefiles$CE"
rm -Rf $BUILD_ABS/makefiles
fi
if [[ -f "$BUILD_ABS/build_version" ]] || \
[[ -f "$BUILD_ABS/env.sh" ]] || \
[[ -f "$BUILD_ABS/git_working_tree.sh" ]] || \
[[ -f "$BUILD_ABS/module_file" ]] || \
[[ -f "$BUILD_ABS/build_scripts" ]]; then
echo -e "removing:$CB scripts$CE"
rm -Rf $BUILD_ABS/Makefile
rm -Rf $BUILD_ABS/build_version
rm -Rf $BUILD_ABS/env.sh
rm -Rf $BUILD_ABS/git_working_tree.sh
rm -Rf $BUILD_ABS/module_file
rm -Rf $BUILD_ABS/build_scripts
fi
if [[ -d "$BUILD_ABS/build_libbfc" ]] || \
[[ -d "$BUILD_ABS/build_libcxx" ]] || \
[[ -d "$BUILD_ABS/build_libcxxabi" ]] || \
[[ -d "$BUILD_ABS/build_newlib" ]]; then
echo -e "removing:$CB build dirs$CE"
rm -Rf $BUILD_ABS/build_libbfc
rm -Rf $BUILD_ABS/build_libcxx
rm -Rf $BUILD_ABS/build_libcxxabi
rm -Rf $BUILD_ABS/build_newlib
fi
if [[ -d "$BUILD_ABS/source_libbfc" ]] || \
[[ -d "$BUILD_ABS/source_libcxx" ]] || \
[[ -d "$BUILD_ABS/source_libcxxabi" ]] || \
[[ -d "$BUILD_ABS/source_llvm" ]] || \
[[ -d "$BUILD_ABS/source_newlib" ]]; then
echo -e "removing:$CB source dirs$CE"
rm -Rf $BUILD_ABS/source_libbfc
rm -Rf $BUILD_ABS/source_libcxx
rm -Rf $BUILD_ABS/source_libcxxabi
rm -Rf $BUILD_ABS/source_llvm
rm -Rf $BUILD_ABS/source_newlib
fi
if [[ -d "$BUILD_ABS/sysroot" ]]; then
echo -e "removing:$CB sysroot$CE"
rm -Rf $BUILD_ABS/sysroot
fi
if [[ -d "$BUILD_ABS/extensions" ]]; then
echo -e "removing:$CB extension links$CE"
rm -Rf $BUILD_ABS/extensions
fi
rebuild_all="true"
}
option_run() {
if [[ ! $update == "true" ]]; then
setup_environment_variables
rebuild_all="true"
else
if [[ -z "$BUILD_ABS" ]]; then
BUILD_ABS=`pwd`
fi
if [[ -f "$BUILD_ABS/env.sh" ]]; then
source $BUILD_ABS/env.sh
else
echo "ERROR: Unable to locate environment variables"
exit 2
fi
if [[ -z "$HYPER_REL" ]]; then
HYPER_REL=$HYPER_ABS
fi
if [[ -z "$BUILD_REL" ]]; then
BUILD_REL=$BUILD_ABS
fi
if [[ -z "$compiler" ]]; then
compiler=gcc_520
fi
IFS=';' read -ra extensions <<< "$extensions"
fi
if [[ ! $PWD == "$BUILD_ABS"* ]]; then
echo "ERROR: Build system has moved which is not supported!!!"
exit 3
fi
check_version
if [[ ! $update == "true" ]] || [[ $version_change == "true" ]]; then
cd $BUILD_ABS
option_distclean
fi
if [[ $rebuild_all == "true" ]]; then
if [[ ! -d $BUILD_ABS/makefiles ]]; then
mkdir -p $BUILD_ABS/makefiles
fi
check_env
check_git_working_tree
create_extension_links
recursively_copy_makefiles $BUILD_ABS/makefiles $HYPER_ABS
recursively_copy_makefiles $BUILD_ABS/makefiles $BUILD_ABS/extensions
create_root_makefile
copy_scripts
check_module_file
create_wrapper_links
elif [[ $rebuild_scripts == "true" ]]; then
check_env
check_git_working_tree
create_extension_links
copy_scripts
check_module_file
create_wrapper_links
elif [[ $rebuild_makefiles == "true" ]]; then
if [[ $BUILD_ABS == $PWD ]]; then
create_root_makefile
else
check_makefile $BUILD_REL $HYPER_REL
fi
fi
if [[ $this_is_make == "true" ]] && [[ $warn_version_change == "true" ]]; then
echo "WARNING: The previous build system was newer than the current one."
echo " As a result, the current build system might be broken."
echo " If a problem occurs, you might have delete your build dir,"
echo " create a new one, and re-run configure"
fi
if [[ $this_is_make == "true" ]] && [[ $version_change == "true" ]]; then
echo "Make cannot continue as a version change occured. Please re-run make!!!"
exit 5
fi
}
# ------------------------------------------------------------------------------
# Copy Makefiles
# ------------------------------------------------------------------------------
# Converts a line to use absolute paths instead of relative paths. This
# function tables a line in the following format
#
# var_name <delimiter> file1 %HYPER_ABS%/file2 /file3
#
# %HYPER_ABS%: the absolute (root) location of the hypervisor
# %HYPER_REL%: the relative location of Makefile.bf file being parsed
# %BUILD_ABS%: the absolute (root) location of the build tree
# %BUILD_REL%: the relative location of Makefile file being created
#
# If the file starts with %xxx%, the path is replaced and if the file starts
# with "/" it is assumed that the file already is an absolute path.
# Otherwise, the makefile's current location is added to the file so that
# it's now an absolute path instead.
#
# Note that last_line is used to remove additional whitespace that is not
# needed. Also note that there is a strange issue breaking up the variable
# when the delimiter is changed, so we have a hack in there to change the
# array indexes when needed.
#
# $1: the line to add paths to
# $2: hyper_rel path
# $4: build_rel path
# $4: file name to write to
# $5: delimiter
#
add_absolute_path() {
last_line=
IFS=$5 read -ra var <<< "$1"
local var_name=${var[0]}
local var_args=${var[1]}
if [[ -z $var_args ]]; then
var_args=${var[2]}
fi
IFS=' ' read -ra array <<< "$var_args"
for filename in "${array[@]}"; do
last_line="something"
if [[ $filename == /* ]]; then
echo $var_name$5$filename >> $4
continue
fi
if [[ $filename == %HYPER_ABS%* ]]; then
echo $var_name$5$HYPER_ABS/${filename#"%HYPER_ABS%/"} >> $4
continue
fi
if [[ $filename == %BUILD_ABS%* ]]; then
echo $var_name$5$BUILD_ABS/${filename#"%BUILD_ABS%/"} >> $4
continue
fi
if [[ $filename == %HYPER_REL%* ]]; then
echo $var_name$5$2/${filename#"%HYPER_REL%/"} >> $4
continue
fi
if [[ $filename == %BUILD_REL%* ]]; then
echo $var_name$5$3/${filename#"%BUILD_REL%/"} >> $4
continue
fi
echo $var_name$5$2/$filename >> $4
done
}
copy_makefile() {
rm -Rf $1/Makefile.tmp
echo -e "################################################################################" >> $1/Makefile.tmp
echo -e "# Auto Generated Section (created by configured script)" >> $1/Makefile.tmp
echo -e "################################################################################" >> $1/Makefile.tmp
echo -e "" >> $1/Makefile.tmp
echo -e "HYPER_ABS:=$HYPER_ABS" >> $1/Makefile.tmp
echo -e "BUILD_ABS:=$BUILD_ABS" >> $1/Makefile.tmp
echo -e "HYPER_REL:=$2" >> $1/Makefile.tmp
echo -e "BUILD_REL:=$1" >> $1/Makefile.tmp
echo -e "MAKEFILE_ABS:=\$(dir \$(abspath \$(lastword \$(MAKEFILE_LIST))))" >> $1/Makefile.tmp
echo -e "ifneq (\$(dir \$(BUILD_REL)/), \$(MAKEFILE_ABS))" >> $1/Makefile.tmp
echo -e " \$(error Build system has moved which is not supported!!!)" >> $1/Makefile.tmp
echo -e "endif" >> $1/Makefile.tmp
echo -e "" >> $1/Makefile.tmp
echo -e "" >> $1/Makefile.tmp
while IFS='' read -r line
do
trimmed_line=`echo $line`
case "$trimmed_line" in
*SOURCES*)
add_absolute_path "$trimmed_line" $2 $1 $1/Makefile.tmp '+='
;;
*PATHS*)
add_absolute_path "$trimmed_line" $2 $1 $1/Makefile.tmp '+='
;;
*OBJDIR*)
add_absolute_path "$trimmed_line" $2 $1 $1/Makefile.tmp '+='
;;
*OUTDIR*)
add_absolute_path "$trimmed_line" $2 $1 $1/Makefile.tmp '+='
;;
include*)
add_absolute_path "$trimmed_line" $2 $1 $1/Makefile.tmp ' '
;;
*)
if [[ -z "$trimmed_line" ]] && [[ ! -z "$last_line" ]]; then
echo " " >> $1/Makefile.tmp
fi
if [[ ! -z "$trimmed_line" ]]; then
if [[ $trimmed_line == *+=* ]] && [[ $trimmed_line == *+= ]]; then
line=
else
echo "$line" >> $1/Makefile.tmp
fi
fi
last_line="$line"
;;
esac
done < $2/Makefile.bf
sed -i "s/%HYPER_ABS%/${HYPER_ABS//\//\\/}/g" $1/Makefile.tmp
sed -i "s/%BUILD_ABS%/${BUILD_ABS//\//\\/}/g" $1/Makefile.tmp
sed -i "s/%HYPER_REL%/${2//\//\\/}/g" $1/Makefile.tmp
sed -i "s/%BUILD_REL%/${1//\//\\/}/g" $1/Makefile.tmp
mv $1/Makefile.tmp $1/Makefile
}
check_makefile() {
if nt "$2/Makefile.bf" "$1/Makefile"; then
echo -e "generating makefile: $CB$1/Makefile$CE"
copy_makefile $1 `cd $2; pwd -P`
fi
}
recursively_copy_makefiles() {
if [[ -f "$2/Makefile.bf" ]]; then
check_makefile $1 $2
fi
if [[ -f "$2/Makefile.bf" ]] || [[ $2 == "$BUILD_ABS/extensions" ]]; then
for dir in $2/*
do
if [[ ! -d "$dir" ]]; then
continue
fi
local abs_dir=$dir
local rel_dir=`basename $abs_dir`
if [[ -f "$2/$rel_dir/Makefile.bf" ]]; then
if [[ ! -d "$1/$rel_dir" ]]; then
mkdir -p $1/$rel_dir
fi
recursively_copy_makefiles $1/$rel_dir $2/$rel_dir
fi
done
fi
}
# ------------------------------------------------------------------------------
# Copy Script
# ------------------------------------------------------------------------------
# Copy Script
#
# This copies a script from the hypervisor tree to the build tree. In doing
# do it fills in the environment script location so that the script can
# source it's environment variables.
#
# $1: the script to copy
#
copy_script() {
local hyper_filename="$HYPER_ABS/tools/scripts/$1"
local build_filename="$BUILD_ABS/build_scripts/$1"
if nt "$hyper_filename" "$build_filename"; then
echo -e "generating script: $CB$1$CE"
if [[ ! -d $BUILD_ABS/build_scripts/ ]]; then
mkdir -p $BUILD_ABS/build_scripts/
fi
cp -p $hyper_filename $build_filename
sed -i "s/%ENV_SOURCE%/source ${BUILD_ABS//\//\\/}\/env.sh/g" $build_filename
fi
}
copy_scripts() {
copy_script "bareflank_gcc_wrapper.sh"
copy_script "filter_module_file.sh"
copy_script "build_newlib.sh"
copy_script "build_libcxx.sh"
copy_script "build_libcxxabi.sh"
copy_script "build_libbfc.sh"
copy_script "build_driver.sh"
copy_script "clean_driver.sh"
copy_script "fetch_newlib.sh"
copy_script "fetch_libcxx.sh"
copy_script "fetch_libcxxabi.sh"
copy_script "fetch_llvm.sh"
copy_script "fetch_libbfc.sh"
}
# ------------------------------------------------------------------------------
# Wrapper Links
# ------------------------------------------------------------------------------
create_wrapper_links () {
if [[ ! -f "$BUILD_ABS/build_scripts/x86_64-bareflank-gcc" ]]; then
echo -e "linking compiler script:$CB x86_64-bareflank-gcc$CE"
ln -s $BUILD_ABS/build_scripts/bareflank_gcc_wrapper.sh $BUILD_ABS/build_scripts/x86_64-bareflank-gcc
fi
if [[ ! -f "$BUILD_ABS/build_scripts/x86_64-bareflank-g++" ]]; then
echo -e "linking compiler script:$CB x86_64-bareflank-g++$CE"
ln -s $BUILD_ABS/build_scripts/bareflank_gcc_wrapper.sh $BUILD_ABS/build_scripts/x86_64-bareflank-g++
fi
if [[ ! -f "$BUILD_ABS/build_scripts/x86_64-bareflank-ar" ]]; then
echo -e "linking compiler script:$CB x86_64-bareflank-ar$CE"
ln -s $BUILD_ABS/build_scripts/bareflank_gcc_wrapper.sh $BUILD_ABS/build_scripts/x86_64-bareflank-ar
fi
if [[ ! -f "$BUILD_ABS/build_scripts/x86_64-bareflank-nasm" ]]; then
echo -e "linking compiler script:$CB x86_64-bareflank-nasm$CE"
ln -s $BUILD_ABS/build_scripts/bareflank_gcc_wrapper.sh $BUILD_ABS/build_scripts/x86_64-bareflank-nasm
fi
if [[ ! -f "$BUILD_ABS/build_scripts/x86_64-bareflank-docker" ]]; then
echo -e "linking compiler script:$CB x86_64-bareflank-docker$CE"
ln -s $BUILD_ABS/build_scripts/bareflank_gcc_wrapper.sh $BUILD_ABS/build_scripts/x86_64-bareflank-docker
fi
}
# ------------------------------------------------------------------------------
# Check Module Files
# ------------------------------------------------------------------------------
check_module_file () {
if nt "$module_file" "$BUILD_ABS/module_file"; then
echo -e "copying module file: $CB$module_file -> $BUILD_ABS/module_file$CE"
cp -Rf $module_file $BUILD_ABS/module_file
fi
}
# ------------------------------------------------------------------------------
# Extensions
# ------------------------------------------------------------------------------
create_extension_links() {
if [[ ! -d "$BUILD_ABS/extensions" ]]; then
mkdir -p $BUILD_ABS/extensions
fi
for arg in "${extensions[@]}"
do
if [[ -z "$arg" ]]; then
continue
fi
local path=`cd "$arg"; pwd`
local name=`basename $path`
if [[ ! $name == "hypervisor_"* ]]; then
prefix="$prefix"
fi
if [[ ! -L "$BUILD_ABS/extensions/$prefix$name" ]]; then
echo -e "linking extension: $CB$path -> $BUILD_ABS/extensions/$prefix$name$CE"
ln -s $path $BUILD_ABS/extensions/$prefix$name
fi
done
}
# ------------------------------------------------------------------------------
# Root Makefile
# ------------------------------------------------------------------------------
create_root_makefile() {
if nt "$HYPER_ABS/Makefile.bf" "$BUILD_ABS/Makefile"; then
echo -e "generating root makefile: $CB$BUILD_ABS/Makefile$CE"
local targets=`cd $BUILD_ABS/makefiles; $HYPER_ABS/tools/scripts/makefile_targets.sh`
rm -Rf $BUILD_ABS/Makefile
echo -e "default: all" >> $BUILD_ABS/Makefile
echo -e "Makefile: $HYPER_ABS/Makefile.bf" >> $BUILD_ABS/Makefile
echo -e "\t@$HYPER_ABS/configure -r --this-is-make" >> $BUILD_ABS/Makefile
echo -e "$targets:" >> $BUILD_ABS/Makefile
echo -e "\t@$HYPER_ABS/configure -s --this-is-make" >> $BUILD_ABS/Makefile
echo -e "\t@\$(MAKE) --no-print-directory -C makefiles \$(MAKECMDGOALS)" >> $BUILD_ABS/Makefile
fi
}
# ------------------------------------------------------------------------------
# Filter Arguments
# ------------------------------------------------------------------------------
i=0
extensions[$i]=
while [[ $# -ne 0 ]]; do
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
option_help
exit 0
fi
if [[ $1 == "-c" ]] || [[ $1 == "--clean" ]]; then
if [[ ! -f env.sh ]]; then
echo "Unable to clean build. 'env.sh' is missing."
exit 2
fi
source env.sh
option_distclean
exit 0
fi
if [[ $1 == "-u" ]] || [[ $1 == "--update_all" ]]; then
update="true"
rebuild_all="true"
fi
if [[ $1 == "-s" ]] || [[ $1 == "--update_scripts" ]]; then
update="true"
rebuild_scripts="true"
fi
if [[ $1 == "-r" ]] || [[ $1 == "--update_makefiles" ]]; then
update="true"
rebuild_makefiles="true"
fi
if [[ $1 == "--this-is-make" ]]; then
this_is_make="true"
fi
if [[ $1 == "-m" ]] || [[ $1 == "--module_file" ]]; then
shift
if [[ ! -f $1 ]]; then
echo "ERROR: module file does not exist: $1"
exit 1
fi
module_file=`realpath $1`
fi
if [[ $1 == "-g" ]] || [[ $1 == "--compiler" ]]; then
shift
compiler=$1
fi
if [[ $1 == "-e" || $1 == "--extension" ]]; then
shift
if [[ ! -d "$1" ]]; then
echo "ERROR: extension does not exist: $1"
exit 1
fi
extensions[$i]=`realpath $1`
i=$((i + 1))
fi
shift
done
option_run