4 # This file is *NOT* generated by GNU Autoconf, but written by NIIBE Yutaka
6 # Copyright (C) 2010, 2011, 2012 Free Software Initiative of Japan
8 # This file is a part of NeuG, a Random Number Generator implementation.
10 # NeuG is free software: you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
15 # NeuG is distributed in the hope that it will be useful, but WITHOUT
16 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 # License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
34 *=*) optarg=`expr "X$option" : '[^=]*=\(.*\)'` ;;
52 echo "Unrecognized option \`$option'" >&2
53 echo "Try \`$0 --help' for more information." >&2
59 if test "$help" = "yes"; then
63 Defaults for the options are specified in brackets.
66 -h, --help display this help and exit [no]
67 --vidpid=VID:PID specify vendor/product ID [<NONE>]
68 --target=TARGET specify target [STBEE_MINI]
74 --with-dfu build image for DFU [<target specific>]
79 if test "$vidpid" = "none"; then
80 echo "Please specify Vendor ID and Product ID by --vidpid option."
84 BOARD_DIR=../boards/$target
85 if test -d $BOARD_DIR; then
86 echo "Configured for target: $target"
88 echo "Unsupported target \`$target'" >&2
92 # Flash page size in byte
94 # Flash memory size in KiB
102 if test "$with_dfu" = "default"; then
114 if test "$with_dfu" = "default"; then
125 if test "$with_dfu" = "yes"; then
126 echo "Configured for DFU"
128 FLASH_SIZE=`expr $FLASH_SIZE - 12`
129 DFU_DEFINE="#define DFU_SUPPORT 1"
131 echo "Configured for bare system (no-DFU)"
133 DFU_DEFINE="#undef DFU_SUPPORT"
136 REVISION=`git describe --dirty="-modified"`
137 CONFIG="$target:dfu=$with_dfu"
140 while read VIDPID VERSION PRODUCT VENDOR; do
141 if test "$vidpid" = "$VIDPID"; then
142 (echo $VIDPID | sed -n -e "s%^\([0-9a-f][0-9a-f]\)\([0-9a-f][0-9a-f]\):\([0-9a-f][0-9a-f]\)\([0-9a-f][0-9a-f]\)$% 0x\2, 0x\1, /* idVendor */\n 0x\4, 0x\3, /* idProduct */%p"
143 echo $VERSION | sed -n -e "s%^\([0-9a-f][0-9a-f]\)\([0-9a-f][0-9a-f]\)$% 0x\2, 0x\1, /* bcdDevice */%p"
144 ) > usb-vid-pid-ver.c.inc
145 (echo 'static const uint8_t neug_string_vendor[] = {'
146 echo " ${#VENDOR}*2+2, /* bLength */"
147 echo " USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */"
148 echo " /* Manufacturer: \"$VENDOR\" */"
149 echo $VENDOR | sed -n -e "s/\(........\)/\1\n/gp" | sed -n -e "s/\(.\)/'\1', 0, /g" -e "s/^/ /" -e "s/ $//p"
152 echo 'static const uint8_t neug_string_product[] = {'
153 echo " ${#PRODUCT}*2+2, /* bLength */"
154 echo " USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */"
155 echo " /* Product name: \"$PRODUCT\" */"
156 echo $PRODUCT | sed -n -e "s/\(........\)/\1\n/gp" | sed -n -e "s/\(.\)/'\1', 0, /g" -e "s/^/ /" -e "s/ $//p"
159 echo '#ifdef USB_STRINGS_FOR_NEUG'
160 echo 'static const uint8_t neug_revision_detail[] = {'
161 echo " ${#REVISION}*2+2, /* bLength */"
162 echo " USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */"
163 echo " /* revision detail: \"$REVISION\" */"
164 echo $REVISION | sed -n -e "s/\(........\)/\1\n/gp" | sed -n -e "s/\(.\)/'\1', 0, /g" -e "s/^/ /" -e "s/ $//p"
167 echo 'static const uint8_t neug_config_options[] = {'
168 echo " ${#CONFIG}*2+2, /* bLength */"
169 echo " USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */"
170 echo " /* configure options: \"$CONFIG\" */"
171 echo $CONFIG | sed -n -e "s/\(........\)/\1\n/gp" | sed -n -e "s/\(.\)/'\1', 0, /g" -e "s/^/ /" -e "s/ $//p"
177 done; exit 1) < ../NEUG_USB_DEVICE_ID
179 echo "Please specify valid Vendor ID and Product ID."
180 echo "Check ../NEUG_USB_DEVICE_ID."
184 sed -e "s%@BOARD_DIR@%$BOARD_DIR%" \
185 < Makefile.in > Makefile
186 sed -e "s/@ORIGIN@/$ORIGIN/" -e "s/@FLASH_SIZE@/$FLASH_SIZE/" \
187 -e "s/@MEMORY_SIZE@/$MEMORY_SIZE/" \
188 -e "s/@FLASH_PAGE_SIZE@/$FLASH_PAGE_SIZE/" \
189 < neug.ld.in > neug.ld
190 sed -e "s/@DFU_DEFINE@/$DFU_DEFINE/" \
191 -e "s/@FLASH_PAGE_SIZE@/$FLASH_PAGE_SIZE/" \
192 < config.h.in > config.h