From 674cf174c7c8f16afa31b321c115a8bb93b7f363 Mon Sep 17 00:00:00 2001 From: Ivan Tatarinov Date: Thu, 8 Apr 2021 13:41:02 +0300 Subject: [PATCH] sdk: added compilation of `sjasmplus` on GNU/Linux --- .gitignore | 3 +++ sdk/Makefile | 24 ++++++++++++++++++++++++ sdk/common.mk | 8 ++++++++ sdk/src/Makefile | 35 +++++++++++++++++++++++++++++++++++ sdk/src/sjasmplus.mk | 27 +++++++++++++++++++++++++++ 5 files changed, 97 insertions(+) create mode 100644 sdk/Makefile create mode 100644 sdk/src/Makefile create mode 100644 sdk/src/sjasmplus.mk diff --git a/.gitignore b/.gitignore index 527337e..441d41d 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,6 @@ cores/Oric/source/_impact.cmd cores/Oric/source/_impact.log cores/Oric/build/oric.v4_my.bit + +sdk/bin/sjasmplus +sdk/src/sjasmplus diff --git a/sdk/Makefile b/sdk/Makefile new file mode 100644 index 0000000..b003ff0 --- /dev/null +++ b/sdk/Makefile @@ -0,0 +1,24 @@ +# Supported environments: +# * GNU/Linux +# * Windows NT (using MinGW/MSYS/Cygwin/WSL) + +include common.mk + +ifeq ($(OS),Windows_NT) +SJASMPLUS := sjasmplus.exe +else +SJASMPLUS := sjasmplus +endif + +TOOLS:=\ + bin/$(SJASMPLUS) + +.PHONY: all +all: $(TOOLS) + +$(TOOLS): | src/Makefile + $(MAKE) -w -C src ../bin/$(@F) + +.PHONY: clean +clean: | src/Makefile + $(MAKE) -w -C src clean diff --git a/sdk/common.mk b/sdk/common.mk index 19c3548..1fc1c5f 100644 --- a/sdk/common.mk +++ b/sdk/common.mk @@ -4,4 +4,12 @@ # * GNU/Linux # * Windows NT (using MinGW/MSYS/Cygwin/WSL) +ifndef ZXUNOSDK + ZXUNOSDK := $(patsubst %/,%,$(abspath $(dir $(lastword $(MAKEFILE_LIST))))) +PATH := $(ZXUNOSDK)/bin:$(PATH) + +export ZXUNOSDK +export PATH + +endif diff --git a/sdk/src/Makefile b/sdk/src/Makefile new file mode 100644 index 0000000..8f45159 --- /dev/null +++ b/sdk/src/Makefile @@ -0,0 +1,35 @@ +# Supported environments: +# * GNU/Linux +# * Windows NT (using MinGW/MSYS/Cygwin/WSL) + +include ../common.mk + +ifeq ($(OS),Windows_NT) +SJASMPLUS := sjasmplus.exe +else +SJASMPLUS := sjasmplus +endif + +.PHONY: all +all: \ + ../bin/$(SJASMPLUS) + +ifneq ($(OS),Windows_NT) +../bin/$(SJASMPLUS): sjasmplus/build/$(SJASMPLUS) + cp $< $@ + +sjasmplus/build/$(SJASMPLUS): | sjasmplus sjasmplus.mk + $(MAKE) -w -C sjasmplus -f ../sjasmplus.mk + +sjasmplus: + git clone https://github.com/sjasmplus/sjasmplus.git $@ +endif + +.PHONY: clean +ifeq ($(OS),Windows_NT) +clean:; +else +clean: | sjasmplus sjasmplus.mk + $(MAKE) -w -C sjasmplus -f ../sjasmplus.mk clean + rm -f ../bin/$(SJASMPLUS) +endif diff --git a/sdk/src/sjasmplus.mk b/sdk/src/sjasmplus.mk new file mode 100644 index 0000000..3d709a1 --- /dev/null +++ b/sdk/src/sjasmplus.mk @@ -0,0 +1,27 @@ +# Build: +# make -w -C sjasmplus -f ../sjasmplus.mk +# Clean: +# make -w -C sjasmplus -f ../sjasmplus.mk clean +# +# Supported environments: +# * GNU/Linux +# * Windows NT (using MinGW/MSYS/Cygwin/WSL) + +ifeq ($(OS),Windows_NT) +SJASMPLUS := sjasmplus.exe +else +SJASMPLUS := sjasmplus +endif + +build/$(SJASMPLUS): | build/Makefile + $(MAKE) -w -C build + +build/Makefile: | build + cd build && cmake .. + +build: + mkdir -p build + +.PHONY: clean +clean: | build/Makefile + $(MAKE) -w -C build clean