100 lines
2.7 KiB
Makefile
100 lines
2.7 KiB
Makefile
CROSS_COMPILE := sh-elf-
|
|
|
|
include $(TOP)/py/py.mk
|
|
include $(TOP)/extmod/extmod.mk
|
|
|
|
CFLAGS += -m4-nofpu -mb -fstrict-volatile-bitfields \
|
|
-I. -I$(TOP)/ports/sh -I$(BUILD) -I$(TOP) \
|
|
$(SH_CFLAGS) -Os -Wall -Wextra -Wno-unused-parameter
|
|
LIBS += -nostdlib -Wl,--no-warn-rwx-segments $(SH_LDFLAGS) -Wl,-Map=build/map
|
|
|
|
# Source files
|
|
SRC_C = \
|
|
ports/sh/main.c \
|
|
ports/sh/console.c \
|
|
ports/sh/debug.c \
|
|
ports/sh/keymap.c \
|
|
ports/sh/modcasioplot.c \
|
|
ports/sh/modgint.c \
|
|
ports/sh/mphalport.c \
|
|
ports/sh/objgintimage.c \
|
|
ports/sh/pyexec.c \
|
|
ports/sh/resources.c \
|
|
ports/sh/stredit.c \
|
|
ports/sh/widget_shell.c \
|
|
shared/runtime/gchelper_generic.c \
|
|
shared/runtime/stdout_helpers.c \
|
|
shared/runtime/interrupt_char.c \
|
|
|
|
SRC_QSTR += \
|
|
ports/sh/main.c \
|
|
ports/sh/modcasioplot.c \
|
|
ports/sh/modgint.c \
|
|
ports/sh/objgintimage.c \
|
|
ports/sh/pyexec.c \
|
|
|
|
|
|
ifeq ($(TARGETCASIO),"FXCG50")
|
|
$(info ************ FXCG50 VERSION ************ )
|
|
$(info ********* Add Numworks modules ********* )
|
|
SRC_C += \
|
|
ports/sh/numworks/modkandinsky.c \
|
|
ports/sh/numworks/modion.c \
|
|
ports/sh/numworks/syscalls/screenlight.c
|
|
|
|
SRC_ASM += \
|
|
ports/sh/numworks/syscalls/GetBatteryType.S \
|
|
ports/sh/numworks/syscalls/GetMainBatteryVoltage.S \
|
|
ports/sh/numworks/syscalls/BdispDDRegisterSelect.S
|
|
|
|
SRC_QSTR += \
|
|
ports/sh/numworks/modkandinsky.c \
|
|
ports/sh/numworks/modion.c \
|
|
|
|
endif
|
|
|
|
ifeq ($(TARGETCASIO),"FX9860G")
|
|
$(info *********** FX9860G VERSION *********** )
|
|
|
|
endif
|
|
|
|
ifeq ($(shell [[ x"$$(git describe)" == x"$$(git describe main)" ]] \
|
|
&& [[ -z "$$(git status -uno --porcelain)" ]] \
|
|
&& echo y),y)
|
|
$(info * RELEASE BUILD)
|
|
BUILDTYPE := RELEASE
|
|
else
|
|
$(info * DEVELOPMENT BUILD)
|
|
BUILDTYPE := DEV
|
|
endif
|
|
|
|
ASSETS_O := $(SH_ASSETS:%=$(BUILD)/sh_assets/%.o)
|
|
|
|
OBJ = $(PY_O) $(ASSETS_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) $(addprefix $(BUILD)/, $(SRC_ASM:.S=.o))
|
|
|
|
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf
|
|
$(Q)$(CC:gcc=objcopy) -O binary -R .bss -R .gint_bss $< $@
|
|
|
|
$(BUILD)/firmware.elf: $(OBJ)
|
|
$(ECHO) "LINK $@"
|
|
$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
|
|
$(Q)$(SIZE) $@
|
|
|
|
$(BUILD)/sh_assets/%.o: % $(SH_METADATA)
|
|
$(Q)mkdir -p $(dir $@)
|
|
$(Q)fxconv --toolchain=$(CROSS_COMPILE:%-=%) $(SH_CONVFLAGS) $< -o $@
|
|
|
|
ARCHIVE := PythonExtra-$(shell git describe).zip
|
|
|
|
# Weird rules calling back to fxcg50 and fx9860g3, both of whic include this
|
|
release:
|
|
$(MAKE) -C ../fx9860g3
|
|
$(MAKE) -C ../fxcg50
|
|
cd ../sh && zip "$(ARCHIVE)" -j ../fx9860g3/PythonEx.g1a ../fxcg50/PythonExtra.g3a
|
|
cd ../sh && zip "$(ARCHIVE)" -r examples modules
|
|
|
|
.PHONY: release
|
|
.PRECIOUS: $(ARCHIVE)
|
|
|
|
include $(TOP)/py/mkrules.mk
|