From 1d8760245b830bad103f9388d95ecf493c33cfc8 Mon Sep 17 00:00:00 2001 From: Grind Date: Sun, 10 Sep 2017 18:44:14 -0400 Subject: [PATCH] Rearranged some things, added Flamewing mdcomp/mdtools --- Makefile | 24 ++++++-- README.md | 17 +++--- flamewing-tools/Makefile | 26 +++++++++ sik-tools/Makefile | 45 +++++++++++++++ toolchain/Makefile | 7 ++- {tools => toolchain}/ldscripts/mars.ld | 0 {tools => toolchain}/ldscripts/md.ld | 0 {tools => toolchain}/ldscripts/sgdk.ld | 0 tools/Makefile | 76 -------------------------- z80-tools/Makefile | 29 ++++++++++ 10 files changed, 131 insertions(+), 93 deletions(-) create mode 100644 flamewing-tools/Makefile create mode 100644 sik-tools/Makefile rename {tools => toolchain}/ldscripts/mars.ld (100%) rename {tools => toolchain}/ldscripts/md.ld (100%) rename {tools => toolchain}/ldscripts/sgdk.ld (100%) delete mode 100644 tools/Makefile create mode 100644 z80-tools/Makefile diff --git a/Makefile b/Makefile index ba38bcf..474ac02 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,13 @@ export MARSDEV ?= ${HOME}/mars +.PHONY: all m68k-toolchain m68k-gdb sh-toolchain +.PHONY: tools z80-tools sik-tools flamewing-tools sgdk -.PHONY: all m68k-toolchain m68k-gdb sh-toolchain tools sgdk +# Default everything except SH toolchain +all: m68k-toolchain tools sgdk -all: m68k-toolchain tools +# Everyone's tools +tools: z80-tools sik-tools flamewing-tools m68k-toolchain: make -C toolchain ARCH=m68k @@ -14,8 +18,14 @@ m68k-gdb: sh-toolchain: make -C toolchain ARCH=sh -tools: - make -C tools +z80-tools: + make -C z80-tools + +sik-tools: + make -C sik-tools + +flamewing-tools: + make -C flamewing-tools sgdk: make -C sgdk @@ -23,7 +33,7 @@ sgdk: .PHONY: clean toolchain-clean gdb-clean tools-clean sgdk-clean -clean: toolchain-clean tools-clean +clean: toolchain-clean tools-clean sgdk-clean toolchain-clean: make -C toolchain clean @@ -32,7 +42,9 @@ gdb-clean: make -C gdb clean tools-clean: - make -C tools clean + make -C z80-tools clean + make -C sik-tools clean + make -C flamewing-tools clean sgdk-clean: make -C sgdk clean diff --git a/README.md b/README.md index 2dcf8f3..1936159 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,12 @@ You probably shouldn't try using this for 32X dev, I don't have any examples yet and am still learning how that thing works. -### Install this stuff first +### Install this stuff first (Debian package names) - * Native GNU toolchain: `build-essential` on Debian/Ubuntu + * Native GNU toolchain: `build-essential` (GCC >= 5.1.0) * GNU Autotools: `libtool` `autoconf` `automake` `autopoint` `gettext` - * Everything else: `wget` `texinfo` `libpng16-dev` - * And if you want SGDK, Java + * Everything else: `wget` `texinfo` `libpng-dev` (libpng == 1.6) + * And for SGDK's lz4w compression, `openjdk-8-jre-headless` (Java >= 6) ### Compiling @@ -21,7 +21,9 @@ Possible targets to install are: * `m68k-toolchain`: GNU toolchain for Motorola 68000 (MegaDrive) * `m68k-gdb`: GNU debugger for M68000 * `sh-toolchain`: GNU toolchain for SH-2 (32X / Saturn) - * `tools`: A couple Z80 assemblers and various tools I find useful + * `z80-tools`: Z80 Assemblers (just sjasm right now, z80asm is having issues building) + * `sik-tools`: Sik's mdtools + * `flamewing-tools`: Flamewing's mdtools, useful for ROM hacking * `sgdk`: SGDK and its tools (rescomp, xgmtool, etc) By default, only the `m68k-toolchain` and `tools` targets are built. @@ -35,11 +37,6 @@ like this: `make MARSDEV=/where/to/install`. The `examples` directory contains various skeleton/example projects to base others on. For more information on each read [examples/README.md](examples/README.md). -Naming convention: - * `md-`: Bare metal MegaDrive project, requires `m68k-toolchain` and `tools` - * `sgdk-`: SGDK MegaDrive project, requires `m68k-toolchain`, `tools`, and `sgdk` - * `mars-`: 32X project, requires `m68k-toolchain`, `sh-toolchain`, and `tools` - Should be as easy as a `make` for any of them. diff --git a/flamewing-tools/Makefile b/flamewing-tools/Makefile new file mode 100644 index 0000000..351a580 --- /dev/null +++ b/flamewing-tools/Makefile @@ -0,0 +1,26 @@ +MARSBIN = $(MARSDEV)/bin +MARSINC = $(MARSDEV)/include +MARSLIB = $(MARSDEV)/lib + +all: clean $(MARSINC) $(MARSLIB) + # mdtools depends on mdcomp, install that first + git clone https://github.com/flamewing/mdcomp + cd mdcomp && ./autogen.sh "--prefix=$(MARSDEV)" \ + && make install + git clone https://github.com/flamewing/mdtools + cd mdtools && ./autogen.sh "--prefix=$(MARSDEV)" \ + "CPPFLAGS=-I$(MARSINC) -L$(MARSLIB)" "LDFLAGS=-L$(MARSLIB)" \ + && make install + +$(MARSBIN): + mkdir -p $(MARSBIN) + +$(MARSINC): + mkdir -p $(MARSINC) + +$(MARSLIB): + mkdir -p $(MARSLIB) + +clean: + rm -rf mdtools + rm -rf mdcomp diff --git a/sik-tools/Makefile b/sik-tools/Makefile new file mode 100644 index 0000000..5190b8b --- /dev/null +++ b/sik-tools/Makefile @@ -0,0 +1,45 @@ +MARSBIN = $(MARSDEV)/bin + +MDTILER = $(MARSBIN)/mdtiler +SLZ = $(MARSBIN)/slz +UFTC = $(MARSBIN)/uftc +MML2ESF = $(MARSBIN)/mml2esf +PCM2EWF = $(MARSBIN)/pcm2ewf +TFI2EIF = $(MARSBIN)/tfi2eif + +.PHONY: all clean + +all: $(MDTILER) $(SLZ) $(UFTC) $(MML2ESF) $(PCM2EWF) $(TFI2EIF) + +mdtools: + git clone https://github.com/sikthehedgehog/mdtools + +$(MDTILER): mdtools $(MARSBIN) + make -C mdtools/mdtiler/tool + cp -f mdtools/mdtiler/tool/mdtiler $(MDTILER) + +$(SLZ): mdtools $(MARSBIN) + make -C mdtools/slz/tool + cp -f mdtools/slz/tool/slz $(SLZ) + +$(UFTC): mdtools $(MARSBIN) + make -C mdtools/uftc/tool + cp -f mdtools/uftc/tool/uftc $(UFTC) + +$(MML2ESF): mdtools $(MARSBIN) + make -C mdtools/mml2esf/tool + cp -f mdtools/mml2esf/tool/mml2esf $(MML2ESF) + +$(PCM2EWF): mdtools $(MARSBIN) + make -C mdtools/pcm2ewf/tool + cp -f mdtools/pcm2ewf/tool/pcm2ewf $(PCM2EWF) + +$(TFI2EIF): mdtools $(MARSBIN) + make -C mdtools/tfi2eif/tool + cp -f mdtools/tfi2eif/tool/tfi2eif $(TFI2EIF) + +$(MARSBIN): + mkdir -p $(MARSBIN) + +clean: + rm -rf mdtools diff --git a/toolchain/Makefile b/toolchain/Makefile index 5eeae3a..62d1352 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -7,6 +7,8 @@ BINUTILS_DIR = binutils-$(BINUTILS_VER) GCC_PKG = $(GCC_DIR).tar.gz BINUTILS_PKG = $(BINUTILS_DIR).tar.gz +LDSCRIPTS = $(MARSDEV)/ldscripts + TARGET = $(ARCH)-elf PREFIX = $(MARSDEV)/$(TARGET) PATH := $(PREFIX)/bin:$(PATH) @@ -24,7 +26,7 @@ endif .PHONY: all binutils gcc clean -all: $(BINUTILS_DIR) $(GCC_DIR) binutils gcc +all: $(BINUTILS_DIR) $(GCC_DIR) binutils gcc $(LDSCRIPTS) binutils: BUILD_DIR=$(BINUTILS_DIR)/build binutils: @@ -68,6 +70,9 @@ $(BINUTILS_PKG): $(GCC_PKG): @wget https://mirrors.tripadvisor.com/gnu/gcc/gcc-$(GCC_VER)/$(GCC_PKG) +$(LDSCRIPTS): + cp -rf ldscripts/ $(LDSCRIPTS) + clean: rm -rf $(GCC_DIR) rm -rf $(BINUTILS_DIR) diff --git a/tools/ldscripts/mars.ld b/toolchain/ldscripts/mars.ld similarity index 100% rename from tools/ldscripts/mars.ld rename to toolchain/ldscripts/mars.ld diff --git a/tools/ldscripts/md.ld b/toolchain/ldscripts/md.ld similarity index 100% rename from tools/ldscripts/md.ld rename to toolchain/ldscripts/md.ld diff --git a/tools/ldscripts/sgdk.ld b/toolchain/ldscripts/sgdk.ld similarity index 100% rename from tools/ldscripts/sgdk.ld rename to toolchain/ldscripts/sgdk.ld diff --git a/tools/Makefile b/tools/Makefile deleted file mode 100644 index a68b8a1..0000000 --- a/tools/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -MARSBIN = $(MARSDEV)/bin - -SJASM = $(MARSBIN)/sjasm -Z80ASM = $(MARSBIN)/z80asm - -MDTILER = $(MARSBIN)/mdtiler -SLZ = $(MARSBIN)/slz -UFTC = $(MARSBIN)/uftc -MML2ESF = $(MARSBIN)/mml2esf -PCM2EWF = $(MARSBIN)/pcm2ewf -TFI2EIF = $(MARSBIN)/tfi2eif - -LDSCRIPTS = $(MARSDEV)/ldscripts - -.PHONY: all mdtools-build clean - -all: $(MARSBIN) $(SJASM) $(Z80ASM) $(LDSCRIPTS) mdtools-build - -mdtools-build: $(MDTILER) $(SLZ) $(UFTC) $(MML2ESF) $(PCM2EWF) $(TFI2EIF) - -$(MARSBIN): - mkdir -p $(MARSBIN) - -# Z80 Assemblers - -$(SJASM): - rm -rf sjasm - git clone https://github.com/konamiman/sjasm --branch v0.39 --single-branch - # Are you fucking kidding me - mv sjasm/Sjasm/Sjasm.cpp sjasm/Sjasm/sjasm.cpp - cd sjasm/Sjasm && make -f ../Makefile - cp -f sjasm/Sjasm/sjasm $(SJASM) - -$(Z80ASM): - rm -rf z80asm - git clone https://git.savannah.nongnu.org/git/z80asm.git - cd z80asm && autoreconf -f -i && ./configure && make - cp -f z80asm/src/z80asm $(Z80ASM) - -# mdtools - -mdtools: - git clone https://github.com/sikthehedgehog/mdtools - -$(MDTILER): mdtools - make -C mdtools/mdtiler/tool - cp -f mdtools/mdtiler/tool/mdtiler $(MDTILER) - -$(SLZ): mdtools - make -C mdtools/slz/tool - cp -f mdtools/slz/tool/slz $(SLZ) - -$(UFTC): mdtools - make -C mdtools/uftc/tool - cp -f mdtools/uftc/tool/uftc $(UFTC) - -$(MML2ESF): mdtools - make -C mdtools/mml2esf/tool - cp -f mdtools/mml2esf/tool/mml2esf $(MML2ESF) - -$(PCM2EWF): mdtools - make -C mdtools/pcm2ewf/tool - cp -f mdtools/pcm2ewf/tool/pcm2ewf $(PCM2EWF) - -$(TFI2EIF): mdtools - make -C mdtools/tfi2eif/tool - cp -f mdtools/tfi2eif/tool/tfi2eif $(TFI2EIF) - -# ldfiles - -$(LDSCRIPTS): - cp -rf ldscripts/ $(LDSCRIPTS) - - -clean: - rm -rf sjasm z80asm mdtools diff --git a/z80-tools/Makefile b/z80-tools/Makefile new file mode 100644 index 0000000..844350c --- /dev/null +++ b/z80-tools/Makefile @@ -0,0 +1,29 @@ +MARSBIN = $(MARSDEV)/bin + +SJASM = $(MARSBIN)/sjasm +Z80ASM = $(MARSBIN)/z80asm + +.PHONY: all clean + +all: $(SJASM) +#$(Z80ASM) + +$(SJASM): $(MARSBIN) + rm -rf sjasm + git clone https://github.com/konamiman/sjasm --branch v0.39 --single-branch + # Are you fucking kidding me + mv sjasm/Sjasm/Sjasm.cpp sjasm/Sjasm/sjasm.cpp + cd sjasm/Sjasm && make -f ../Makefile + cp -f sjasm/Sjasm/sjasm $(SJASM) + +$(Z80ASM): $(MARSBIN) + rm -rf z80asm + git clone https://git.savannah.nongnu.org/git/z80asm.git + cd z80asm && autoreconf -f -i && ./configure && make + cp -f z80asm/src/z80asm $(Z80ASM) + +$(MARSBIN): + mkdir -p $(MARSBIN) + +clean: + rm -rf sjasm z80asm