diff --git a/sdk/Makefile b/sdk/Makefile index 08cfca9..8ede995 100644 --- a/sdk/Makefile +++ b/sdk/Makefile @@ -15,7 +15,7 @@ # is one of: mingw32, mingw64. # is 1 to force build, otherwise do not (default). # is 1 to force clean, otherwise do not (default). -# is one of values of TOOLS variable (see below). +# is one of: sjasmplus, z88dk, zx7b, tools # # Notes: # BUILD, FORCEBUILD, FORCECLEAN variables may be set in user's environment. @@ -43,31 +43,17 @@ export BUILD export FORCEBUILD 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 -all: $(TOOLS) +all: sjasmplus z88dk zx7b tools -$(TOOLS): | src/Makefile - $(MAKE) -w -C src ../bin/$(@F) +.PHONY: sjasmplus z88dk +sjasmplus z88dk: | src + $(MAKE) -w -C $| external-$@ -.PHONY: clean -clean: | src/Makefile - $(MAKE) -w -C src clean +.PHONY: zx7b tools +zx7b tools: | src + $(MAKE) -w -C $| local-$@ + +.PHONY: clean dist-clean +clean dist-clean: | src + $(MAKE) -w -C $| $@ diff --git a/sdk/README.md b/sdk/README.md index 8bf4ae5..7c10fe5 100644 --- a/sdk/README.md +++ b/sdk/README.md @@ -8,11 +8,14 @@ No one yet. # 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 -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 @@ -28,15 +31,22 @@ Check it out by using this [reuse-tool](https://github.com/fsfe/reuse-tool). 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. +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: -```bash +``` # 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 -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 bin/sjasmplus` | **sjasmplus** -`make bin/zx7b` | **zx7b** -`make bin/bin2hex` | **bin2hex** -`make bin/fcut` | **fcut** -`make bin/fpad` | **fpad** -`make bin/fpoke` | **fpoke** -`make bin/GenRom` | **GenRom** -`make bin/AddItem` | **AddItem** +`make` | Build all tools from sources +`make ` | Build only the TARGET from sources +`make BUILD=` | Cross-build all tools from sources for Windows platfowm +`make BUILD= ` | Cross-build only the TARGET from sources for Windows platfowm -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) -`BUILD=mingw64` | Windows with AMD64 architecture (64-bits) +`mingw32` | Windows with i686 architecture (32-bits) +`mingw64` | Windows with AMD64 architecture (64-bits) -Remember to specify proper file extension (`.exe`) for target when building with MinGW. Example: +Example: ```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 -strip bin/fcut.exe bin/fpad.exe bin/fpoke.exe +strip bin/*.exe ``` ## 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 -make clean -``` +Command | Description +----|---- +`make clean` | clean after compilation from sources +`make dist-clean` | acts like `clean` but also removes temporary and downloaded files +`make BUILD= clean` | clean after compilation from sources for Windows platform +`make 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 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 -**NOTE**: *by default* compilation of the following tools: +## 3.1. Prepare a build environment -* sjasmplus -* zx7b -* bin2hex -* fcut -* fpad -* fpoke -* GenRom -* AddItem +### 3.1.1. Setup Cygwin -on Windows platform is disabled right now because of presence of precompiled binaries of them in repository. -*By default* they are not deleted when cleaning. +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. -## 3.1. Build tools +Install the following packages in Cygwin: -The building process is similar to one for GNU on Linux, FreeBSD etc. -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`. +Target | Dependencies +----|---- +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. -See [2.3](#23-clean-tools) with addition that you should specify parameter `FORCECLEAN=1`. +To open Cygwin terminal just click on it's icon on desktop. This will open a Bash shell in a GNU environment. -## 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 ` | Qucik setup of the TARGET only +`make FORCEBUILD=1` | Build all tools from sources +`make FORCEBUILD=1 ` | 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. 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. See [2.4.2](#242-in-bash-scripts). diff --git a/sdk/common.mk b/sdk/common.mk index 1504d52..c1ea14b 100644 --- a/sdk/common.mk +++ b/sdk/common.mk @@ -11,23 +11,33 @@ ifndef ZXUNOSDK 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 ZCCCFG export PATH endif ifeq ($(OS),Windows_NT) -EXECEXT := .exe +EXESUFFIX := .exe else -EXECEXT := +EXESUFFIX := endif ifeq ($(BUILD),mingw32) CC := i686-w64-mingw32-gcc -EXECEXT := .exe +EXESUFFIX := .exe else ifeq ($(BUILD),mingw64) CC := x86_64-w64-mingw32-gcc -EXECEXT := .exe +EXESUFFIX := .exe endif diff --git a/sdk/setvars.bat b/sdk/setvars.bat index ffe8fac..be3b30a 100644 --- a/sdk/setvars.bat +++ b/sdk/setvars.bat @@ -6,4 +6,6 @@ rem SPDX-License-Identifier: GPL-3.0-or-later if not x%ZXUNOSDK% == x exit /b set ZXUNOSDK=%~dp0 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% diff --git a/sdk/setvars.sh b/sdk/setvars.sh index 9a41831..edbaf59 100644 --- a/sdk/setvars.sh +++ b/sdk/setvars.sh @@ -5,6 +5,13 @@ if [[ "x$ZXUNOSDK" == x ]]; then 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 ZCCCFG fi diff --git a/sdk/src/.gitignore b/sdk/src/.gitignore index 43b40b3..e1b2444 100644 --- a/sdk/src/.gitignore +++ b/sdk/src/.gitignore @@ -3,3 +3,14 @@ # SPDX-License-Identifier: CC0-1.0 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 diff --git a/sdk/src/Makefile b/sdk/src/Makefile index babd03a..e185d53 100644 --- a/sdk/src/Makefile +++ b/sdk/src/Makefile @@ -9,117 +9,288 @@ # Build: # make [BUILD=] [FORCEBUILD=] [] # Clean: -# make [BUILD=] [FORCECLEAN=] clean +# make [BUILD=] [FORCECLEAN=] clean|dist-clean # # where: # is one of: mingw32, mingw64. # is 1 to force build, otherwise do not (default). # is 1 to force clean, otherwise do not (default). -# is one of values of TOOLS variable (see below). +# is one of: +# * external-sjasmplus +# * external-z88dk +# * local-zx7b +# * local-tools # # Notes: # BUILD, FORCEBUILD, FORCECLEAN variables may be set in user's environment. include ../common.mk -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) +INSTALLDIR=../bin .PHONY: all -all: $(TOOLS) +all:\ + external-sjasmplus\ + external-z88dk\ + local-zx7b\ + local-tools + +_DoBuild:=1 +_UsePrecompiledOnWindows:=0 ifeq ($(OS),Windows_NT) -ifeq ($(FORCEBUILD),1) -_DoBuild:=1 -else +ifneq ($(FORCEBUILD),1) _DoBuild:=0 +_UsePrecompiledOnWindows:=1 endif -else -_DoBuild:=1 endif -ifeq ($(OS),Windows_NT) -ifeq ($(FORCECLEAN),1) _DoClean:=1 -else +ifeq ($(OS),Windows_NT) +ifneq ($(FORCECLEAN),1) _DoClean:=0 endif -else -_DoClean:=1 endif +# sjasmplus + +.PHONY: external-sjasmplus clean-sjasmplus + +external-sjasmplus: $(INSTALLDIR)/sjasmplus$(EXESUFFIX) + ifeq ($(_DoBuild),1) -../bin/$(SJASMPLUS): sjasmplus/build/$(SJASMPLUS) + +$(INSTALLDIR)/sjasmplus$(EXESUFFIX): sjasmplus/build/sjasmplus$(EXESUFFIX) cp $< $@ -sjasmplus/build/$(SJASMPLUS): | sjasmplus sjasmplus.mk +sjasmplus/build/sjasmplus$(EXESUFFIX): | sjasmplus/.extracted sjasmplus.mk $(MAKE) -w -C sjasmplus -f ../sjasmplus.mk -sjasmplus: - wget -c https://github.com/sjasmplus/sjasmplus/archive/refs/tags/20190306.1.tar.gz -O sjasmplus.tgz - echo 'f3f6d28af19880ed2cb427b6b427e9bd42371929c7d263dac840fb71de1302d6 sjasmplus.tgz' >sjasmplus.sha256sum - sha256sum -c sjasmplus.sha256sum - rm -f sjasmplus.sha256sum - tar -xzf sjasmplus.tgz - mv sjasmplus-20190306.1 sjasmplus - rm -f sjasmplus.tgz +sjasmplus/.extracted: sjasmplus-src.tgz + echo 'f3f6d28af19880ed2cb427b6b427e9bd42371929c7d263dac840fb71de1302d6 $<' >$<.sha256 + sha256sum -c $<.sha256 + rm -f $<.sha256 + rm -rf $(@D) sjasmplus-20190306.1 + tar -xzf $< + mv sjasmplus-20190306.1 $(@D) + 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 $< $@ -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 $<.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 $| -../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 $< $@ -../bin/$(FCUT): tools/$(FCUT) +$(INSTALLDIR)/fcut$(EXESUFFIX): tools/fcut$(EXESUFFIX) cp $< $@ -../bin/$(FPAD): tools/$(FPAD) +$(INSTALLDIR)/fpad$(EXESUFFIX): tools/fpad$(EXESUFFIX) cp $< $@ -../bin/$(FPOKE): tools/$(FPOKE) +$(INSTALLDIR)/fpoke$(EXESUFFIX): tools/fpoke$(EXESUFFIX) cp $< $@ -../bin/$(GENROM): tools/$(GENROM) +$(INSTALLDIR)/GenRom$(EXESUFFIX): tools/GenRom$(EXESUFFIX) cp $< $@ -../bin/$(ADDITEM): tools/$(ADDITEM) +$(INSTALLDIR)/AddItem$(EXESUFFIX): tools/AddItem$(EXESUFFIX) cp $< $@ -tools/$(BIN2HEX) \ -tools/$(FCUT) \ -tools/$(FPAD) \ -tools/$(FPOKE) \ -tools/$(GENROM) \ -tools/$(ADDITEM): | tools - $(MAKE) -w -C $| +tools/%$(EXESUFFIX): | tools + $(MAKE) -w -C $| $(@F) + +.PHONY: clean-tools +clean-tools: | tools + $(MAKE) -w -C $| clean + rm -f $(INSTALLED_TOOLS) + endif .PHONY: clean -ifneq ($(_DoClean),1) -clean:; +ifeq ($(_DoClean),1) +clean: clean-sjasmplus clean-z88dk clean-zx7b clean-tools else -clean: | sjasmplus sjasmplus.mk zx7b tools - $(MAKE) -w -C sjasmplus -f ../sjasmplus.mk clean - $(MAKE) -w -C zx7b clean - $(MAKE) -w -C tools clean - rm -f $(TOOLS) +clean: clean-sjasmplus clean-z88dk +endif + +.PHONY: dist-clean +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 diff --git a/sdk/src/sjasmplus.mk b/sdk/src/sjasmplus.mk index 35cc03b..0bf51de 100644 --- a/sdk/src/sjasmplus.mk +++ b/sdk/src/sjasmplus.mk @@ -17,7 +17,6 @@ # Notes: # BUILD variable may be set in user's environment. - include ../../common.mk ifeq ($(BUILD),mingw32) @@ -28,13 +27,11 @@ else CMAKEFLAGS := endif -SJASMPLUS := sjasmplus$(EXECEXT) - -build/$(SJASMPLUS): | build/Makefile +build/sjasmplus$(EXESUFFIX): | build/Makefile $(MAKE) -w -C build build/Makefile: | build - cd build && cmake $(CMAKEFLAGS) .. + cd $| && cmake $(CMAKEFLAGS) .. build: mkdir $@ diff --git a/sdk/src/tools/Makefile b/sdk/src/tools/Makefile index 90a3dd5..100d23f 100644 --- a/sdk/src/tools/Makefile +++ b/sdk/src/tools/Makefile @@ -13,49 +13,27 @@ # # where: # is one of: mingw32, mingw64. -# is one of values for TOOLS variable (see below). +# is one of values for TARGETS variable (see below). # # Notes: # BUILD variable may be set in user's environment. include ../../common.mk -BIN2HEX := bin2hex$(EXECEXT) -FCUT := fcut$(EXECEXT) -FPAD := fpad$(EXECEXT) -FPOKE := fpoke$(EXECEXT) -GENROM := GenRom$(EXECEXT) -ADDITEM := AddItem$(EXECEXT) - -TOOLS:=\ - $(BIN2HEX) \ - $(FCUT) \ - $(FPAD) \ - $(FPOKE) \ - $(GENROM) \ - $(ADDITEM) +TARGETS:=\ + bin2hex$(EXESUFFIX)\ + fcut$(EXESUFFIX)\ + fpad$(EXESUFFIX)\ + fpoke$(EXESUFFIX)\ + GenRom$(EXESUFFIX)\ + AddItem$(EXESUFFIX) .PHONY: all -all: $(TOOLS) +all: $(TARGETS) -$(BIN2HEX): bin2hex.c - $(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 +%$(EXESUFFIX): %.c Makefile $(CC) $(CFLAGS) -o $@ $< .PHONY: clean clean: - rm -f $(TOOLS) + rm -f $(TARGETS) diff --git a/sdk/src/z88dk.mk b/sdk/src/z88dk.mk new file mode 100644 index 0000000..96371c9 --- /dev/null +++ b/sdk/src/z88dk.mk @@ -0,0 +1,30 @@ +# SPDX-FileCopyrightText: 2021 Ivan Tatarinov +# +# 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=] -w -C z88dk -f ../z88dk.mk +# Clean: +# make [BUILD=] -w -C z88dk -f ../z88dk.mk clean +# +# where: +# 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 diff --git a/sdk/src/z88dk.patch b/sdk/src/z88dk.patch new file mode 100644 index 0000000..3047bf0 --- /dev/null +++ b/sdk/src/z88dk.patch @@ -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 + + diff --git a/sdk/src/zx7b/Makefile b/sdk/src/zx7b/Makefile index 04ece1f..c2b9b28 100644 --- a/sdk/src/zx7b/Makefile +++ b/sdk/src/zx7b/Makefile @@ -13,20 +13,21 @@ # # where: # is one of: mingw32, mingw64. -# is one of values of TOOLS variable (see below). +# is the value of TARGET variable (see below). # # Notes: # BUILD variable may be set in user's environment. include ../../common.mk -ZX7B := zx7b$(EXECEXT) +TARGET := zx7b$(EXESUFFIX) -$(ZX7B): zx7b.c +.PHONY: all +all: $(TARGET) + +%$(EXESUFFIX): %.c Makefile $(CC) $(CFLAGS) -o $@ $< -zx7b.c: - wget -c https://github.com/antoniovillena/zx7b/raw/master/zx7b.c - +.PHONY: clean clean: - rm -f $(ZX7B) + rm -f $(TARGET)