Merge pull request #107 from ivan-tat/master

software/joyconf: added `Makefile`
This commit is contained in:
Ivan Tatarinov 2021-06-09 22:23:43 +03:00 committed by GitHub
commit 86c7cd099a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 795 additions and 682 deletions

View File

@ -66,6 +66,10 @@
define FA_CREATE_AL %00001100 ; Create if not exists, else open and truncate
define FA_USE_HEADER %01000000 ; Use +3DOS header (passed in DE)
define SEEK_START 0
define SEEK_CUR 1
define SEEK_BKCUR 2
; Errors:
define EOK 1
define ENONSENSE 2

View File

@ -105,7 +105,7 @@ install-sdcc: | sdcc/.extracted
| sed -Ee 's,^(.+)/([^/]+),$$(DEST)$$(prefix)/\1/\2: \1/\2 | $$(DEST)$$(prefix)/\1\n\t$$(INSTALL) -m 644 $$< $$@,';\
fi;\
done; } >install.mk;\
$(MAKE) -w -f install.mk DEST=$(DEST) prefix=$(prefix) INSTALL=$(INSTALL) INSTALL_PROGRAM=$(INSTALL_PROGRAM) install
$(MAKE) -w -f install.mk DEST=$(DEST) prefix=$(shell realpath --relative-to=sdcc $(prefix)) INSTALL=$(INSTALL) INSTALL_PROGRAM=$(INSTALL_PROGRAM) install
ifeq ($(_DoClean),1)

View File

@ -30,6 +30,7 @@ SUBDIRS=\
dmaplayw\
esxdos\
esprst\
joyconf\
iwconfig
.PHONY: all

View File

@ -26,8 +26,7 @@ prefix ?= .
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/BIN
# Disable execution mode for FAT filesystem
INSTALL ?= install -m 644
INSTALL ?= install
INSTALL_PROGRAM ?= $(INSTALL)
RM = rm -f
@ -59,9 +58,10 @@ build/DMAPLAYW: $(srcdir)/dmaplayw.asm\
$(AS) $(AFLAGS) --raw=$@ $<
# $1 = target
# No need in execution mode for FAT filesystem
define install_bin_rule =
$$(DESTDIR)$$(bindir)/$1: build/$1 | $$(DESTDIR)$$(bindir)
$$(INSTALL_PROGRAM) $$< $$@
$$(INSTALL_PROGRAM) -m 644 $$< $$@
endef
$(foreach t,$(BINS),$(eval $(call install_bin_rule,$(t))))

View File

@ -96,7 +96,7 @@ Init call GetFileName ; results DE = buffer for OPEN
esxdos F_OPEN
ret c ; Return on error
ld (FHandle), a
ld l, 0 ; SEEK_START
ld l, SEEK_START
ld bc, 0
ld de, 44 ; Skip 44 bytes from start (WAV header)
esxdos F_SEEK

5
software/joyconf/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
#
# SPDX-License-Identifier: CC0-1.0
build

81
software/joyconf/Makefile Normal file
View File

@ -0,0 +1,81 @@
# SPDX-FileCopyrightText: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Supported environments:
# * GNU on Linux, FreeBSD etc.
# * GNU on Windows NT (using MinGW/MSYS/Cygwin/WSL)
#
# Build:
# make [<TARGET> ...]
# Install / Uninstall:
# make [prefix=<PREFIX>] install | uninstall
# Clean:
# make clean | distclean
#
# where:
# <TARGET> is one of values for `BINS' variable prefixed with "build/"
# (see target `all' below).
# <PREFIX> is a prefix directory to install files into.
include ../../sdk/common.mk
srcdir = .
# Use uppercase for FAT filesystem
prefix ?= .
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/BIN
INSTALL ?= install
INSTALL_PROGRAM ?= $(INSTALL)
RM = rm -f
BINS=\
JOYCONF
CC = sdcc
CFLAGS = -mz80 --reserve-regs-iy --opt-code-size --max-allocs-per-node 30000
ESXDOS_ORG = 8192
TMPS =
.PHONY: all
all: $(foreach t,$(BINS),build/$(t))
build\
$(DESTDIR)$(bindir):
mkdir -p $@
build/joyconf.ihx: $(srcdir)/joyconf.c | build
$(CC) $(CFLAGS) --nostdlib --nostdinc --no-std-crt0 --code-loc $(ESXDOS_ORG) -o $@ $<
TMPS += $(foreach s,ihx asm lk lst map noi rel sym,build/joyconf.$(s))
build/joyconf.bin: build/joyconf.ihx
makebin -p $< $@
TMPS += build/joyconf.bin
build/JOYCONF: build/joyconf.bin
dd if=$< of=$@ bs=1 skip=$(ESXDOS_ORG) status=noxfer
# $1 = target
# No need in execution mode for FAT filesystem
define install_bin_rule =
$$(DESTDIR)$$(bindir)/$1: build/$1 | $$(DESTDIR)$$(bindir)
$$(INSTALL_PROGRAM) -m 644 $$< $$@
endef
$(foreach t,$(BINS),$(eval $(call install_bin_rule,$(t))))
.PHONY: install
install: $(foreach t,$(BINS),$(DESTDIR)$(bindir)/$(t))
.PHONY: uninstall
uninstall:
$(RM) $(foreach t,$(BINS),$(DESTDIR)$(bindir)/$(t))
.PHONY: clean
clean:
rm -f $(TMPS) $(foreach t,$(BINS),build/$(t))
.PHONY: distclean
distclean:
rm -rf build

File diff suppressed because it is too large Load Diff