sdk: updated `sjasmplus`, added `z88dk`, updated `README.md`

This commit is contained in:
Ivan Tatarinov 2021-04-20 09:58:30 +03:00
parent a5fe70bf26
commit b0915e9ca7
12 changed files with 461 additions and 190 deletions

View File

@ -15,7 +15,7 @@
# <BUILD> is one of: mingw32, mingw64. # <BUILD> is one of: mingw32, mingw64.
# <FB_FLAG> is 1 to force build, otherwise do not (default). # <FB_FLAG> is 1 to force build, otherwise do not (default).
# <FC_FLAG> is 1 to force clean, otherwise do not (default). # <FC_FLAG> is 1 to force clean, otherwise do not (default).
# <TARGET> is one of values of TOOLS variable (see below). # <TARGET> is one of: sjasmplus, z88dk, zx7b, tools
# #
# Notes: # Notes:
# BUILD, FORCEBUILD, FORCECLEAN variables may be set in user's environment. # BUILD, FORCEBUILD, FORCECLEAN variables may be set in user's environment.
@ -43,31 +43,17 @@ export BUILD
export FORCEBUILD export FORCEBUILD
export FORCECLEAN export FORCECLEAN
SJASMPLUS := sjasmplus$(EXECEXT)
ZX7B := zx7b$(EXECEXT)
BIN2HEX := bin2hex$(EXECEXT)
FCUT := fcut$(EXECEXT)
FPAD := fpad$(EXECEXT)
FPOKE := fpoke$(EXECEXT)
GENROM := GenRom$(EXECEXT)
ADDITEM := AddItem$(EXECEXT)
TOOLS:=\
bin/$(SJASMPLUS) \
bin/$(ZX7B) \
bin/$(BIN2HEX) \
bin/$(FCUT) \
bin/$(FPAD) \
bin/$(FPOKE) \
bin/$(GENROM) \
bin/$(ADDITEM)
.PHONY: all .PHONY: all
all: $(TOOLS) all: sjasmplus z88dk zx7b tools
$(TOOLS): | src/Makefile .PHONY: sjasmplus z88dk
$(MAKE) -w -C src ../bin/$(@F) sjasmplus z88dk: | src
$(MAKE) -w -C $| external-$@
.PHONY: clean .PHONY: zx7b tools
clean: | src/Makefile zx7b tools: | src
$(MAKE) -w -C src clean $(MAKE) -w -C $| local-$@
.PHONY: clean dist-clean
clean dist-clean: | src
$(MAKE) -w -C $| $@

View File

@ -8,11 +8,14 @@ No one yet.
# License # License
This document is under [GNU FDL-1.3 or later](http://www.gnu.org/licenses/fdl-1.3.html) license. This document is under [GNU FDL-1.3 or later](https://spdx.org/licenses/GFDL-1.3-or-later.html) license.
SJAsmPlus Z80 Assembler is distributed under [zlib](https://spdx.org/licenses/Zlib.html) license.
z88dk is distributed under [Clarified Artistic](https://spdx.org/licenses/ClArtistic.html) license.
# 1. General information # 1. General information
The source code of all tools is in `src` directory. All compiled binaries are placed in `bin` directory. The source code of local tools is in `src` directory. Compiled binaries of them are placed in `bin` directory.
Downloaded tools are placed in sub-directories of `src`. See Makefiles for details.
## 1.1. Copyright and licensing information for files ## 1.1. Copyright and licensing information for files
@ -28,15 +31,22 @@ Check it out by using this [reuse-tool](https://github.com/fsfe/reuse-tool).
Open terminal and type: Open terminal and type:
```bash ```
# apt install -y build-essential git cmake libboost-all-dev # apt install -y build-essential git
``` ```
**NOTE**: here the first symbol "#" means that the following command must be run as *root* or using `sudo` utility. **NOTE**: here the first symbol "#" means that the following command must be run as *root* or using `sudo` utility.
Additional packages for targets:
Target | Packages
----|----
`sjasmplus` | cmake libboost-all-dev libxml2-dev
`z88dk` | dos2unix libboost-all-dev texinfo texi2html libxml2-dev subversion bison flex zlib1g-dev m4
To use cross-compilation for Windows platform install *mingw-w64* package: To use cross-compilation for Windows platform install *mingw-w64* package:
```bash ```
# apt install -y mingw-w64 # apt install -y mingw-w64
``` ```
@ -52,48 +62,55 @@ Now `zxuno` sub-directory is the ZX-Uno project's root directory and all actions
## 2.2. Build tools ## 2.2. Build tools
Go to the project's root directory and type one of the following commands: Go to the project's root directory, enter `sdk` sub-directory and type one of the following commands:
Command | Target Command | Description
----|---- ----|----
`make` | all tools `make` | Build all tools from sources
`make bin/sjasmplus` | **sjasmplus** `make <TARGET>` | Build only the TARGET from sources
`make bin/zx7b` | **zx7b** `make BUILD=<BUILD>` | Cross-build all tools from sources for Windows platfowm
`make bin/bin2hex` | **bin2hex** `make BUILD=<BUILD> <TARGET>` | Cross-build only the TARGET from sources for Windows platfowm
`make bin/fcut` | **fcut**
`make bin/fpad` | **fpad**
`make bin/fpoke` | **fpoke**
`make bin/GenRom` | **GenRom**
`make bin/AddItem` | **AddItem**
To build using MinGW add this parameter for `make` tool: where:
Parameter | Target system Value of `TARGET` | Origin | Description
----|----|----
`sjasmplus` | downloaded | SJAsmPlus Z80 Assembler
`z88dk` | downloaded | z88dk
`zx7b` | `src/zx7b` | zx7b
`tools` | `src/tools` | tools
Value of `BUILD` | Target system
----|---- ----|----
`BUILD=mingw32` | Windows with i686 architecture (32-bits) `mingw32` | Windows with i686 architecture (32-bits)
`BUILD=mingw64` | Windows with AMD64 architecture (64-bits) `mingw64` | Windows with AMD64 architecture (64-bits)
Remember to specify proper file extension (`.exe`) for target when building with MinGW. Example: Example:
```bash ```bash
make BUILD=mingw64 bin/fcut.exe bin/fpad.exe bin/fpoke.exe make BUILD=mingw64 tools
``` ```
Then you may use `strip` tool to strip debug information from file and thus shrink file's size: Then you may use `strip` tool to strip debug information from file and thus shrink file's size. Example:
```bash ```bash
strip bin/fcut.exe bin/fpad.exe bin/fpoke.exe strip bin/*.exe
``` ```
## 2.3. Clean tools ## 2.3. Clean tools
To clean everything type: Go to the project's root directory, enter `sdk` sub-directory and type one of the following commands:
```bash Command | Description
make clean ----|----
``` `make clean` | clean after compilation from sources
`make dist-clean` | acts like `clean` but also removes temporary and downloaded files
`make BUILD=<BUILD> clean` | clean after compilation from sources for Windows platform
`make BUILD=<BUILD> dist-clean` | acts like `clean` for Windows platform but also removes temporary and downloaded files
To clean MinGW builds use appropriate `BUILD` parameter as described in [2.2](#22-build-tools). Example: Value of `BUILD` is described in [2.2](#22-build-tools).
Example:
```bash ```bash
make BUILD=mingw64 clean make BUILD=mingw64 clean
@ -138,38 +155,81 @@ This has the same behavior as the inclusion of `common.mk` file in a Makefile.
# 3. Using SDK in GNU environment on Windows # 3. Using SDK in GNU environment on Windows
**NOTE**: *by default* compilation of the following tools: ## 3.1. Prepare a build environment
* sjasmplus ### 3.1.1. Setup Cygwin
* zx7b
* bin2hex
* fcut
* fpad
* fpoke
* GenRom
* AddItem
on Windows platform is disabled right now because of presence of precompiled binaries of them in repository. Download and run [Cygwin](https://cygwin.com/) GUI installer for Windows, either [32 bit](https://cygwin.com/setup-x86.exe) or [64 bit](https://cygwin.com/setup-x86_64.exe) version. See [Chapter 2. Setting Up Cygwin](https://cygwin.com/cygwin-ug-net/setup-net.html) for more information.
*By default* they are not deleted when cleaning.
## 3.1. Build tools Install the following packages in Cygwin:
The building process is similar to one for GNU on Linux, FreeBSD etc. Target | Dependencies
See [2.2](#22-build-tools) with addition that you should provide correct target name (specify file extension `.exe`) and also specify parameter `FORCEBUILD=1`. ----|----
all targets | bash git make wget unzip p7zip
`sjasmplus` | gcc-g++ cmake libboost-devel
`z88dk` | mingw64-i686-gcc-core mingw64-i686-libxml2 patch
`zx7b` | gcc-core
`tools` | gcc-core
## 3.2. Clean tools **HINT**: you can install *Midnight Commander* (`mc` package). It will help you to navigate through filesystem.
The cleaning process is similar to one for GNU on Linux, FreeBSD etc. To open Cygwin terminal just click on it's icon on desktop. This will open a Bash shell in a GNU environment.
See [2.3](#23-clean-tools) with addition that you should specify parameter `FORCECLEAN=1`.
## 3.3. Tools usage ### 3.1.2. Clone repository
### 3.3.1. In Makefiles The cloning is described in [2.1.2](#212-clone-repository).
## 3.2. Build tools
Go to the project's root directory, enter `sdk` sub-directory and type one of the following commands:
Command | Description
----|----
`make` | Quick setup of all tools
`make <TARGET>` | Qucik setup of the TARGET only
`make FORCEBUILD=1` | Build all tools from sources
`make FORCEBUILD=1 <TARGET>` | Build only the TARGET from sources
where:
Value of `TARGET` | Origin | Quick setup | Build from sources
----|----|----|----
`sjasmplus` | downloaded | available | available
`z88dk` | downloaded | available | available
`zx7b` | `src/zx7b` | N/A | available
`tools` | `src/tools` | N/A | available
Then you may use `strip` tool to strip debug information from file and thus shrink file's size. Example:
```bash
strip bin/*.exe
```
## 3.3. Clean tools
Go to the project's root directory, enter `sdk` sub-directory and type one of the following commands:
Command | Description
----|----
`make clean` | removes downloaded precompiled binaries only
`make dist-clean` | acts as `clean` but also removes temporary and downloaded files
`make FORCECLEAN=1 clean` | clean after compilation from sources
`make FORCECLEAN=1 dist-clean` | acts as forced `clean` but also removes temporary and downloaded files
Example:
```bash
make FORCECLEAN=1 clean
```
## 3.4. Tools usage
### 3.4.1. In Makefiles
The usage is similar to one for GNU on Linux, FreeBSD etc. The usage is similar to one for GNU on Linux, FreeBSD etc.
See [2.4.1](#241-in-makefiles). See [2.4.1](#241-in-makefiles).
### 3.3.2. In Bash scripts ### 3.4.2. In Bash scripts
The usage is similar to one for GNU on Linux, FreeBSD etc. The usage is similar to one for GNU on Linux, FreeBSD etc.
See [2.4.2](#242-in-bash-scripts). See [2.4.2](#242-in-bash-scripts).

View File

@ -11,23 +11,33 @@
ifndef ZXUNOSDK ifndef ZXUNOSDK
ZXUNOSDK := $(patsubst %/,%,$(abspath $(dir $(lastword $(MAKEFILE_LIST))))) ZXUNOSDK := $(patsubst %/,%,$(abspath $(dir $(lastword $(MAKEFILE_LIST)))))
PATH := $(ZXUNOSDK)/bin:$(PATH) Z88DK := $(ZXUNOSDK)/src/z88dk
ZCCCFG := $(Z88DK)/lib/config
PATH := $(ZXUNOSDK)/bin:$(Z88DK)/bin:$(PATH)
# Fix paths under Cygwin for z88dk on Windows
ifeq ($(OS),Windows_NT)
ifeq ($(shell echo $$OSTYPE),cygwin)
ZCCCFG := $(shell cygpath -m $(ZCCCFG))
endif
endif
export ZXUNOSDK export ZXUNOSDK
export ZCCCFG
export PATH export PATH
endif endif
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
EXECEXT := .exe EXESUFFIX := .exe
else else
EXECEXT := EXESUFFIX :=
endif endif
ifeq ($(BUILD),mingw32) ifeq ($(BUILD),mingw32)
CC := i686-w64-mingw32-gcc CC := i686-w64-mingw32-gcc
EXECEXT := .exe EXESUFFIX := .exe
else ifeq ($(BUILD),mingw64) else ifeq ($(BUILD),mingw64)
CC := x86_64-w64-mingw32-gcc CC := x86_64-w64-mingw32-gcc
EXECEXT := .exe EXESUFFIX := .exe
endif endif

View File

@ -6,4 +6,6 @@ rem SPDX-License-Identifier: GPL-3.0-or-later
if not x%ZXUNOSDK% == x exit /b if not x%ZXUNOSDK% == x exit /b
set ZXUNOSDK=%~dp0 set ZXUNOSDK=%~dp0
set ZXUNOSDK=%ZXUNOSDK:~0,-1% set ZXUNOSDK=%ZXUNOSDK:~0,-1%
set PATH=%ZXUNOSDK%\bin;%PATH% set Z88DK=%ZXUNOSDK%\src\z88dk
set ZCCCFG=%Z88DK%\lib\config
set PATH=%ZXUNOSDK%\bin;%Z88DK%\bin;%PATH%

View File

@ -5,6 +5,13 @@
if [[ "x$ZXUNOSDK" == x ]]; then if [[ "x$ZXUNOSDK" == x ]]; then
ZXUNOSDK=$(dirname $(realpath "$BASH_SOURCE")) ZXUNOSDK=$(dirname $(realpath "$BASH_SOURCE"))
PATH=$ZXUNOSDK/bin:$PATH Z88DK=$ZXUNOSDK/src/z88dk
ZCCCFG=$Z88DK/lib/config
PATH=$ZXUNOSDK/bin:$Z88DK/bin:$PATH
# Fix paths under Cygwin for z88dk on Windows
if [[ x$OS == xWindows_NT -a x$OSTYPE == xcygwin ]]; then
ZCCCFG=`cygpath -m $ZCCCFG`
fi
export ZXUNOSDK export ZXUNOSDK
export ZCCCFG
fi fi

11
sdk/src/.gitignore vendored
View File

@ -3,3 +3,14 @@
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
sjasmplus sjasmplus
sjasmplus-src.tgz
sjasmplus-src.tgz.sha256
sjasmplus-win32.7z
sjasmplus-win32.7z.sha256
sjasmplus-win64.7z
sjasmplus-win64.7z.sha256
z88dk
z88dk-src.tgz
z88dk-src.tgz.sha256
z88dk-win32.zip
z88dk-win32.zip.sha256

View File

@ -9,117 +9,288 @@
# Build: # Build:
# make [BUILD=<BUILD>] [FORCEBUILD=<FB_FLAG>] [<TARGET>] # make [BUILD=<BUILD>] [FORCEBUILD=<FB_FLAG>] [<TARGET>]
# Clean: # Clean:
# make [BUILD=<BUILD>] [FORCECLEAN=<FC_FLAG>] clean # make [BUILD=<BUILD>] [FORCECLEAN=<FC_FLAG>] clean|dist-clean
# #
# where: # where:
# <BUILD> is one of: mingw32, mingw64. # <BUILD> is one of: mingw32, mingw64.
# <FB_FLAG> is 1 to force build, otherwise do not (default). # <FB_FLAG> is 1 to force build, otherwise do not (default).
# <FC_FLAG> is 1 to force clean, otherwise do not (default). # <FC_FLAG> is 1 to force clean, otherwise do not (default).
# <TARGET> is one of values of TOOLS variable (see below). # <TARGET> is one of:
# * external-sjasmplus
# * external-z88dk
# * local-zx7b
# * local-tools
# #
# Notes: # Notes:
# BUILD, FORCEBUILD, FORCECLEAN variables may be set in user's environment. # BUILD, FORCEBUILD, FORCECLEAN variables may be set in user's environment.
include ../common.mk include ../common.mk
SJASMPLUS := sjasmplus$(EXECEXT) INSTALLDIR=../bin
ZX7B := zx7b$(EXECEXT)
BIN2HEX := bin2hex$(EXECEXT)
FCUT := fcut$(EXECEXT)
FPAD := fpad$(EXECEXT)
FPOKE := fpoke$(EXECEXT)
GENROM := GenRom$(EXECEXT)
ADDITEM := AddItem$(EXECEXT)
TOOLS:= \
../bin/$(SJASMPLUS) \
../bin/$(ZX7B) \
../bin/$(BIN2HEX) \
../bin/$(FCUT) \
../bin/$(FPAD) \
../bin/$(FPOKE) \
../bin/$(GENROM) \
../bin/$(ADDITEM)
.PHONY: all .PHONY: all
all: $(TOOLS) all:\
external-sjasmplus\
external-z88dk\
local-zx7b\
local-tools
_DoBuild:=1
_UsePrecompiledOnWindows:=0
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
ifeq ($(FORCEBUILD),1) ifneq ($(FORCEBUILD),1)
_DoBuild:=1
else
_DoBuild:=0 _DoBuild:=0
_UsePrecompiledOnWindows:=1
endif endif
else
_DoBuild:=1
endif endif
ifeq ($(OS),Windows_NT)
ifeq ($(FORCECLEAN),1)
_DoClean:=1 _DoClean:=1
else ifeq ($(OS),Windows_NT)
ifneq ($(FORCECLEAN),1)
_DoClean:=0 _DoClean:=0
endif endif
else
_DoClean:=1
endif endif
# sjasmplus
.PHONY: external-sjasmplus clean-sjasmplus
external-sjasmplus: $(INSTALLDIR)/sjasmplus$(EXESUFFIX)
ifeq ($(_DoBuild),1) ifeq ($(_DoBuild),1)
../bin/$(SJASMPLUS): sjasmplus/build/$(SJASMPLUS)
$(INSTALLDIR)/sjasmplus$(EXESUFFIX): sjasmplus/build/sjasmplus$(EXESUFFIX)
cp $< $@ cp $< $@
sjasmplus/build/$(SJASMPLUS): | sjasmplus sjasmplus.mk sjasmplus/build/sjasmplus$(EXESUFFIX): | sjasmplus/.extracted sjasmplus.mk
$(MAKE) -w -C sjasmplus -f ../sjasmplus.mk $(MAKE) -w -C sjasmplus -f ../sjasmplus.mk
sjasmplus: sjasmplus/.extracted: sjasmplus-src.tgz
wget -c https://github.com/sjasmplus/sjasmplus/archive/refs/tags/20190306.1.tar.gz -O sjasmplus.tgz echo 'f3f6d28af19880ed2cb427b6b427e9bd42371929c7d263dac840fb71de1302d6 $<' >$<.sha256
echo 'f3f6d28af19880ed2cb427b6b427e9bd42371929c7d263dac840fb71de1302d6 sjasmplus.tgz' >sjasmplus.sha256sum sha256sum -c $<.sha256
sha256sum -c sjasmplus.sha256sum rm -f $<.sha256
rm -f sjasmplus.sha256sum rm -rf $(@D) sjasmplus-20190306.1
tar -xzf sjasmplus.tgz tar -xzf $<
mv sjasmplus-20190306.1 sjasmplus mv sjasmplus-20190306.1 $(@D)
rm -f sjasmplus.tgz touch $@
../bin/$(ZX7B): zx7b/$(ZX7B) sjasmplus-src.tgz:
wget -c https://github.com/sjasmplus/sjasmplus/archive/refs/tags/20190306.1.tar.gz -O $@
clean-sjasmplus:
if test -d sjasmplus; then $(MAKE) -w -C sjasmplus -f ../sjasmplus.mk clean; fi
rm -f $(INSTALLDIR)/sjasmplus$(EXESUFFIX)
endif
ifeq ($(_UsePrecompiledOnWindows),1)
$(INSTALLDIR)/sjasmplus$(EXESUFFIX): sjasmplus/sjasmplus$(EXESUFFIX)
cp $< $@ cp $< $@
zx7b/$(ZX7B): | zx7b sjasmplus/sjasmplus$(EXESUFFIX): | sjasmplus/.extracted
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
SJASMPLUS_ARCHIVE := sjasmplus-win64.7z
SJASMPLUS_ARCHIVE_SHA256 := ef352b50ce7c9e9971c6fc3143e378d3e9f4069f11eb0c33022195c6e9b34fcb
else
SJASMPLUS_ARCHIVE := sjasmplus-win32.7z
SJASMPLUS_ARCHIVE_SHA256 := c84731640930afc4f4cc3c0f30f891916b9b77d63dc0e4cfdcd226682b8545b1
endif
sjasmplus/.extracted: $(SJASMPLUS_ARCHIVE)
echo '$(SJASMPLUS_ARCHIVE_SHA256) $<' >$<.sha256
sha256sum -c $<.sha256
rm -f $<.sha256
rm -rf $(@D)
7z x -bd -o$(@D) $<
touch $@
sjasmplus-win32.7z:
wget -c https://github.com/sjasmplus/sjasmplus/releases/download/20190306.1/sjasmplus-win32-20190306.1.7z -O $@
sjasmplus-win64.7z:
wget -c https://github.com/sjasmplus/sjasmplus/releases/download/20190306.1/sjasmplus-win64-20190306.1.7z -O $@
clean-sjasmplus:
rm -rf sjasmplus
rm -f $(INSTALLDIR)/sjasmplus$(EXESUFFIX)
endif
.PHONY: dist-clean-sjasmplus
dist-clean-sjasmplus:
rm -rf sjasmplus
rm -f $(INSTALLDIR)/sjasmplus$(EXESUFFIX)
rm -f\
sjasmplus-src.tgz\
sjasmplus-src.tgz.sha256\
sjasmplus-win32.7z\
sjasmplus-win32.7z.sha256\
sjasmplus-win64.7z\
sjasmplus-win64.7z.sha256
# z88dk
.PHONY: external-z88dk clean-z88dk
Z88DK_TARGETS:=\
asmpp.pl\
sccz80$(EXESUFFIX)\
z80asm$(EXESUFFIX)\
z88dk-appmake$(EXESUFFIX)\
z88dk-basck$(EXESUFFIX)\
z88dk-copt$(EXESUFFIX)\
z88dk-dis$(EXESUFFIX)\
z88dk-dzx7$(EXESUFFIX)\
z88dk-font2pv1000$(EXESUFFIX)\
z88dk-lib$(EXESUFFIX)\
z88dk-ticks$(EXESUFFIX)\
z88dk-ucpp$(EXESUFFIX)\
z88dk-z80asm$(EXESUFFIX)\
z88dk-z80nm$(EXESUFFIX)\
z88dk-z80svg$(EXESUFFIX)\
z88dk-zcpp$(EXESUFFIX)\
z88dk-zobjcopy$(EXESUFFIX)\
z88dk-zpragma$(EXESUFFIX)\
z88dk-zx7$(EXESUFFIX)\
zcc$(EXESUFFIX)
external-z88dk: z88dk/.done
ifeq ($(_DoBuild),1)
# Force Win32 build for Windows
ifeq ($(OS),Windows_NT)
export CC=i686-w64-mingw32-gcc
endif
z88dk/.done: | z88dk/.extracted z88dk.mk
$(MAKE) -w -C z88dk -f ../z88dk.mk
cd z88dk/bin && test x $(patsubst %,-a -x %,$(Z88DK_TARGETS))
touch $@
z88dk/.extracted: z88dk-src.tgz
echo 'f3579ee59b4af552721173165af38223b115ccb67179e79d2f3c0ae64338dc7c $<' >$<.sha256
sha256sum -c $<.sha256
rm -f $<.sha256
rm -rf z88dk
tar -xzf $<
patch -N -p0 -s <z88dk.patch || true
touch $@
z88dk-src.tgz:
wget -c https://github.com/z88dk/z88dk/releases/download/v2.1/z88dk-src-2.1.tgz -O $@
# This does not work:
#clean-z88dk: | z88dk.mk
# if test -d z88dk; then $(MAKE) -w -C z88dk -f ../z88dk.mk clean && rm -f z88dk/.done; fi
clean-z88dk:
rm -rf z88dk
endif
ifeq ($(_UsePrecompiledOnWindows),1)
z88dk/.done: z88dk-win32.zip
echo 'f4abedfae429ea159e388b5c76758ace4dcb86e9a00dbd928862b0a30f6874d6 $<' >$<.sha256
sha256sum -c $<.sha256
rm -f $<.sha256
rm -rf z88dk
unzip -nq $<
touch $@
z88dk-win32.zip:
wget -c https://github.com/z88dk/z88dk/releases/download/v2.1/z88dk-win32-2.1.zip -O $@
clean-z88dk:
rm -rf z88dk
endif
.PHONY: dist-clean-z88dk
dist-clean-z88dk:
rm -rf z88dk
rm -f\
z88dk-src.tgz\
z88dk-src.tgz.sha256\
z88dk-win32.zip\
z88dk-win32.zip.sha256
# zx7b
.PHONY: local-zx7b
local-zx7b: $(INSTALLDIR)/zx7b$(EXESUFFIX)
ifeq ($(_DoBuild),1)
$(INSTALLDIR)/zx7b$(EXESUFFIX): zx7b/zx7b$(EXESUFFIX)
cp $< $@
zx7b/zx7b$(EXESUFFIX): | zx7b
$(MAKE) -w -C $| $(MAKE) -w -C $|
../bin/$(BIN2HEX): tools/$(BIN2HEX) .PHONY: clean-zx7b
clean-zx7b: | zx7b
$(MAKE) -w -C $| clean
rm -f $(INSTALLDIR)/zx7b$(EXESUFFIX)
endif
# tools
INSTALLED_TOOLS:=\
$(INSTALLDIR)/bin2hex$(EXESUFFIX)\
$(INSTALLDIR)/fcut$(EXESUFFIX)\
$(INSTALLDIR)/fpad$(EXESUFFIX)\
$(INSTALLDIR)/fpoke$(EXESUFFIX)\
$(INSTALLDIR)/GenRom$(EXESUFFIX)\
$(INSTALLDIR)/AddItem$(EXESUFFIX)
.PHONY: local-tools
local-tools: $(INSTALLED_TOOLS)
ifeq ($(_DoBuild),1)
$(INSTALLDIR)/bin2hex$(EXESUFFIX): tools/bin2hex$(EXESUFFIX)
cp $< $@ cp $< $@
../bin/$(FCUT): tools/$(FCUT) $(INSTALLDIR)/fcut$(EXESUFFIX): tools/fcut$(EXESUFFIX)
cp $< $@ cp $< $@
../bin/$(FPAD): tools/$(FPAD) $(INSTALLDIR)/fpad$(EXESUFFIX): tools/fpad$(EXESUFFIX)
cp $< $@ cp $< $@
../bin/$(FPOKE): tools/$(FPOKE) $(INSTALLDIR)/fpoke$(EXESUFFIX): tools/fpoke$(EXESUFFIX)
cp $< $@ cp $< $@
../bin/$(GENROM): tools/$(GENROM) $(INSTALLDIR)/GenRom$(EXESUFFIX): tools/GenRom$(EXESUFFIX)
cp $< $@ cp $< $@
../bin/$(ADDITEM): tools/$(ADDITEM) $(INSTALLDIR)/AddItem$(EXESUFFIX): tools/AddItem$(EXESUFFIX)
cp $< $@ cp $< $@
tools/$(BIN2HEX) \ tools/%$(EXESUFFIX): | tools
tools/$(FCUT) \ $(MAKE) -w -C $| $(@F)
tools/$(FPAD) \
tools/$(FPOKE) \ .PHONY: clean-tools
tools/$(GENROM) \ clean-tools: | tools
tools/$(ADDITEM): | tools $(MAKE) -w -C $| clean
$(MAKE) -w -C $| rm -f $(INSTALLED_TOOLS)
endif endif
.PHONY: clean .PHONY: clean
ifneq ($(_DoClean),1) ifeq ($(_DoClean),1)
clean:; clean: clean-sjasmplus clean-z88dk clean-zx7b clean-tools
else else
clean: | sjasmplus sjasmplus.mk zx7b tools clean: clean-sjasmplus clean-z88dk
$(MAKE) -w -C sjasmplus -f ../sjasmplus.mk clean endif
$(MAKE) -w -C zx7b clean
$(MAKE) -w -C tools clean .PHONY: dist-clean
rm -f $(TOOLS) ifeq ($(_DoClean),1)
dist-clean: dist-clean-sjasmplus dist-clean-z88dk clean-zx7b clean-tools
else
dist-clean: dist-clean-sjasmplus dist-clean-z88dk
endif endif

View File

@ -17,7 +17,6 @@
# Notes: # Notes:
# BUILD variable may be set in user's environment. # BUILD variable may be set in user's environment.
include ../../common.mk include ../../common.mk
ifeq ($(BUILD),mingw32) ifeq ($(BUILD),mingw32)
@ -28,13 +27,11 @@ else
CMAKEFLAGS := CMAKEFLAGS :=
endif endif
SJASMPLUS := sjasmplus$(EXECEXT) build/sjasmplus$(EXESUFFIX): | build/Makefile
build/$(SJASMPLUS): | build/Makefile
$(MAKE) -w -C build $(MAKE) -w -C build
build/Makefile: | build build/Makefile: | build
cd build && cmake $(CMAKEFLAGS) .. cd $| && cmake $(CMAKEFLAGS) ..
build: build:
mkdir $@ mkdir $@

View File

@ -13,49 +13,27 @@
# #
# where: # where:
# <BUILD> is one of: mingw32, mingw64. # <BUILD> is one of: mingw32, mingw64.
# <TARGET> is one of values for TOOLS variable (see below). # <TARGET> is one of values for TARGETS variable (see below).
# #
# Notes: # Notes:
# BUILD variable may be set in user's environment. # BUILD variable may be set in user's environment.
include ../../common.mk include ../../common.mk
BIN2HEX := bin2hex$(EXECEXT) TARGETS:=\
FCUT := fcut$(EXECEXT) bin2hex$(EXESUFFIX)\
FPAD := fpad$(EXECEXT) fcut$(EXESUFFIX)\
FPOKE := fpoke$(EXECEXT) fpad$(EXESUFFIX)\
GENROM := GenRom$(EXECEXT) fpoke$(EXESUFFIX)\
ADDITEM := AddItem$(EXECEXT) GenRom$(EXESUFFIX)\
AddItem$(EXESUFFIX)
TOOLS:=\
$(BIN2HEX) \
$(FCUT) \
$(FPAD) \
$(FPOKE) \
$(GENROM) \
$(ADDITEM)
.PHONY: all .PHONY: all
all: $(TOOLS) all: $(TARGETS)
$(BIN2HEX): bin2hex.c %$(EXESUFFIX): %.c Makefile
$(CC) $(CFLAGS) -o $@ $<
$(FCUT): fcut.c
$(CC) $(CFLAGS) -o $@ $<
$(FPAD): fpad.c
$(CC) $(CFLAGS) -o $@ $<
$(FPOKE): fpoke.c
$(CC) $(CFLAGS) -o $@ $<
$(GENROM): GenRom.c
$(CC) $(CFLAGS) -o $@ $<
$(ADDITEM): AddItem.c
$(CC) $(CFLAGS) -o $@ $< $(CC) $(CFLAGS) -o $@ $<
.PHONY: clean .PHONY: clean
clean: clean:
rm -f $(TOOLS) rm -f $(TARGETS)

30
sdk/src/z88dk.mk Normal file
View File

@ -0,0 +1,30 @@
# SPDX-FileCopyrightText: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Supported environments:
# * GNU on Linux, FreeBSD etc.
# * GNU on Windows NT (using MinGW/MSYS/Cygwin/WSL)
#
# Build:
# make [BUILD=<BUILD>] -w -C z88dk -f ../z88dk.mk
# Clean:
# make [BUILD=<BUILD>] -w -C z88dk -f ../z88dk.mk clean
#
# where:
# <BUILD> is one of: mingw32, mingw64.
#
# Notes:
# BUILD variable may be set in user's environment.
include ../../common.mk
.PHONY: all
all: | build.sh
chmod 777 $|
./build.sh
.PHONY: clean
clean: | build.sh
chmod 777 $|
./build.sh -C

18
sdk/src/z88dk.patch Normal file
View File

@ -0,0 +1,18 @@
--- z88dk/build.sh 2021-04-20 00:03:23.742154100 +0300
+++ z88dk/build_Cygwin.sh 2021-04-20 00:04:56.836048400 +0300
@@ -48,6 +48,7 @@
builddir=`pwd $0`
ZCCCFG=$builddir/lib/config
PATH=$builddir/bin:$PATH
+if test x$OS = xWindows_NT -a x$OSTYPE = xcygwin; then ZCCCFG=`cygpath -m $ZCCCFG`; fi
export ZCCCFG
export PATH
@@ -143,6 +144,7 @@
ZCCCFG=`pwd`/lib/config/ # Set ZCCCFG to the lib config directory
mkdir -p $ZCCCFG # Guarantee that the directory exists
+if test x$OS = xWindows_NT -a x$OSTYPE = xcygwin; then ZCCCFG=`cygpath -m $ZCCCFG`; fi
export ZCCCFG

View File

@ -13,20 +13,21 @@
# #
# where: # where:
# <BUILD> is one of: mingw32, mingw64. # <BUILD> is one of: mingw32, mingw64.
# <TARGET> is one of values of TOOLS variable (see below). # <TARGET> is the value of TARGET variable (see below).
# #
# Notes: # Notes:
# BUILD variable may be set in user's environment. # BUILD variable may be set in user's environment.
include ../../common.mk include ../../common.mk
ZX7B := zx7b$(EXECEXT) TARGET := zx7b$(EXESUFFIX)
$(ZX7B): zx7b.c .PHONY: all
all: $(TARGET)
%$(EXESUFFIX): %.c Makefile
$(CC) $(CFLAGS) -o $@ $< $(CC) $(CFLAGS) -o $@ $<
zx7b.c: .PHONY: clean
wget -c https://github.com/antoniovillena/zx7b/raw/master/zx7b.c
clean: clean:
rm -f $(ZX7B) rm -f $(TARGET)