1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

Replace shell code with GNU Make conditionals and functions

Use `ifeq` to provide two rules for the `avail` target: one that reports
an error if any of the symlink targets are missing and one that installs
the symlinks for the targets if they're all present.
This commit is contained in:
compyx 2023-02-19 19:17:45 +01:00
parent 5c12659cf4
commit 68ce335f59

View File

@ -110,22 +110,16 @@ $(RM) /usr/local/bin/$(prog)
endef # UNAVAIL_recipe
define AVAIL_check_prog
@if [ ! -e ../bin/$(prog) ]; then \
echo "failed to locate $(prog), please run make first"; \
false; \
fi
endef # AVAIL_check_prog
install:
$(INSTALL) -d $(DESTDIR)$(bindir)
$(INSTALL) ../bin/* $(DESTDIR)$(bindir)
avail:
$(foreach prog,$(PROGS),$(AVAIL_check_prog))
ifneq ($(patsubst %,../bin/%,$(PROGS)),$(wildcard $(patsubst %,../bin/%,$(PROGS))))
$(error executables are missing, please run make first)
else
$(foreach prog,$(PROGS),$(AVAIL_recipe))
endif
unavail:
$(foreach prog,$(PROGS),$(UNAVAIL_recipe))