add support for mips cross-compile to *.370 hints

Also close #1041
This commit is contained in:
nhmall
2023-07-03 11:44:50 -04:00
parent 81dedbe298
commit e75535497b
2 changed files with 140 additions and 5 deletions

View File

@@ -26,6 +26,18 @@ override TARGETPFX = $(TARGETDIR)/
override TARGET_LIBS=
endif
ifdef CROSS_TO_MIPS
CROSS=1
BUILD_TARGET_LUA=1
BUILD_TARGET_NCURSES=1
HACKDIR=/
PREFIX=
override TARGET = mips
override TARGETDIR=../targets/$(TARGET)
override TARGETPFX = $(TARGETDIR)/
override TARGET_LIBS=
endif
ifdef CROSS
override PREGAME=
override BUILDMORE=
@@ -126,10 +138,22 @@ PDCINCL=
endif # WANT_WIN_CURSES
endif # BUILD_PDCURSES
ifdef BUILD_TARGET_NCURSES
#=================================================================
# ncurses
# Source from https://invisible-island.net/datafiles/release/ncurses.tar.gz
#
#=================================================================
NCURSESLIBDIR ?= $(TARGETPFX)ncurses/lib
NCURSESLIB ?= $(NCURSESLIBDIR)/libncurses.a
#override TARGET_LIBS += $(NCURSESLIB)
override BUILDMORE += $(NCURSESLIB)
endif # BUILD_TARGET_NCURSES
ifdef CROSS_TO_MSDOS
#===============-=================================================
#=================================================================
# MSDOS cross-compile recipe
#===============-=================================================
#=================================================================
# Uses an MSDOS djgpp cross-compiler on linux or macos.
#
# 1. You can obtain the cross-compiler for your system via:
@@ -344,6 +368,74 @@ $(TARGETPFX)%.o : ../sys/libnh/%.c
$(TARGETPFX)%.o : ../win/shim/%.c
$(TARGET_CC) $(TARGET_CFLAGS) -c -o$@ $<
endif # CROSS_TO_WASM
ifdef CROSS_TO_MIPS
#================================================================
# MIPS cross-compile recipe
#================================================================
# Uses an MIPS linux cross-compiler on linux or macos.
#
# 1. You can obtain the cross-compiler for ubuntu via:
# sudo apt -y install gcc-mipsel-linux-gnu g++-mipsel-linux-gnu
# For macOS, perhaps check for a mips cross-compiler on
# home-brew or macports.
#
# 2. Then
# make CROSS_TO_MIPS=1 WANT_WIN_TTY=1 WANT_WIN_CURSES=1 all
#
#=================================================================
CFLAGS += -DCROSSCOMPILE
#
# Override the build tools and some obj files to
# reflect the mips cross-compiler.
#
override TARGET_CC = mipsel-linux-gnu-gcc
override TARGET_CXX = CXX=mipsel-linux-gnu-g++
override TARGET_AR = mipsel-linux-gnu-ar
#override TARGET_LINK = mipsel-linux-gnu-ld
MIPS_TARGET_CFLAGS = -c -O -I../include -I../sys/unix -I../win/share \
$(LUAINCL) -DDLB \
-DCROSSCOMPILE -DCROSSCOMPILE_TARGET \
-DCROSS_TO_MIPS \
-Wall -Wextra -Wno-missing-field-initializers -Wreturn-type -Wunused \
-Wformat -Wswitch -Wshadow -Wwrite-strings \
-Wimplicit -Wimplicit-function-declaration -Wimplicit-int \
-Wmissing-parameter-type -Wold-style-definition -Wstrict-prototypes
MIPS_TARGET_CXXFLAGS = -c -O -I../include -I../sys/unix -I../win/share \
$(LUAINCL) -DDLB \
-DUSE_TILES -DCROSSCOMPILE -DCROSSCOMPILE_TARGET -DCROSS_TO_MIPS \
-Wall -Wextra -Wno-missing-field-initializers -Wreturn-type -Wunused \
-Wformat -Wswitch -Wshadow -Wwrite-strings -Wno-maybe-uninitialized
override TARGET_CFLAGS = $(MIPS_TARGET_CFLAGS) -Wmissing-declarations \
-Wmissing-prototypes -pedantic -Wmissing-declarations \
-Wformat-nonliteral
override TARGET_CXXFLAGS = $(MIPS_TARGET_CXXFLAGS)
ifdef CPLUSPLUS_NEEDED
override TARGET_LINK = mipsel-linux-gnu-gcc
else
override TARGET_LINK = mipsel-linux-gnu-g++
endif
override TARGET_LFLAGS=
override SYSOBJ = $(TARGETPFX)ioctl.o $(TARGETPFX)unixmain.o $(TARGETPFX)unixtty.o \
$(TARGETPFX)unixunix.o $(TARGETPFX)unixres.o
override WINLIB = $(NCURSESLIB)
override LUALIB=
override LUALIBS=
override TOPLUALIB=
#override GAMEBIN=
#override PACKAGE=
override PREGAME += mkdir -p $(TARGETDIR) ;
override CLEANMORE += rm -f -r $(TARGETDIR) ;
# Rule for file in sys/unix
#$(TARGETPFX)%.o : ../sys/unix/%.c
# $(TARGET_CC) $(TARGET_CFLAGS) -c -o$@ $<
# Rule for file in sys/share
#$(TARGETPFX)%.o : ../sys/share/%.c
# $(TARGET_CC) $(TARGET_CFLAGS) -c -o$@ $<
endif # CROSS_TO_MIPS
#=================================================================
ifdef WANT_WIN_CURSES