From abcc5f07c96c07a398fc7e7a9af65f7616b98f4d Mon Sep 17 00:00:00 2001 From: Lephe Date: Sun, 16 Jun 2019 19:47:19 -0400 Subject: [PATCH] fxsdk: add shortcuts and update help message (#1) --- Makefile | 4 ++- fxsdk/fxsdk.sh | 78 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 56 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 89ba4f6..b2a3737 100755 --- a/Makefile +++ b/Makefile @@ -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 # diff --git a/fxsdk/fxsdk.sh b/fxsdk/fxsdk.sh index 1117d9a..685e3c2 100755 --- a/fxsdk/fxsdk.sh +++ b/fxsdk/fxsdk.sh @@ -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 [] [options...] - fxsdk build [fx|cg] - fxsdk send [fx|cg] +usage: fxsdk new + 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 [] [options...] - -@ , --internal= Internal project name + fxsdk new + Creates a new project in the specified folder. Project info is input + interactively. Creates 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= Project name +# -@ , --internal= 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|-\?)