diff options
author | B. Watson <urchlay@slackware.uk> | 2022-08-29 16:11:13 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2022-08-29 16:11:13 -0400 |
commit | e2ba8458a5cfdfacfaf103e7ba97d610afa6c970 (patch) | |
tree | cd665e602e6e2b636578a7d3d7894380605dafcc /Makefile | |
download | bw-atari8-tools-e2ba8458a5cfdfacfaf103e7ba97d610afa6c970.tar.gz |
initial commit
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 166 |
1 files changed, 166 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..82b4afc --- /dev/null +++ b/Makefile @@ -0,0 +1,166 @@ + +# Install paths. DESTDIR is used for installing to an alternate location, +# for people making RPM/deb/tgz/etc packages. +DESTDIR= +PREFIX=/usr/local +BINDIR=$(PREFIX)/bin +MANDIR=$(PREFIX)/share/man +MAN1DIR=$(MANDIR)/man1 +DOCDIR=$(PREFIX)/share/doc/bw-atari8-tools + +# Compiler stuff +CC=gcc +CFLAGS=-Wall -O2 -ansi -D_GNU_SOURCE -DVERSION=\"$(VERSION)\" + +# BINS and SCRIPTS go in $BINDIR, DOCS go in $DOCDIR +BINS=a8eol xfd2atr atr2xfd blob2c cart2xex fenders xexsplit xexcat atrsize rom2cart unmac65 axe +SCRIPTS=dasm2atasm a8utf8 +MANS=a8eol.1 xfd2atr.1 atr2xfd.1 blob2c.1 cart2xex.1 fenders.1 xexsplit.1 xexcat.1 atrsize.1 rom2cart.1 unmac65.1 axe.1 dasm2atasm.1 a8utf8.1 +DOCS=README equates.inc *.dasm + +# All the programs share this version number... +VERSION=0.2.1 + +# If your system doesn't support gzipped man pages, comment this out: +GZIP_MAN=y + +# unmac65 can be built for Atari 8-bit. Don't do it by default, but +# these variables are used for cross-compiling: +CC65=cl65 +CC65FLAGS=-O -t atari + +# Some distros have this with a .py extension, some don't. Only needed +# if you're rebuilding the man pages (users shouldn't have to). +# RST2MAN=rst2man.py +RST2MAN=rst2man + +# Targets below. You probably don't need to edit below this point. +# WARNING: Don't do a "make realclean" unless you have the DASM or +# Atasm 6502 cross assembler installed! +# "make clean" and "make distclean" will not delete the 6502 object +# code (the *.bin files), but "make realclean" will. + +all: $(BINS) manpages + +a8eol: a8eol.c + $(CC) $(CFLAGS) -o a8eol a8eol.c + +xfd2atr: xfd2atr.c + $(CC) $(CFLAGS) -o xfd2atr xfd2atr.c + +atr2xfd: atr2xfd.c + $(CC) $(CFLAGS) -o atr2xfd atr2xfd.c + +# note to cross-compiler users: If you're building the *.bin targets, +# blob2c needs to be executable on the build host. It'd also be nice +# to build a blob2c for the target platform... Probably you can do +# something like this: + +# make blob2c CC=/usr/bin/cc # build host blob2c +# make CC=/path/to/cross/cc # build everything else (uses blob2c) +# rm -f blob2c # get rid of host blob2c so we can... +# make blob2c CC=/path/to/cross/cc # build the target system's blob2c +# make install DESTDIR=/tmp/whatever... + +# Note that this is only needed if you're building the 6502 object code, +# which you don't need to do unless you've modified it (the distribution +# tarball comes with prebuilt *.bin files). + +blob2c: blob2c.c + $(CC) $(CFLAGS) -o blob2c blob2c.c + +fenders.bin: fenders.dasm asmwrapper.sh + sh asmwrapper.sh fenders + +fenders_bin.c: fenders.bin blob2c + ./blob2c fenders.bin > fenders_bin.c 2>fenders_bin.h + +fenders_offsets.h: fenders.bin fenders_offsets.pl + perl fenders_offsets.pl < fenders.syms > fenders_offsets.h + +fenders: fenders.c fenders_bin.c fenders_bin.h fenders_offsets.h \ + fendersdbl_bin.c fendersdbl_bin.h fendersdbl_offsets.h + $(CC) $(CFLAGS) -o fenders fenders.c fenders_bin.c fendersdbl_bin.c + +fendersdbl.bin: fendersdbl.dasm asmwrapper.sh + sh asmwrapper.sh fendersdbl + +fendersdbl_bin.c: fendersdbl.bin blob2c + ./blob2c fendersdbl.bin > fendersdbl_bin.c 2>fendersdbl_bin.h + +fendersdbl_offsets.h: fendersdbl.bin fenders_offsets.pl + perl fenders_offsets.pl < fendersdbl.syms > fendersdbl_offsets.h + +loadscreen.bin: loadscreen.dasm asmwrapper.sh + sh asmwrapper.sh loadscreen + +loadscreen_bin.c: loadscreen.bin blob2c + ./blob2c loadscreen.bin > loadscreen_bin.c 2>loadscreen_bin.h + +cart2xex: cart2xex.c loadscreen_bin.c get_address.o cart.o + $(CC) $(CFLAGS) -o cart2xex cart2xex.c loadscreen_bin.c get_address.o cart.o + +rom2cart: rom2cart.c cart.o + $(CC) $(CFLAGS) -o rom2cart rom2cart.c cart.o + +cart.o: cart.c cart.h + $(CC) $(CFLAGS) -c cart.c + +get_address.o: get_address.c get_address.h + $(CC) $(CFLAGS) -c get_address.c + +xex.o: xex.c xex.h + $(CC) $(CFLAGS) -c xex.c + +xextest: xextest.c xex.o + $(CC) $(CFLAGS) -o xextest xextest.c xex.o + +xexsplit: xexsplit.c xex.o + $(CC) $(CFLAGS) -o xexsplit xexsplit.c xex.o + +xexcat: xexcat.c xex.o get_address.o + $(CC) $(CFLAGS) -o xexcat xexcat.c xex.o get_address.o + +unmac65.xex: unmac65.c + @rm -f unmac65.o + $(CC65) $(CC65FLAGS) -DVERSION=\"$(VERSION)\" -DTAG=\"$(TAG)\" -t atari -o unmac65.xex unmac65.c + @rm -f unmac65.o + +axe: axe.c axe.h axelib.c + +manpages: $(MANS) + +%.1: %.rst + $(RST2MAN) $< > $@ + +# "make clean" does NOT remove the .bin or _bin.[ch] files. This is +# for people who don't have either dasm or atasm installed. +# also, it doesn't remove the man pages. these are checked into git, even. +clean: + rm -f core *.o *~ $(BINS) + +distclean: clean + rm -rf *.syms *.atr 1 2 3 *.xex *.rom *.atasm *.m65 atrcheck cart2rom + +realclean: distclean + rm -f *.bin *_bin.[ch] *_offsets.h *.1 + +install: all + mkdir -p $(DESTDIR)/$(BINDIR) $(DESTDIR)/$(MAN1DIR) $(DESTDIR)/$(DOCDIR) + strip $(BINS) + for i in $(BINS) $(SCRIPTS) ; do \ + install -m0755 -oroot -groot $$i $(DESTDIR)/$(BINDIR) ; \ + install -m0644 -oroot -groot $$i.1 $(DESTDIR)/$(MAN1DIR) ; \ + if [ "$(GZIP_MAN)" = "y" ]; then \ + gzip $(DESTDIR)/$(MAN1DIR)/$$i.1 ; \ + fi ; \ + done + ( cd $(DESTDIR)/$(BINDIR) && rm -f atrcheck && ln -s atr2xfd atrcheck ) + ( cd $(DESTDIR)/$(BINDIR) && rm -f cart2rom && ln -s rom2cart cart2rom ) + if [ "$(GZIP_MAN)" = "y" ]; then \ + cd $(DESTDIR)/$(MAN1DIR) && rm -f atrcheck.1.gz && ln -s atr2xfd.1.gz atrcheck.1.gz ; \ + cd $(DESTDIR)/$(MAN1DIR) && rm -f cart2rom.1.gz && ln -s rom2cart.1.gz cart2rom.1.gz ; \ + else \ + cd $(DESTDIR)/$(MAN1DIR) && rm -f cart2rom.1 && ln -s rom2cart.1 cart2rom.1 ; \ + fi + install -m0644 -oroot -groot $(DOCS) $(DESTDIR)/$(DOCDIR) |