diff --git a/sdk/.gitignore b/sdk/.gitignore index b7d2960..8838f76 100644 --- a/sdk/.gitignore +++ b/sdk/.gitignore @@ -2,4 +2,6 @@ # # SPDX-License-Identifier: CC0-1.0 +bin/* +lib/* conf.mk diff --git a/sdk/Makefile b/sdk/Makefile index 7342b5c..b6e9a15 100644 --- a/sdk/Makefile +++ b/sdk/Makefile @@ -33,23 +33,21 @@ include common.mk -prefix ?= . +prefix ?= $(shell realpath --relative-base=. $(USE_PREFIX)) ifeq ($(BUILD),mingw32) -FORCEBUILD:=1 + FORCEBUILD = 1 else ifeq ($(BUILD),mingw64) -FORCEBUILD:=1 + FORCEBUILD = 1 else -BUILD:= -FORCEBUILD:=0 + BUILD = + FORCEBUILD = 0 endif ifdef $(FORCECLEAN) -ifneq ($(FORCECLEAN),1) -FORCECLEAN:=0 -else -FORCECLEAN:=0 -endif + ifneq ($(FORCECLEAN),1) + FORCECLEAN = 0 + endif endif export BUILD diff --git a/sdk/README.md b/sdk/README.md index 26a7e92..28c98d6 100644 --- a/sdk/README.md +++ b/sdk/README.md @@ -24,6 +24,7 @@ Directory | Description `include` | Header files (`.def`, `.h` etc.) to be included in other sources (assembler, C, etc.). `lib` | Libraries, needed for executables (mostly in `bin` directory) to function properly. `src` | The source code of local and downloadable tools. See Makefiles for details. +`windows-x86` | Compiled binaries of tools and libraries for Windows x86 (32 bit) platform. ## 1.1. Copyright and licensing information for files @@ -95,12 +96,13 @@ Value of `TARGET` | Origin | Description `zx7b` | `src/zx7b` | zx7b `tools` | `src/tools` | tools -Value of `BUILD` | Target system +Value of `BUILD` | Target directory | Target system ----|---- -`mingw32` | Windows with i686 architecture (32-bits) -`mingw64` | Windows with AMD64 architecture (64-bits) +`mingw32` | `windows-x86` | Windows with i686 architecture (32-bits) +`mingw64` | `windows-x86_64` | Windows with AMD64 architecture (64-bits) -Compiled binaries are installed into `bin` sub-directory. +Compiled binaries are installed into `bin` sub-directory of target directory. +Compiled libraries are installed into `lib` sub-directory of target directory. Example: @@ -111,7 +113,7 @@ make BUILD=mingw64 tools Then you may use `strip` tool to strip debug information from file and thus shrink file's size. Example: ```bash -strip bin/*.exe +strip windows-x86/bin/*.exe ``` For more options see [`Makefile`](Makefile). @@ -225,7 +227,7 @@ Value of `TARGET` | Sources origin | Binaries origin (**Quick setup**) | Build f Then you may use `strip` tool to strip debug information from file and thus shrink file's size. Example: ```bash -strip bin/*.exe +strip windows-x86/bin/*.exe ``` For more options see [`Makefile`](Makefile). diff --git a/sdk/bin/.gitignore b/sdk/bin/.gitignore deleted file mode 100644 index 2c6336a..0000000 --- a/sdk/bin/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -# SPDX-FileCopyrightText: 2021 Ivan Tatarinov -# -# SPDX-License-Identifier: CC0-1.0 - -sjasmplus -sjasmplus.exe -zx7b -bin2hex -fcut -fpad -fpoke -rcs -Png2Rcs -GenTape -GenRom -AddItem -Bit2Bin diff --git a/sdk/common.mk b/sdk/common.mk index 7ed8b64..98ed894 100644 --- a/sdk/common.mk +++ b/sdk/common.mk @@ -11,21 +11,38 @@ ifndef ZXSDK ZXSDK := $(patsubst %/,%,$(abspath $(dir $(lastword $(MAKEFILE_LIST))))) -Z88DK := $(ZXSDK)/src/z88dk -ZCCCFG := $(Z88DK)/lib/config -PATH := $(ZXSDK)/bin:$(Z88DK)/bin:$(PATH) ifeq ($(OS),Windows_NT) -PATH := $(ZXSDK)/lib:$(PATH) + ifeq ($(PROCESSOR_ARCHITECTURE),X86) + ZXSDK_PLATFORM= $(ZXSDK)/windows-x86 + else ifeq ($(PROCESSOR_ARCHITECTURE),AMD64) + ZXSDK_PLATFORM= $(ZXSDK)/windows-x86 + else ifeq ($(PROCESSOR_ARCHITECTURE),EM64T) + ZXSDK_PLATFORM= $(ZXSDK)/windows-x86 + else + $(warning Unsupported platform: "$(PROCESSOR_ARCHITECTURE)") + ZXSDK_PLATFORM= $(ZXSDK)/windows-x86 + endif +else + ZXSDK_PLATFORM = $(ZXSDK) +endif + +Z88DK := $(ZXSDK)/src/z88dk +ZCCCFG := $(Z88DK)/lib/config +PATH := $(ZXSDK_PLATFORM)/bin:$(Z88DK)/bin:$(PATH) + +ifeq ($(OS),Windows_NT) +PATH := $(ZXSDK_PLATFORM)/lib:$(PATH) # Fix paths under Cygwin for z88dk on Windows ifeq ($(shell echo $$OSTYPE),cygwin) ZCCCFG := $(shell cygpath -m $(ZCCCFG)) endif else # $(OS)!=Windows_NT -export LD_LIBRARY_PATH:=$(ZXSDK)/lib +export LD_LIBRARY_PATH:=$(ZXSDK_PLATFORM)/lib endif # $(OS)!=Windows_NT export ZXSDK +export ZXSDK_PLATFORM export ZCCCFG export PATH @@ -33,9 +50,6 @@ endif # !ZXSDK -include $(ZXSDK)/conf.mk -# Default values -USE_SJASMPLUS_VERSION ?= z00m128 - ifeq ($(OS),Windows_NT) EXESUFFIX := .exe DLLSUFFIX := .dll @@ -48,8 +62,14 @@ ifeq ($(BUILD),mingw32) CC := i686-w64-mingw32-gcc EXESUFFIX := .exe DLLSUFFIX := .dll +USE_PREFIX ?= $(ZXSDK)/windows-x86 else ifeq ($(BUILD),mingw64) CC := x86_64-w64-mingw32-gcc EXESUFFIX := .exe DLLSUFFIX := .dll +USE_PREFIX ?= $(ZXSDK)/windows-x86_64 endif + +# Default values +USE_PREFIX ?= $(ZXSDK_PLATFORM) +USE_SJASMPLUS_VERSION ?= z00m128 diff --git a/sdk/lib/.gitignore b/sdk/lib/.gitignore deleted file mode 100644 index a0b38ba..0000000 --- a/sdk/lib/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-FileCopyrightText: 2021 Ivan Tatarinov -# -# SPDX-License-Identifier: CC0-1.0 - -liblodepng.so diff --git a/sdk/setenv.bat b/sdk/setenv.bat index a0eb918..66bcda0 100644 --- a/sdk/setenv.bat +++ b/sdk/setenv.bat @@ -6,6 +6,7 @@ rem SPDX-License-Identifier: GPL-3.0-or-later if not x%ZXSDK% == x exit /b set ZXSDK=%~dp0 set ZXSDK=%ZXSDK:~0,-1% +set ZXSDK_PLATFORM=%ZXSDK%\windows-x86 set Z88DK=%ZXSDK%\src\z88dk set ZCCCFG=%Z88DK%\lib\config -set PATH=%ZXSDK%\bin;%Z88DK%\bin;%ZXSDK%\lib;%PATH% +set PATH=%ZXSDK_PLATFORM%\bin;%Z88DK%\bin;%ZXSDK_PLATFORM%\lib;%PATH% diff --git a/sdk/setenv.sh b/sdk/setenv.sh index 0411ec8..6352b70 100644 --- a/sdk/setenv.sh +++ b/sdk/setenv.sh @@ -5,18 +5,24 @@ if [[ "x$ZXSDK" == x ]]; then ZXSDK=$(dirname $(realpath "$BASH_SOURCE")) + if [[ x$OS == xWindows_NT ]]; then + ZXSDK_PLATFORM=$ZXSDK/windows-x86 + else + ZXSDK_PLATFORM=$ZXSDK + fi Z88DK=$ZXSDK/src/z88dk ZCCCFG=$Z88DK/lib/config - PATH=$ZXSDK/bin:$Z88DK/bin:$PATH + PATH=$ZXSDK_PLATFORM/bin:$Z88DK/bin:$PATH if [[ x$OS == xWindows_NT ]]; then - PATH=$ZXSDK/lib:$PATH + PATH=$ZXSDK_PLATFORM/lib:$PATH # Fix paths under Cygwin for z88dk on Windows if [[ x$OSTYPE == xcygwin ]]; then ZCCCFG=`cygpath -m $ZCCCFG` fi else - export LD_LIBRARY_PATH=$ZXSDK/lib + export LD_LIBRARY_PATH=$ZXSDK_PLATFORM/lib fi export ZXSDK + export ZXSDK_PLATFORM export ZCCCFG fi diff --git a/sdk/src/Makefile b/sdk/src/Makefile index 86ef448..4c39ec9 100644 --- a/sdk/src/Makefile +++ b/sdk/src/Makefile @@ -29,7 +29,7 @@ include ../common.mk -prefix ?= .. +prefix ?= $(shell realpath --relative-base=. $(USE_PREFIX)) exec_prefix ?= $(prefix) bindir ?= $(exec_prefix)/bin @@ -51,24 +51,27 @@ uninstall: $(foreach t,$(TARGETS),uninstall-$(t)) clean: $(foreach t,$(TARGETS),clean-$(t)) distclean: $(foreach t,$(TARGETS),distclean-$(t)) -_DoBuild:=1 -_UsePrecompiledOnWindows:=0 -_DoClean:=1 +_DoBuild = 1 +_UsePrecompiledOnWindows = 0 +_DoClean = 1 ifeq ($(OS),Windows_NT) -ifneq ($(FORCEBUILD),1) -_DoBuild:=0 -_UsePrecompiledOnWindows:=1 -endif -ifneq ($(FORCECLEAN),1) -_DoClean:=0 -endif + ifneq ($(FORCEBUILD),1) + _DoBuild = 0 + _UsePrecompiledOnWindows = 1 + endif + ifneq ($(FORCECLEAN),1) + _DoClean = 0 + endif endif # $(OS)==Windows_NT # sjasmplus .PHONY: $(foreach a,build install uninstall clean distclean,$(a)-sjasmplus) +$(DESTDIR)$(bindir): + mkdir -p $@ + ifeq ($(USE_SJASMPLUS_VERSION),sjasmplus) ifeq ($(_DoBuild),1) @@ -140,7 +143,7 @@ sjasmplus-win64.7z: install-sjasmplus: $(DESTDIR)$(bindir)/sjasmplus$(EXESUFFIX) -$(DESTDIR)$(bindir)/sjasmplus$(EXESUFFIX): sjasmplus/sjasmplus$(EXESUFFIX) +$(DESTDIR)$(bindir)/sjasmplus$(EXESUFFIX): sjasmplus/sjasmplus$(EXESUFFIX) | $(DESTDIR)$(bindir) $(INSTALL_PROGRAM) $< $@ ifeq ($(_DoClean),1) @@ -239,7 +242,7 @@ sjasmplus-z00m128-win32.zip: install-sjasmplus: $(DESTDIR)$(bindir)/sjasmplus$(EXESUFFIX) -$(DESTDIR)$(bindir)/sjasmplus$(EXESUFFIX): sjasmplus-z00m128/sjasmplus$(EXESUFFIX) +$(DESTDIR)$(bindir)/sjasmplus$(EXESUFFIX): sjasmplus-z00m128/sjasmplus$(EXESUFFIX) | $(DESTDIR)$(bindir) $(INSTALL_PROGRAM) $< $@ ifeq ($(_DoClean),1) diff --git a/sdk/src/sjasmplus-z00m128.mk b/sdk/src/sjasmplus-z00m128.mk index 404e428..4cdf0c7 100644 --- a/sdk/src/sjasmplus-z00m128.mk +++ b/sdk/src/sjasmplus-z00m128.mk @@ -26,6 +26,7 @@ bindir ?= $(exec_prefix)/bin INSTALL ?= install INSTALL_PROGRAM ?= $(INSTALL) +RM ?= rm -f BINS = sjasmplus$(EXESUFFIX) @@ -36,7 +37,7 @@ build\ $(DESTDIR)$(bindir): mkdir -p $@ -sjasmplus$(EXESUFFIX): | Makefile +$(srcdir)/sjasmplus$(EXESUFFIX): | Makefile $(MAKE) clean $(MAKE) @@ -48,7 +49,7 @@ $(DESTDIR)$(bindir)/sjasmplus$(EXESUFFIX): sjasmplus$(EXESUFFIX) | $(DESTDIR)$(b .PHONY: uninstall uninstall: - rm -f $(foreach t,$(BINS),$(DESTDIR)$(bindir)/$(t)) + $(RM) $(foreach t,$(BINS),$(DESTDIR)$(bindir)/$(t)) .PHONY: clean clean: diff --git a/sdk/bin/AddItem.exe b/sdk/windows-x86/bin/AddItem.exe similarity index 100% rename from sdk/bin/AddItem.exe rename to sdk/windows-x86/bin/AddItem.exe diff --git a/sdk/bin/AddItem.exe.license b/sdk/windows-x86/bin/AddItem.exe.license similarity index 100% rename from sdk/bin/AddItem.exe.license rename to sdk/windows-x86/bin/AddItem.exe.license diff --git a/sdk/bin/Bit2Bin.exe b/sdk/windows-x86/bin/Bit2Bin.exe similarity index 100% rename from sdk/bin/Bit2Bin.exe rename to sdk/windows-x86/bin/Bit2Bin.exe diff --git a/sdk/bin/Bit2Bin.exe.license b/sdk/windows-x86/bin/Bit2Bin.exe.license similarity index 100% rename from sdk/bin/Bit2Bin.exe.license rename to sdk/windows-x86/bin/Bit2Bin.exe.license diff --git a/sdk/bin/GenRom.exe b/sdk/windows-x86/bin/GenRom.exe similarity index 100% rename from sdk/bin/GenRom.exe rename to sdk/windows-x86/bin/GenRom.exe diff --git a/sdk/bin/GenRom.exe.license b/sdk/windows-x86/bin/GenRom.exe.license similarity index 100% rename from sdk/bin/GenRom.exe.license rename to sdk/windows-x86/bin/GenRom.exe.license diff --git a/sdk/bin/GenTape.exe b/sdk/windows-x86/bin/GenTape.exe similarity index 100% rename from sdk/bin/GenTape.exe rename to sdk/windows-x86/bin/GenTape.exe diff --git a/sdk/bin/GenTape.exe.license b/sdk/windows-x86/bin/GenTape.exe.license similarity index 100% rename from sdk/bin/GenTape.exe.license rename to sdk/windows-x86/bin/GenTape.exe.license diff --git a/sdk/bin/Png2Rcs.exe b/sdk/windows-x86/bin/Png2Rcs.exe similarity index 100% rename from sdk/bin/Png2Rcs.exe rename to sdk/windows-x86/bin/Png2Rcs.exe diff --git a/sdk/bin/Png2Rcs.exe.license b/sdk/windows-x86/bin/Png2Rcs.exe.license similarity index 100% rename from sdk/bin/Png2Rcs.exe.license rename to sdk/windows-x86/bin/Png2Rcs.exe.license diff --git a/sdk/bin/bin2hex.exe b/sdk/windows-x86/bin/bin2hex.exe similarity index 100% rename from sdk/bin/bin2hex.exe rename to sdk/windows-x86/bin/bin2hex.exe diff --git a/sdk/bin/bin2hex.exe.license b/sdk/windows-x86/bin/bin2hex.exe.license similarity index 100% rename from sdk/bin/bin2hex.exe.license rename to sdk/windows-x86/bin/bin2hex.exe.license diff --git a/sdk/bin/dzx7b.exe b/sdk/windows-x86/bin/dzx7b.exe similarity index 100% rename from sdk/bin/dzx7b.exe rename to sdk/windows-x86/bin/dzx7b.exe diff --git a/sdk/bin/dzx7b.exe.license b/sdk/windows-x86/bin/dzx7b.exe.license similarity index 87% rename from sdk/bin/dzx7b.exe.license rename to sdk/windows-x86/bin/dzx7b.exe.license index 331be09..b4469d1 100644 --- a/sdk/bin/dzx7b.exe.license +++ b/sdk/windows-x86/bin/dzx7b.exe.license @@ -6,6 +6,6 @@ SPDX-FileChecksum: SHA1: 1c1d766371864e10bfb5c95fa57d7598e8a6bf89 SPDX-FileCopyrightText: Copyright (c) 2015 Einar Saukas. All rights reserved. -SPDX-License-Identifier: BSD-3-clause +SPDX-License-Identifier: BSD-3-Clause SPDX-FileComment: dzx7b version 1.0 (2015) - LZ77/LZSS backwards decompressor. diff --git a/sdk/bin/fcut.exe b/sdk/windows-x86/bin/fcut.exe similarity index 100% rename from sdk/bin/fcut.exe rename to sdk/windows-x86/bin/fcut.exe diff --git a/sdk/bin/fcut.exe.license b/sdk/windows-x86/bin/fcut.exe.license similarity index 100% rename from sdk/bin/fcut.exe.license rename to sdk/windows-x86/bin/fcut.exe.license diff --git a/sdk/bin/fpad.exe b/sdk/windows-x86/bin/fpad.exe similarity index 100% rename from sdk/bin/fpad.exe rename to sdk/windows-x86/bin/fpad.exe diff --git a/sdk/bin/fpad.exe.license b/sdk/windows-x86/bin/fpad.exe.license similarity index 100% rename from sdk/bin/fpad.exe.license rename to sdk/windows-x86/bin/fpad.exe.license diff --git a/sdk/bin/fpoke.exe b/sdk/windows-x86/bin/fpoke.exe similarity index 100% rename from sdk/bin/fpoke.exe rename to sdk/windows-x86/bin/fpoke.exe diff --git a/sdk/bin/fpoke.exe.license b/sdk/windows-x86/bin/fpoke.exe.license similarity index 100% rename from sdk/bin/fpoke.exe.license rename to sdk/windows-x86/bin/fpoke.exe.license diff --git a/sdk/bin/rcs.exe b/sdk/windows-x86/bin/rcs.exe similarity index 100% rename from sdk/bin/rcs.exe rename to sdk/windows-x86/bin/rcs.exe diff --git a/sdk/bin/rcs.exe.license b/sdk/windows-x86/bin/rcs.exe.license similarity index 100% rename from sdk/bin/rcs.exe.license rename to sdk/windows-x86/bin/rcs.exe.license diff --git a/sdk/bin/zx7b.exe b/sdk/windows-x86/bin/zx7b.exe similarity index 100% rename from sdk/bin/zx7b.exe rename to sdk/windows-x86/bin/zx7b.exe diff --git a/sdk/bin/zx7b.exe.license b/sdk/windows-x86/bin/zx7b.exe.license similarity index 100% rename from sdk/bin/zx7b.exe.license rename to sdk/windows-x86/bin/zx7b.exe.license diff --git a/sdk/lib/liblodepng.dll b/sdk/windows-x86/lib/liblodepng.dll similarity index 100% rename from sdk/lib/liblodepng.dll rename to sdk/windows-x86/lib/liblodepng.dll diff --git a/sdk/lib/liblodepng.dll.license b/sdk/windows-x86/lib/liblodepng.dll.license similarity index 100% rename from sdk/lib/liblodepng.dll.license rename to sdk/windows-x86/lib/liblodepng.dll.license