annotate scripts/mk-component.sh @ 15:08ecd0bd517d

scripts/mk-component.sh: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 07:19:38 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #!/bin/sh
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 if [ $# -lt 1 -o $# -gt 2 ]
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 then
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 echo "usage: $0 component-lib [flavor]" 1>&2
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 exit 1
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 fi
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 LIBNAME="$1"
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 if [ -n "$2" ]
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 then
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 recipe_file="components/$1-$2"
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 else
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 recipe_file="components/$1"
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 fi
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 if [ ! -f "$recipe_file" ]
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 then
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 echo "Error: $recipe_file not found" 1>&2
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 exit 1
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 fi
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 if [ -z "$BUILD_DIR" ]
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 then
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 echo "Error: BUILD_DIR= must be passed via environment" 1>&2
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 exit 1
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 fi
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 set -e
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 mkdir -p $BUILD_DIR/$LIBNAME
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 # beginning of the Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 echo "all: $LIBNAME.lib" > $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 echo >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 # shell functions to be used in the recipes
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 make_version() {
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 case $# in
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 1)
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 echo "$1_version.c:" >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 echo " ../../scripts/make-version.sh $1 > $1_version.c" \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 ;;
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 2)
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 echo "$2_version.c:" >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 echo " ../../scripts/make-version.sh $1 > $2_version.c" \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 ;;
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 *)
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 echo "Error: make_version takes 1 or 2 arguments" 1>&2
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 exit 1
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 ;;
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 esac
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 echo >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 }
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 asm_file() {
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 if [ $# != 1 ]
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 then
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 echo "Error: asm_file takes 1 argument" 1>&2
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 exit 1
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 fi
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 objname=`basename "$1" .s`.obj
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 helpers/makeline dep $objname "$1" >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 helpers/makeline cmd ../../toolwrap/asm470 ${ASMFLAGS} "$1" '$@' \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 echo >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 OBJS="$OBJS $objname"
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 }
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 cfile_plain() {
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 if [ $# != 1 ]
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 then
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 echo "Error: cfile_plain takes 1 argument" 1>&2
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 exit 1
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 fi
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 objname=`basename "$1" .c`.obj
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 helpers/makeline dep $objname "$1" >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 case "$objname" in
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 *[A-Z]*)
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 helpers/makeline cmd rm -f '$@' \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 ;;
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 esac
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 helpers/makeline cmd ../../toolwrap/cl470 -q -c ${CFLAGS} ${CPPFLAGS} \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 "$1" >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 case "$objname" in
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 *[A-Z]*)
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 objname_lc=`echo $objname | tr A-Z a-z`
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 helpers/makeline cmd mv $objname_lc $objname \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 ;;
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 esac
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 echo >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 OBJS="$OBJS $objname"
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 }
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 cfile_str2ind() {
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 if [ $# != 1 ]
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 then
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 echo "Error: cfile_str2ind takes 1 argument" 1>&2
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 exit 1
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 fi
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 if [ "$USE_STR2IND" = 1 ]
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 then
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 objname=`basename "$1" .c`.obj
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 pp_name=`echo $1 | sed -e 's/\.c$/.pp/' | tr A-Z a-z`
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 pp__name=`echo $1 | sed -e 's/\.c$/.pp_/' | tr A-Z a-z`
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 helpers/makeline dep $objname "$1" \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 case "$objname" in
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 *[A-Z]*)
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 helpers/makeline cmd rm -f '$@' \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 ;;
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 esac
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 helpers/makeline cmd ../../toolwrap/cl470 -q -po -p? -x \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 ${CPPFLAGS} "$1" >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 helpers/makeline cmd ../../toolwrap/str2ind -a \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 -t ../str2ind.tab -l ../str2ind.log \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 -f "$pp_name" >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 helpers/makeline cmd ../../toolwrap/cl470 -q -c ${CFLAGS} \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 "$pp__name" >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 helpers/makeline cmd @rm -f "$pp_name" \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 helpers/makeline cmd @rm -f "$pp__name" \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 case "$objname" in
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 *[A-Z]*)
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 objname_lc=`echo $objname | tr A-Z a-z`
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 helpers/makeline cmd mv $objname_lc $objname \
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 ;;
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 esac
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 echo >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 OBJS="$OBJS $objname"
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 else
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 cfile_plain "$1"
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 fi
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 }
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 cfile_symlink() {
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 if [ $# != 1 ]
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 then
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 echo "Error: cfile_symlink takes 1 argument" 1>&2
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 exit 1
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 fi
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 localcopy=`basename "$1"`
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 echo "$localcopy:" >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 echo " ln -s $1 ." >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 echo >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 cfile_plain $localcopy
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 }
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 # invoke the recipe
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 SRC=../../src
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 OBJS=
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 . "$recipe_file"
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 # finish the Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 helpers/makeline dep $LIBNAME.lib ${OBJS} >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 echo ' ../../toolwrap/ar470 r $@ $^' >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 echo >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 echo 'clean:' >> $BUILD_DIR/$LIBNAME/Makefile
08ecd0bd517d scripts/mk-component.sh: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 echo ' rm -f *.obj *.lib *.c' >> $BUILD_DIR/$LIBNAME/Makefile