mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2024-12-29 13:03:37 +01:00
fxsdk: new build system
This commit is contained in:
parent
d74785d34d
commit
46b19bab62
2 changed files with 164 additions and 64 deletions
|
@ -10,42 +10,63 @@
|
||||||
include project.cfg
|
include project.cfg
|
||||||
|
|
||||||
# Compiler flags
|
# Compiler flags
|
||||||
cf := -mb -ffreestanding -nostdlib -Wall -Wextra \
|
CFLAGSFX := $(CFLAGS) $(CFLAGS_FX) $(INCLUDE)
|
||||||
-fstrict-volatile-bitfields $(CFLAGS)
|
CFLAGSCG := $(CFLAGS) $(CFLAGS_CG) $(INCLUDE)
|
||||||
cf-fx := $(cf) -m3 -DFX9860G
|
|
||||||
cf-cg := $(cf) -m4-nofpu -DFXCG50
|
|
||||||
|
|
||||||
# Linker flags
|
# Linker flags
|
||||||
lf-fx := -Tfx9860g.ld -lgint-fx $(LDFLAGS) -lgcc -Wl,-Map=build-fx/map
|
LDFLAGSFX := $(LDFLAGS) $(LDFLAGS_FX)
|
||||||
lf-cg := -Tfxcg50.ld -lgint-cg $(LDFLAGS) -lgcc -Wl,-Map=build-cg/map
|
LDFLAGSCG := $(LDFLAGS) $(LDFLAGS_CG)
|
||||||
|
|
||||||
dflags = -MMD -MT $@ -MF $(@:.o=.d) -MP
|
# Dependency list generation flags
|
||||||
cpflags := -R .bss -R .gint_bss
|
depflags = -MMD -MT $@ -MF $(@:.o=.d) -MP
|
||||||
|
# ELF to binary flags
|
||||||
|
BINFLAGS := -R .bss -R .gint_bss
|
||||||
|
|
||||||
g1af := -i "$(ICON_FX)" -n "$(NAME)" --internal="$(INTERNAL)"
|
# G1A and G3A generation flags
|
||||||
g3af := -n basic:"$(NAME)" -i uns:"$(ICON_CG_UNS)" -i sel:"$(ICON_CG_SEL)"
|
NAME_G1A ?= $(NAME)
|
||||||
|
NAME_G3A ?= $(NAME)
|
||||||
|
G1AF := -i "$(ICON_FX)" -n "$(NAME_G1A)" --internal="$(INTERNAL)"
|
||||||
|
G3AF := -n basic:"$(NAME_G3A)" -i uns:"$(ICON_CG_UNS)" -i sel:"$(ICON_CG_SEL)"
|
||||||
|
|
||||||
|
ifeq "$(TOOLCHAIN_FX)" ""
|
||||||
|
TOOLCHAIN_FX := sh3eb-elf
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq "$(TOOLCHAIN_CG)" ""
|
||||||
|
TOOLCHAIN_CG := sh4eb-elf
|
||||||
|
endif
|
||||||
|
|
||||||
|
# fxconv flags
|
||||||
|
FXCONVFX := --fx --toolchain=$(TOOLCHAIN_FX)
|
||||||
|
FXCONVCG := --cg --toolchain=$(TOOLCHAIN_CG)
|
||||||
|
|
||||||
#
|
#
|
||||||
# File listings
|
# File listings
|
||||||
#
|
#
|
||||||
|
|
||||||
null :=
|
ifeq "$(TARGET)" ""
|
||||||
filename := $(subst $(null) $(null),-,$(NAME))
|
NULL :=
|
||||||
|
TARGET := $(subst $(NULL) $(NULL),-,$(NAME))
|
||||||
|
endif
|
||||||
|
|
||||||
elf = $(dir $<)$(filename).elf
|
elf = $(dir $<)$(TARGET).elf
|
||||||
bin = $(dir $<)$(filename).bin
|
bin = $(dir $<)$(TARGET).bin
|
||||||
target-fx := $(filename).g1a
|
TARGETFX := $(TARGET).g1a
|
||||||
target-cg := $(filename).g3a
|
TARGETCG := $(TARGET).g3a
|
||||||
|
|
||||||
# Source files
|
# Source files
|
||||||
src := $(wildcard src/*.[csS] src/*/*.[csS] src/*/*/*.[csS] \
|
src := $(wildcard src/*.[csS] \
|
||||||
|
src/*/*.[csS] \
|
||||||
|
src/*/*/*.[csS] \
|
||||||
src/*/*/*/*.[csS])
|
src/*/*/*/*.[csS])
|
||||||
assets-fx := $(wildcard assets-fx/*/*)
|
assets-fx := $(wildcard assets-fx/*/*)
|
||||||
assets-cg := $(wildcard assets-cg/*/*)
|
assets-cg := $(wildcard assets-cg/*/*)
|
||||||
|
|
||||||
# Object files
|
# Object files
|
||||||
obj-fx := $(src:%.c=build-fx/%.o) $(assets-fx:assets-fx/%=build-fx/assets/%.o)
|
obj-fx := $(src:%=build-fx/%.o) \
|
||||||
obj-cg := $(src:%.c=build-cg/%.o) $(assets-cg:assets-cg/%=build-cg/assets/%.o)
|
$(assets-fx:assets-fx/%=build-fx/assets/%.o)
|
||||||
|
obj-cg := $(src:%=build-cg/%.o) \
|
||||||
|
$(assets-cg:assets-cg/%=build-cg/assets/%.o)
|
||||||
|
|
||||||
# Additional dependencies
|
# Additional dependencies
|
||||||
deps-fx := $(ICON_FX)
|
deps-fx := $(ICON_FX)
|
||||||
|
@ -66,60 +87,66 @@ endif
|
||||||
|
|
||||||
all: $(all)
|
all: $(all)
|
||||||
|
|
||||||
all-fx: $(target-fx)
|
all-fx: $(TARGETFX)
|
||||||
all-cg: $(target-cg)
|
all-cg: $(TARGETCG)
|
||||||
|
|
||||||
$(target-fx): $(obj-fx) $(deps-fx)
|
$(TARGETFX): $(obj-fx) $(deps-fx)
|
||||||
|
$(TOOLCHAIN_FX)-gcc -o $(elf) $(obj-fx) $(CFLAGSFX) $(LDFLAGSFX)
|
||||||
|
$(TOOLCHAIN_FX)-objcopy -O binary $(BINFLAGS) $(elf) $(bin)
|
||||||
|
fxg1a $(bin) -o $@ $(G1AF)
|
||||||
|
|
||||||
sh3eb-elf-gcc -o $(elf) $(obj-fx) $(cf-fx) $(lf-fx)
|
$(TARGETCG): $(obj-cg) $(deps-cg)
|
||||||
sh3eb-elf-objcopy -O binary $(cpflags) $(elf) $(bin)
|
$(TOOLCHAIN_CG)-gcc -o $(elf) $(obj-cg) $(CFLAGSCG) $(LDFLAGSCG)
|
||||||
fxg1a $(bin) -o $@ $(g1af)
|
$(TOOLCHAIN_CG)-objcopy -O binary $(COPY) $(elf) $(bin)
|
||||||
|
mkg3a $(G3AF) $(bin) $@
|
||||||
$(target-cg): $(obj-cg) $(deps-cg)
|
|
||||||
|
|
||||||
sh4eb-elf-gcc -o $(elf) $(obj-cg) $(cf-cg) $(lf-cg)
|
|
||||||
sh4eb-elf-objcopy -O binary $(cpflags) $(elf) $(bin)
|
|
||||||
mkg3a $(g3af) $(bin) $@
|
|
||||||
|
|
||||||
# C sources
|
# C sources
|
||||||
build-fx/%.o: %.c
|
build-fx/%.c.o: %.c
|
||||||
@ mkdir -p $(dir $@)
|
@ mkdir -p $(dir $@)
|
||||||
sh3eb-elf-gcc -c $< -o $@ $(cf-fx) $(dflags)
|
$(TOOLCHAIN_FX)-gcc -c $< -o $@ $(CFLAGSFX) $(depflags)
|
||||||
build-cg/%.o: %.c
|
build-cg/%.c.o: %.c
|
||||||
@ mkdir -p $(dir $@)
|
@ mkdir -p $(dir $@)
|
||||||
sh4eb-elf-gcc -c $< -o $@ $(cf-cg) $(dflags)
|
$(TOOLCHAIN_CG)-gcc -c $< -o $@ $(CFLAGSCG) $(depflags)
|
||||||
|
|
||||||
# Assembler sources
|
# Assembler sources
|
||||||
build-fx/%.o: %.s
|
build-fx/%.s.o: %.s
|
||||||
@ mkdir -p $(dir $@)
|
@ mkdir -p $(dir $@)
|
||||||
sh3eb-elf-gcc -c $< -o $@
|
$(TOOLCHAIN_FX)-gcc -c $< -o $@
|
||||||
build-fx/%.o: %.S
|
build-cg/%.s.o: %.s
|
||||||
@ mkdir -p $(dir $@)
|
@ mkdir -p $(dir $@)
|
||||||
sh3eb-elf-gcc -c $< -o $@ $(sflags)
|
$(TOOLCHAIN_CG)-gcc -c $< -o $@
|
||||||
build-cg/%.o: %.s
|
|
||||||
|
# Preprocessed assembler sources
|
||||||
|
build-fx/%.S.o: %.S
|
||||||
@ mkdir -p $(dir $@)
|
@ mkdir -p $(dir $@)
|
||||||
sh4eb-elf-gcc -c $< -o $@
|
$(TOOLCHAIN_FX)-gcc -c $< -o $@ $(INCLUDE)
|
||||||
build-cg/%.o: %.S
|
build-cg/%.S.o: %.S
|
||||||
@ mkdir -p $(dir $@)
|
@ mkdir -p $(dir $@)
|
||||||
sh4eb-elf-gcc -c $< -o $@ $(sflags)
|
$(TOOLCHAIN_CG)-gcc -c $< -o $@ $(INCLUDE)
|
||||||
|
|
||||||
# Images
|
# Images
|
||||||
build-fx/assets/img/%.o: assets-fx/img/%
|
build-fx/assets/img/%.o: assets-fx/img/%
|
||||||
@ mkdir -p $(dir $@)
|
@ mkdir -p $(dir $@)
|
||||||
fxconv -i $< -o $@ --fx name:img_$(basename $*)
|
fxconv -i $< -o $@ $(FXCONVFX) name:img_$(basename $*) $(IMG.$*)
|
||||||
|
|
||||||
build-cg/assets/img/%.o: assets-cg/img/%
|
build-cg/assets/img/%.o: assets-cg/img/%
|
||||||
@ mkdir -p $(dir $@)
|
@ mkdir -p $(dir $@)
|
||||||
fxconv -i $< -o $@ --cg name:img_$(basename $*)
|
fxconv -i $< -o $@ $(FXCONVCG) name:img_$(basename $*) $(IMG.$*)
|
||||||
|
|
||||||
# Fonts
|
# Fonts
|
||||||
build-fx/assets/fonts/%.o: assets-fx/fonts/%
|
build-fx/assets/fonts/%.o: assets-fx/fonts/%
|
||||||
@ mkdir -p $(dir $@)
|
@ mkdir -p $(dir $@)
|
||||||
fxconv -f $< -o $@ name:font_$(basename $*) $(FONT.$*)
|
fxconv -f $< -o $@ $(FXCONVFX) name:font_$(basename $*) $(FONT.$*)
|
||||||
|
|
||||||
build-cg/assets/fonts/%.o: assets-cg/fonts/%
|
build-cg/assets/fonts/%.o: assets-cg/fonts/%
|
||||||
@ mkdir -p $(dir $@)
|
@ mkdir -p $(dir $@)
|
||||||
fxconv -f $< -o $@ name:font_$(basename $*) $(FONT.$*)
|
fxconv -f $< -o $@ $(FXCONVCG) name:font_$(basename $*) $(FONT.$*)
|
||||||
|
|
||||||
|
# Binaries
|
||||||
|
build-fx/assets/bin/%.o: assets-fx/bin/%
|
||||||
|
@ mkdir -p $(dir $@)
|
||||||
|
fxconv -b $< -o $@ $(FXCONVFX) name:bin_$(basename $*) $(BIN.$*)
|
||||||
|
build-cg/assets/bin/%.o: assets-cg/bin/%
|
||||||
|
@ mkdir -p $(dir $@)
|
||||||
|
fxconv -b $< -o $@ $(FXCONVCG) name:bin_$(basename $*) $(BIN.$*)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Cleaning and utilities
|
# Cleaning and utilities
|
||||||
|
@ -131,14 +158,23 @@ build-fx/%.d: ;
|
||||||
build-cg/%.d: ;
|
build-cg/%.d: ;
|
||||||
.PRECIOUS: build-fx build-cg build-fx/%.d build-cg/%.d %/
|
.PRECIOUS: build-fx build-cg build-fx/%.d build-cg/%.d %/
|
||||||
|
|
||||||
clean:
|
clean-fx:
|
||||||
@ rm -rf build*
|
@ rm -rf build-fx/
|
||||||
distclean: clean
|
clean-cg:
|
||||||
@ rm -f $(target-fx) $(target-cg)
|
@ rm -rf build-cg/
|
||||||
|
|
||||||
install-fx: $(target-fx)
|
distclean-fx: clean-fx
|
||||||
|
@ rm -f $(TARGETFX)
|
||||||
|
distclean-cg: clean-cg
|
||||||
|
@ rm -f $(TARGETCG)
|
||||||
|
|
||||||
|
clean: clean-fx clean-cg
|
||||||
|
|
||||||
|
distclean: distclean-fx distclean-cg
|
||||||
|
|
||||||
|
install-fx: $(TARGETFX)
|
||||||
p7 send -f $<
|
p7 send -f $<
|
||||||
install-cg: $(target-cg)
|
install-cg: $(TARGETCG)
|
||||||
@ while [[ ! -h /dev/Prizm1 ]]; do sleep 0.25; done
|
@ while [[ ! -h /dev/Prizm1 ]]; do sleep 0.25; done
|
||||||
@ while ! mount /dev/Prizm1; do sleep 0.25; done
|
@ while ! mount /dev/Prizm1; do sleep 0.25; done
|
||||||
@ rm -f /mnt/prizm/$<
|
@ rm -f /mnt/prizm/$<
|
||||||
|
|
|
@ -38,7 +38,7 @@ Installation:
|
||||||
|
|
||||||
Sends the target file to the calculator. Uses p7 (which must be installed
|
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
|
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).
|
requires detecting and mounting the calculator (same for the Graph 35+E II).
|
||||||
|
|
||||||
Project update:
|
Project update:
|
||||||
fxsdk update
|
fxsdk update
|
||||||
|
@ -103,7 +103,8 @@ fxsdk_new_project_interactive() {
|
||||||
echo -ne "Full project name ? (at most 8 characters)\n> "
|
echo -ne "Full project name ? (at most 8 characters)\n> "
|
||||||
read NAME
|
read NAME
|
||||||
|
|
||||||
echo -ne "Internal name ? ('@' followed by at most 7 uppercase letters)\n> "
|
echo "Internal name ? ('@' followed by at most 7 uppercase letters)"
|
||||||
|
echo -ne "(Add-in might not appear on calc if format is wrong)\n> "
|
||||||
read INTERNAL
|
read INTERNAL
|
||||||
|
|
||||||
mkdir -p "$1"/{,src,assets-fx,assets-cg}
|
mkdir -p "$1"/{,src,assets-fx,assets-cg}
|
||||||
|
@ -133,9 +134,17 @@ fxsdk_create_config() {
|
||||||
#---
|
#---
|
||||||
|
|
||||||
# Project name, should be at most 8 bytes long.
|
# Project name, should be at most 8 bytes long.
|
||||||
NAME = $NAME
|
# (You can also specify NAME_G1A or NAME_G3A to override individually.)
|
||||||
|
NAME := $NAME
|
||||||
|
|
||||||
# Internal name, should be '@' followed by at most 7 uppercase letters.
|
# Internal name, should be '@' followed by at most 7 uppercase letters.
|
||||||
INTERNAL = $INTERNAL
|
# WARNING: If this convention is not followed, the add-in might not appear in
|
||||||
|
# the main menu of the calculator!
|
||||||
|
INTERNAL := $INTERNAL
|
||||||
|
|
||||||
|
# Output file name, your add-in will be named <TARGET>.g1a (or g3a).
|
||||||
|
# The default is to take <NAME> and replace spaces with dashes.
|
||||||
|
TARGET :=
|
||||||
|
|
||||||
# fx-9860G icon location
|
# fx-9860G icon location
|
||||||
ICON_FX = assets-fx/icon-fx.png
|
ICON_FX = assets-fx/icon-fx.png
|
||||||
|
@ -143,11 +152,66 @@ ICON_FX = assets-fx/icon-fx.png
|
||||||
ICON_CG_UNS = assets-cg/icon-cg-uns.png
|
ICON_CG_UNS = assets-cg/icon-cg-uns.png
|
||||||
ICON_CG_SEL = assets-cg/icon-cg-sel.png
|
ICON_CG_SEL = assets-cg/icon-cg-sel.png
|
||||||
|
|
||||||
# Additional compiler flags
|
#---
|
||||||
CFLAGS = -std=c11 -Os
|
# Toolchain selection
|
||||||
# Additional linker flags. This is followed by -lgcc. When using fxlib, add
|
#---
|
||||||
# libfx.a to the projet directory and set LDFLAGS to "-L . -lfx".
|
|
||||||
LDFLAGS =
|
# Toolchain for fx9860g. Please see also CFLAGS_FX below.
|
||||||
|
TOOLCHAIN_FX := sh3eb-elf
|
||||||
|
|
||||||
|
# Toolchain for fxcg50. Please see also CFLAGS_CG below.
|
||||||
|
TOOLCHAIN_CG := sh4eb-elf
|
||||||
|
|
||||||
|
#---
|
||||||
|
# Compiler flags
|
||||||
|
#---
|
||||||
|
|
||||||
|
# Base compiler flags for the fxSDK, you usually want to keep these.
|
||||||
|
CFLAGS := -mb -ffreestanding -nostdlib -fstrict-volatile-bitfields
|
||||||
|
|
||||||
|
# Platform-specific compiler flags.
|
||||||
|
# <> If you are using sh3eb-elf, use -m3. (You can do this on both FX and CG.)
|
||||||
|
# <> If you are using sh4eb-elf, use -m4-nofpu. (Not ideal on FX but works.)
|
||||||
|
# <> If you are using sh4eb-nofpu-elf, then your compiler will likely use the
|
||||||
|
# FPU and cause problems on the calculator. Consider another configuration.
|
||||||
|
# <> If you are using an sh-elf with several targets, specify whichever you
|
||||||
|
# support. I recommend -m3 on FX and -m4-nofpu on CG.
|
||||||
|
# Please see also TOOLCHAIN_FX and TOOLCHAIN_CG above.
|
||||||
|
CFLAGS_FX := -D FX9860G -m3
|
||||||
|
CFLAGS_CG := -D FXCG50 -m4-nofpu
|
||||||
|
|
||||||
|
# Additional compiler flags, change to your own taste!
|
||||||
|
CFLAGS += -Wall -Wextra -Os
|
||||||
|
|
||||||
|
# Include paths. Add one -I option for each folder from which you want to
|
||||||
|
# be able to include files with #include<>.
|
||||||
|
INCLUDE := -I include
|
||||||
|
|
||||||
|
# Libraries. Add one -l option for each library you are using, and also
|
||||||
|
# suitable -L options if you have library files in custom folders. To use
|
||||||
|
# fxlib, add libfx.a to the project directory and use "-L . -lfx".
|
||||||
|
LIBS :=
|
||||||
|
|
||||||
|
# Base linker flags for the fxSDK, you usually want to keep these.
|
||||||
|
LDFLAGS_FX := -T fx9860g.ld -lgint-fx \$(LIBS) -lgint-fx -lgcc
|
||||||
|
LDFLAGS_CG := -T fxcg50.ld -lgint-cg \$(LIBS) -lgint-cg -lgcc
|
||||||
|
|
||||||
|
# Additional linker flags, if you need any.
|
||||||
|
LDFLAGS :=
|
||||||
|
|
||||||
|
# Additional platform-specific linker flags.
|
||||||
|
LDFLAGS_FX += -Wl,-Map=build-fx/map
|
||||||
|
LDFLAGS_CG += -Wl,-Map=build-cg/map
|
||||||
|
|
||||||
|
#---
|
||||||
|
# File conversion parameters
|
||||||
|
#---
|
||||||
|
|
||||||
|
# Here you can add fxconv options for each converted file, individually.
|
||||||
|
# The syntax is "<type>.<file>". For example, to specify the parameters for a
|
||||||
|
# font name "hexa.png", you might write:
|
||||||
|
#
|
||||||
|
# FONT.hexa.png = charset:print grid:size:3x5 grid.padding:1
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue