sdk: followed GNU standards in `src/zx7b/Makefile`

This commit is contained in:
Ivan Tatarinov 2021-04-26 13:00:02 +03:00
parent d1bea27d1b
commit 5b4d96a16f
3 changed files with 49 additions and 22 deletions

View File

@ -220,30 +220,30 @@ dist-clean-z88dk:
# zx7b
.PHONY: local-zx7b clean-zx7b
local-zx7b: $(INSTALLDIR)/zx7b$(EXESUFFIX)
.PHONY: local-zx7b clean-zx7b distclean-zx7b
ifeq ($(_DoBuild),1)
$(INSTALLDIR)/zx7b$(EXESUFFIX): zx7b/zx7b$(EXESUFFIX)
cp $< $@
zx7b/zx7b$(EXESUFFIX): | zx7b
$(MAKE) -w -C $|
local-zx7b: | zx7b
$(MAKE) -w -C $| prefix=../.. install
clean-zx7b: | zx7b
$(MAKE) -w -C $| clean
rm -f $(INSTALLDIR)/zx7b$(EXESUFFIX)
$(MAKE) -w -C $| prefix=../.. uninstall
distclean-zx7b: | zx7b
$(MAKE) -w -C $| distclean
$(MAKE) -w -C $| prefix=../.. uninstall
else
local-zx7b:;
clean-zx7b:;
endif
distclean-zx7b:;
.PHONY: dist-clean-zx7b
dist-clean-zx7b: clean-zx7b
endif
# tools
@ -281,7 +281,7 @@ endif
.PHONY: dist-clean
ifeq ($(_DoClean),1)
dist-clean: dist-clean-sjasmplus dist-clean-z88dk dist-clean-zx7b distclean-tools
dist-clean: dist-clean-sjasmplus dist-clean-z88dk distclean-zx7b distclean-tools
else
dist-clean: dist-clean-sjasmplus dist-clean-z88dk
endif

View File

@ -2,5 +2,4 @@
#
# SPDX-License-Identifier: CC0-1.0
zx7b
zx7b.exe
build

View File

@ -7,27 +7,55 @@
# * GNU on Windows NT (using MinGW/MSYS/Cygwin/WSL)
#
# Build:
# make [BUILD=<BUILD>] [<TARGET>]
# make [BUILD=<BUILD>] [<TARGET> ...]
# Install / Uninstall:
# make [BUILD=<BUILD>] [prefix=<PREFIX>] install | uninstall
# Clean:
# make [BUILD=<BUILD>] clean
# make distclean
#
# where:
# <BUILD> is one of: mingw32, mingw64.
# <TARGET> is the value of TARGET variable (see below).
# <TARGET> is one of values for `BINS' variable prefixed with "build/"
# (see target `all' below).
# <PREFIX> is a prefix directory to install files into.
#
# Notes:
# BUILD variable may be set in user's environment.
# `BUILD', `prefix' variables may be set in user's environment.
include ../../common.mk
TARGET := zx7b$(EXESUFFIX)
srcdir = .
prefix ?= /usr/local
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/bin
BINS = zx7b$(EXESUFFIX)
.PHONY: all
all: $(TARGET)
all: $(foreach t,$(BINS),build/$(t))
%$(EXESUFFIX): %.c Makefile
build\
$(DESTDIR)$(bindir):
mkdir -p $@
build/zx7b$(EXESUFFIX): $(srcdir)/zx7b.c Makefile | build
$(CC) $(CFLAGS) -o $@ $<
.PHONY: install
install: $(foreach t,$(BINS),$(DESTDIR)$(bindir)/$(t))
$(DESTDIR)$(bindir)/zx7b$(EXESUFFIX): build/zx7b$(EXESUFFIX) | $(DESTDIR)$(bindir)
cp $< $@
.PHONY: uninstall
uninstall:
rm -f $(foreach t,$(BINS),$(DESTDIR)$(exec_prefix)/bin/$(t))
.PHONY: clean
clean:
rm -f $(TARGET)
rm -f $(foreach t,$(BINS),build/$(t))
.PHONY: distclean
distclean:
rm -rf build/*