Browse Source

fxsdk: add shortcuts and update help message (#1)

master
Lephe 4 months ago
parent
commit
abcc5f07c9
2 changed files with 56 additions and 26 deletions
  1. 3
    1
      Makefile
  2. 53
    25
      fxsdk/fxsdk.sh

+ 3
- 1
Makefile View File

@@ -18,7 +18,7 @@ dflags = -MT $@ -MMD -MP -MF $(@:%.o=%.d)
# $TARGETS is provided by Makefile.cfg.
#

TARGETS := $(filter-out fxconv,$(TARGETS))
TARGETS := $(filter-out fxconv fxsdk,$(TARGETS))
bin = $(TARGETS:%=bin/%)

# fxconv has no sources files because it's written in Python, and fxsdk has no
@@ -79,6 +79,8 @@ Makefile.cfg:

.PHONY: all clean distclean

.PRECIOUS: build/fxos/lexer-%.yy.c

#
# Installing
#

+ 53
- 25
fxsdk/fxsdk.sh View File

@@ -1,23 +1,51 @@
#! /usr/bin/env bash

set -e

# Note: this line is edited at install time to insert the install folder
PREFIX=\

usage_string=$(cat << EOF
usage: fxsdk new [<folder name>] [options...]
fxsdk build [fx|cg]
fxsdk send [fx|cg]
usage: fxsdk new <folder>
fxsdk (build|build-fx|build-cg) [-s]
fxsdk (send|send-fx|send-cg)

This program is a command-line helper for the fxSDK, a set of tools used in
conjunction with gint to develop add-ins for CASIO fx-9860G and fx-CG 50.

Project creation:
fxsdk new [<folder name>] [options...]
-@ <name>, --internal=<name> Internal project name
fxsdk new <folder>

Creates a new project in the specified folder. Project info is input
interactively. Creates <folder name> and populates it with default project
data.

Compilation:
fxsdk build [-s]
fxsdk build-fx [-s]
fxsdk build-cg [-s]

Compiles the current project for fx-9860G (.g1a target) or fx-CG 50 (.g3a
target). With 'fxsdk build', compiles every existing build folder, and ask
interactively if none is found.

With '-s', also sends the resulting program to the calculator.

Installation:
fxsdk send
fxsdk send-fx
fxsdk send-cg

Sends the target file to the calculator. Uses p7 (which must be installed
externally) for fx-9860G. Currently not implemented for fx-CG 50, as it
requires detecting and mounting the calculator (same of the Graph 35+E II).
EOF
)

# Project creation flags
# -n <name>, --name=<name> Project name
# -@ <name>, --internal=<name> Internal project name

usage() {
echo "$usage_string"
exit ${1:-1}
@@ -155,7 +183,7 @@ fxsdk_build() {
return
fi

echo -e 'Unknown platform (valid names are "fx" and "cg")\n'
echo -e 'Unknown platform (valid names are "fx" and "cg")!'
done
}

@@ -169,25 +197,25 @@ fxsdk_build_cg() {
make all-cg
}

fxsdk_install() {
fxsdk_send() {
if [[ -e "build-fx" && ! -e "build-cg" ]]; then
fxsdk_install_fx
fxsdk_send_fx
fi

if [[ -e "build-cg" && ! -e "build-fx" ]]; then
fxsdk_install_cg
fxsdk_send_cg
fi

echo "either no or several platforms are targeted, use 'fxsdk install-fx' or"
echo "fxsdk 'install-cg' to specify which calculator to install to."
echo "either no or several platforms are targeted, use 'fxsdk send-fx' or"
echo "fxsdk 'send-cg' to specify which calculator to send to."
}

fxsdk_install_fx() {
fxsdk_send_fx() {
status "Installing for fx9860g using p7"
make install-fx
}

fxsdk_install_cg() {
fxsdk_send_cg() {
# TODO
echo "error: this is tricky and not implemented yet, sorry x_x"
}
@@ -202,23 +230,23 @@ case $1 in
fxsdk_new_project_interactive "$@";;

# Project compilation
"build")
"build"|"b")
fxsdk_build
[[ $1 == "-s" ]] && fxsdk_install;;
"build-fx")
[[ $1 == "-s" ]] && fxsdk_send;;
"build-fx"|"bf"|"bfx")
fxsdk_build_fx
[[ $1 == "-s" ]] && fxsdk_install;;
"build-cg")
[[ $1 == "-s" ]] && fxsdk_send_fx;;
"build-cg"|"bc"|"bcg")
fxsdk_build_cg
[[ $1 == "-s" ]] && fxsdk_install;;
[[ $1 == "-s" ]] && fxsdk_send_cg;;

# Install
"install")
fxsdk_install;;
"install-fx")
fxsdk_install_fx;;
"install-cg")
fxsdk_install_cg;;
"send"|"s")
fxsdk_send;;
"send-fx"|"sf"|"sfx")
fxsdk_send_fx;;
"send-cg"|"sc"|"scg")
fxsdk_send_cg;;

# Misc
-h|--help|-\?)

Loading…
Cancel
Save