Skip to content

Commit

Permalink
Rearranged some things, added Flamewing mdcomp/mdtools
Browse files Browse the repository at this point in the history
  • Loading branch information
andwn committed Sep 10, 2017
1 parent eceda28 commit 1d87602
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 93 deletions.
24 changes: 18 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,16 +18,22 @@ 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


.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
Expand All @@ -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
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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.


Expand Down
26 changes: 26 additions & 0 deletions flamewing-tools/Makefile
Original file line number Diff line number Diff line change
@@ -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
45 changes: 45 additions & 0 deletions sik-tools/Makefile
Original file line number Diff line number Diff line change
@@ -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
7 changes: 6 additions & 1 deletion toolchain/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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)
File renamed without changes.
File renamed without changes.
File renamed without changes.
76 changes: 0 additions & 76 deletions tools/Makefile

This file was deleted.

29 changes: 29 additions & 0 deletions z80-tools/Makefile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1d87602

Please sign in to comment.