Skip to content

Commit

Permalink
Small doc update, don't build libmd-far for sgdk-legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
andwn committed Apr 28, 2021
1 parent a1891c3 commit 7cb575e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 27 deletions.
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
## Marsdev

Cross platform Mega Drive toolchain and Makefile abuse.
Cross platform Mega Drive / 32X toolchain and Makefile abuse.


## Installation & Usage

1. Download the latest release and extract it to your home directory (%USERPROFILE% in Windows)
* Make sure there is only one `mars` directory, not `mars/mars`

2. If you're just getting started, grab the `examples/sgdk-skeleton` sample and read the [SGDK Tutorials](https://github.com/Stephane-D/SGDK/wiki/Tuto-Introduction)
* For migrating existing projects, I am working on a guide but it is not ready yet, sorry

3. At this point, you should be able to run `make` your project folder to build a ROM (out.bin)
* Windows does not come with `make` and you will need to [install something like mingw](https://stackoverflow.com/questions/32127524/how-to-install-and-use-make-in-windows)


## How to Build

### Dependencies: Windows

* Install [MSYS2](http://www.msys2.org/) and follow the instructions on the site to update it
Expand Down Expand Up @@ -35,7 +49,7 @@ Cross platform Mega Drive toolchain and Makefile abuse.
* `flamewing-tools` requires GNU Autotools, Boost and C++14 support


## Compiling
### Compiling

Clone the repo and run `make`. Make sure you have 3-5GB free disk space.

Expand All @@ -49,9 +63,9 @@ Possible targets to install are:
* `m68k-gdb`: GNU debugger for M68000
* `sh-toolchain`: GNU toolchain for SH-2 (32X / Saturn)
* `sh-toolchain-newlib`: Same as `m68k-toolchain-newlib`, but for SH-2
* `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
* `z80-tools`: Z80 Assemblers (sjasm and z80asm)
* `sik-tools`: Sik's mdtools (mdtiler, converters for echo formats)
* `flamewing-tools`: Flamewing's mdcomp and mdtools, useful for ROM hacking
* `sgdk`: SGDK and its tools (rescomp, xgmtool, etc)
* Note: A specific version of SGDK can be specified like `SGDK_VER=<git tag>`
* `sgdk-legacy`: Shortcut for `sgdk SGDK_VER=v1.33`
Expand All @@ -72,7 +86,7 @@ that hassle -- one Makefile in your project that'll build your ROM on any host O

### Can I build a Gendev project with Marsdev or vice-versa?

If you're lucky, all you have to do is point GENDEV and MARSDEV to the same place.
In theory you would only have to set GENDEV and MARSDEV to the same place, but every project is different.


### How do I use this with my favorite IDE?
Expand All @@ -86,13 +100,13 @@ In general the only thing you should NEED to do, is point it to the headers.

If your IDE lets you configure what the build/run buttons do, just have it run something like this.

* Build: `MARSDEV=/path/to/mars make`
* Build: `make MARSDEV=/path/to/mars`
* Run: `/path/to/an/emulator out.bin`


### This takes so long to compile!

GCC is a very large lad. We just have to deal with it.
If I could make it shorter I would, but GCC is a very large lad. We just have to deal with it.


## Examples
Expand Down
23 changes: 14 additions & 9 deletions sgdk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ all: SGDK tools libmd

tools: $(BINTOS) $(RESCOMP) $(XGMTOOL) $(XGMROOMBUILDER) $(WAVTORAW) $(PCMTORAW) $(SIZEBND) $(LZ4W) $(APJ)

# OSX sed fails without the '', and GNU fails with, cool beans
# OSX sed fails without the '', and GNU fails with, coolbeans
SED_FIX=
ifeq ($(shell uname -s),Darwin)
SED_FIX=''
Expand All @@ -39,14 +39,16 @@ libmd:
make -C SGDK clean
make -C SGDK debug
cp -f SGDK/libmd-debug.a $(MARSDEV)/m68k-elf/lib/libmd-debug.a
# Banks switching enabled version for release + debug
cp -f config-bankswitch.h SGDK/inc/config.h
make -C SGDK clean
make -C SGDK
cp -f SGDK/libmd.a $(MARSDEV)/m68k-elf/lib/libmd-far.a
make -C SGDK clean
make -C SGDK debug
cp -f SGDK/libmd-debug.a $(MARSDEV)/m68k-elf/lib/libmd-far-debug.a
# Bank switching enabled version for release + debug (1.60+)
if [ -f "SGDK/bin/apj.jar" ]; then \
cp -f config-bankswitch.h SGDK/inc/config.h ;\
make -C SGDK clean ;\
make -C SGDK ;\
cp -f SGDK/libmd.a $(MARSDEV)/m68k-elf/lib/libmd-far.a ;\
make -C SGDK clean ;\
make -C SGDK debug ;\
cp -f SGDK/libmd-debug.a $(MARSDEV)/m68k-elf/lib/libmd-far-debug.a ;\
fi
# Copy headers
cp -f SGDK/inc/*.h $(MARSDEV)/m68k-elf/include/
cp -f SGDK/res/*.h $(MARSDEV)/m68k-elf/include/
Expand Down Expand Up @@ -95,5 +97,8 @@ $(APJ):
cp -f SGDK/bin/apj.jar $@ ; \
fi

$(TOOLSBIN):
mkdir -p $(TOOLSBIN)

clean:
rm -rf SGDK
18 changes: 8 additions & 10 deletions z80-tools/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MARSBIN = $(MARSDEV)/bin
TOOLSBIN = $(MARSDEV)/bin

SJASM = $(MARSBIN)/sjasm
Z80ASM = $(MARSBIN)/z80asm
SJASM = $(TOOLSBIN)/sjasm
Z80ASM = $(TOOLSBIN)/z80asm

Z80REV = 99b216126b0879c78c157f547475c6ba28583d4a
SJBRANCH = v0.39
Expand All @@ -15,7 +15,7 @@ else
endif
endif

# OSX sed fails without the '', and GNU fails with, cool beans
# OSX sed fails without the '', and GNU fails with, coolbeans
SED_FIX=
ifeq ($(shell uname -s),Darwin)
SED_FIX=''
Expand All @@ -25,15 +25,13 @@ endif

all: $(SJASM) $(Z80ASM)

$(SJASM): $(MARSBIN)
$(SJASM): $(TOOLSBIN)
rm -rf sjasm
git clone https://github.com/konamiman/sjasm --branch $(SJBRANCH)
# There's mismatching caps in the Makefile for sjasm
#mv sjasm/Sjasm/Sjasm.cpp sjasm/Sjasm/sjasm.cpp
cd sjasm/Sjasm && make
cp -f sjasm/Sjasm/sjasm $(SJASM)

$(Z80ASM): $(MARSBIN)
$(Z80ASM): $(TOOLSBIN)
rm -rf z80asm
git clone https://git.savannah.nongnu.org/git/z80asm.git
cd z80asm && git checkout $(Z80REV) && autoreconf -f -i && ./configure
Expand All @@ -44,8 +42,8 @@ $(Z80ASM): $(MARSBIN)
make -C z80asm
cp -f z80asm/src/z80asm $(Z80ASM)

$(MARSBIN):
mkdir -p $(MARSBIN)
$(TOOLSBIN):
mkdir -p $(TOOLSBIN)

clean:
rm -rf sjasm z80asm

0 comments on commit 7cb575e

Please sign in to comment.