diff options
author | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2018-05-09 21:36:40 -0700 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2018-05-10 00:36:40 -0400 |
commit | 5346cb2d20100f2bbf35e8c8107ae272404f2198 (patch) | |
tree | 9b330b1e75e40bec2f5b7ede35f0c39adc09a362 /util | |
parent | c89565cc3dda82642a0c6c839176602f05fc56f1 (diff) | |
download | firmware-5346cb2d20100f2bbf35e8c8107ae272404f2198.tar.gz firmware-5346cb2d20100f2bbf35e8c8107ae272404f2198.tar.bz2 firmware-5346cb2d20100f2bbf35e8c8107ae272404f2198.zip |
Support both AVR and ps2avrGB targets for new_project script (#2811)
* Stopping point at creating targets for new_project script
* Add second argument for target
* Add the ps2avrgb target
* consider the case where the firmware type target is not valid
* fix template files to be more generic
* Code cleanup
* Change variable name to be more descriptive
* make avr the default
* forgot to put the template files in
* Take out useless comments
* add usage info
Diffstat (limited to 'util')
-rwxr-xr-x | util/new_project.sh | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/util/new_project.sh b/util/new_project.sh index 0c28feb4a..a85e83322 100755 --- a/util/new_project.sh +++ b/util/new_project.sh @@ -2,9 +2,21 @@ # Script to make a new quantum project # Jack Humbert 2015 -if [ -z "$1" ]; then - echo "Usage: $0 <keyboard_name>" - exit 1 +KEYBOARD=$1 +KEYBOARD_TYPE=$2 + +if [ -z "$KEYBOARD" ]; then + echo "Usage: $0 <keyboard_name> <keyboard_type>" + echo "Example: $0 gh60 avr" + echo "Example: $0 bfake ps2avrgb" + exit 1 +elif [ -z "$KEYBOARD_TYPE" ]; then + KEYBOARD_TYPE=avr +fi + +if [ $KEYBOARD_TYPE != "avr" -a $KEYBOARD_TYPE != "ps2avrgb" ]; then + echo "Invalid keyboard type target" + exit 1 fi if [ -e "keyboards/$1" ]; then @@ -14,12 +26,14 @@ fi cd "$(dirname "$0")/.." -KEYBOARD=$1 KEYBOARD_UPPERCASE=$(echo $1 | awk '{print toupper($0)}') KEYBOARD_NAME=$(basename $1) KEYBOARD_NAME_UPPERCASE=$(echo $KEYBOARD_NAME | awk '{print toupper($0)}') -cp -r quantum/template keyboards/$KEYBOARD + +cp -r quantum/template/base keyboards/$KEYBOARD +cp -r quantum/template/$KEYBOARD_TYPE/. keyboards/$KEYBOARD + mv keyboards/${KEYBOARD}/template.c keyboards/${KEYBOARD}/${KEYBOARD_NAME}.c mv keyboards/${KEYBOARD}/template.h keyboards/${KEYBOARD}/${KEYBOARD_NAME}.h find keyboards/${KEYBOARD} -type f -exec sed -i '' -e "s;%KEYBOARD%;${KEYBOARD_NAME};g" {} \; |