This repository was archived by the owner on Nov 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
154 lines (130 loc) · 4.34 KB
/
build.sh
File metadata and controls
154 lines (130 loc) · 4.34 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
#! /bin/sh
# build script
# N.B we assume file names are not replicated throughout tree, except for build flavor overloading
set -a
ROOTDIR=`pwd -L`
case `uname 2>/dev/null` in
Windows*)
PATHSEP=";"
;;
Linux|CYGWIN*)
PATHSEP=":"
;;
esac
GOAL=
if [ X${1:-} = X-ac ]; then
GOAL=allclean
shift 1
fi
if [ X${1:-} = X-c ]; then
GOAL=clean
shift 1
fi
if [ X${1:-} = X-dc ]; then
GOAL=depclean
shift 1
fi
if [ X${1:-} = X-l ]; then
GOAL=list
shift 1
fi
unset TARGET TARGETTYPE ASMS LCFS SOURCES LIBS ALLCLEANS INCLUDES DEFINES
case `uname 2>/dev/null` in
Windows*|CYGWIN*)
build="windows"
;;
Linux)
build="linux"
;;
esac
# our build flavors are below
grep -v "^#" <<EOF | while read TARGET BUILD CPU
nichelite cw7.CW MCF52233.NICHELITE.CFV2
cpustick cw7.CW MCF52221.CFV2
cpustick cw7.CW MCF52233.CFV2
cpustick cw7.CW MCF52259.CFV2
cpustick cw7.CW DEMO_KIT.MCF52259.CFV2
cpustick cw7.CW MCF5211.CFV2
cpustick cw6.CW MCF51JM128.CFV1
cpustick cw6.CW MCF51QE128.CFV1
cpustick cw6.CW BADGE_BOARD.MCF51JM128.CFV1
# cpustick sourcery.GCC.EXTRACT MCF52221.CFV2
# cpustick sourcery.GCC.EXTRACT MCF52259.CFV2
# cpustick sourcery.GCC.EXTRACT DEMO_KIT.MCF52259.CFV2
# stickos linux.GCC.STICK_GUEST MCF52221.CFV2
# stickos linux.GCC.STICK_GUEST MCF52233.CFV2
# stickos linux.GCC.STICK_GUEST MCF52259.CFV2
# stickos linux.GCC.STICK_GUEST DEMO_KIT.MCF52259.CFV2
# stickos linux.GCC.STICK_GUEST MCF5211.CFV2
# stickos linux.GCC.STICK_GUEST MCF51JM128.CFV1
# stickos linux.GCC.STICK_GUEST MCF51QE128.CFV1
# stickos linux.GCC.STICK_GUEST BADGE_BOARD.MCF51JM128.CFV1
stickos windows.STICK_GUEST MCF52221.CFV2
stickos windows.STICK_GUEST MCF52233.CFV2
stickos windows.STICK_GUEST MCF52259.CFV2
stickos windows.STICK_GUEST DEMO_KIT.MCF52259.CFV2
stickos windows.STICK_GUEST MCF5211.CFV2
stickos windows.STICK_GUEST MCF51JM128.CFV1
stickos windows.STICK_GUEST FB32.MCF51JM128.CFV1
stickos windows.STICK_GUEST FB32LITE.MCF51JM128.CFV1
stickos windows.STICK_GUEST MCF51CN128.CFV1
stickos windows.STICK_GUEST MCF51QE128.CFV1
stickos windows.STICK_GUEST BADGE_BOARD.MCF51JM128.CFV1
stickos windows.STICK_GUEST 512HBL.PIC32.__32MX440F512H__.HIDBL
stickos windows.STICK_GUEST 512H.PIC32.__32MX440F512H__
stickos windows.STICK_GUEST 512LBL.PIC32.__32MX460F512L__.HIDBL
stickos windows.STICK_GUEST 512L.PIC32.__32MX460F512L__
stickos windows.STICK_GUEST 795HBL.PIC32.__32MX795F512H__.HIDBL
stickos windows.STICK_GUEST 795H.PIC32.__32MX795F512H__
stickos windows.STICK_GUEST 795LBL.PIC32.__32MX795F512L__.HIDBL
stickos windows.STICK_GUEST 795L.PIC32.__32MX795F512L__
stickos windows.STICK_GUEST UNO32.CHIPKIT.PIC32.__32MX320F128H__
stickos windows.STICK_GUEST MAX32.CHIPKIT.PIC32.__32MX795F512L__
EOF
do
for MODE in DEBUG RELEASE; do
# exclude flavors not requested by the user
for i in $*; do
if echo "$TARGET $BUILD $CPU $MODE" | grep -i $i >/dev/null; then
:
else
continue 2
fi
done
# exclude impossible flavor combinations
if [ ${BUILD%%.*} = linux -a $build = windows ]; then
continue
fi
if [ ${BUILD%%.*} = windows -a $build = linux ]; then
continue
fi
if [ ${BUILD%%.*} = cw6 -a $build = linux ]; then
continue
fi
if [ ${BUILD%%.*} = cw7 -a $build = linux ]; then
continue
fi
PATHS=`echo $TARGET $BUILD $CPU $MODE | sed 's![.]! !g'`
echo "*** $PATHS ***"
# compute all possible source/include directories
DIRS=`find . -name \*.[Cchs] -o -name \*.lcf | sed 's!/[^/]*$!!' | sort -u | sed 's!$!/;!'`
# select preferred sources/include directories
SOURCEDIRS=`for i in $PATHS; do echo "$DIRS" | grep -i "/$i/"; done`
# append remaining source/include directories
PATHS=`echo $PATHS | sed 's! !/|/!g'`
SOURCEDIRS=`echo "$SOURCEDIRS"; echo "$DIRS" | grep -viE "/$PATHS/"`
# make source/include directories absolute
SOURCEDIRS=`echo $SOURCEDIRS | sed "s![.]/!$ROOTDIR/!g"`
# specify object directory name
OBJDIR=obj.${BUILD%%.*}.${CPU%%.*}.${MODE%%.*}
# finally, make the target flavor
# N.B. we pass ROOTDIR, PATHSEP, TARGET, BUILD, CPU, MODE, SOURCEDIRS, OBJDIR thru environment
if make --no-print-directory -C $TARGET -f Makefile.$TARGET $GOAL; then
:
else
exit 1
fi
echo
done
done
echo "build done!"