Install targets

This commit is contained in:
Mattia Basaglia 2014-12-21 19:07:25 +01:00
parent 203a843b0a
commit de1fbf6c5d
21 changed files with 33 additions and 5 deletions

View file

@ -1,3 +1,7 @@
PREFIX?=/usr/local
DATAROOT=$(PREFIX)/share
DATADIR=$(DATAROOT)/ascii-pony
BINDIR=$(PREFIX)/bin
MAKEFILE=$(lastword $(MAKEFILE_LIST)) MAKEFILE=$(lastword $(MAKEFILE_LIST))
MAKEFILE_DIR=$(dir $(MAKEFILE)) MAKEFILE_DIR=$(dir $(MAKEFILE))
@ -15,8 +19,15 @@ OUT_ALL= $(OUT_COLOR) $(OUT_PLAIN) $(OUT_SVG) $(OUT_PNG) $(OUT_BASH) $(OUT_COLOR
OUT_DIRS=$(sort $(dir $(OUT_ALL))) OUT_DIRS=$(sort $(dir $(OUT_ALL)))
find_deps=$(subst ;,\\\;,$(wildcard $(PONY_DIR)/$(1)/*)) find_deps=$(subst ;,\\\;,$(wildcard $(PONY_DIR)/$(1)/*))
INSTALL_DIR=cp -rf
INSTALL_FILE=cp -f
UNINSTALL_DIR=rm -rf
UNINSTALL_FILE=rm -f
REMOVE_DIR=$(foreach d, $(1), [ -d $(d) ] && rmdir $(d) || true;)
MAKE_DIR=mkdir -p
# NOTE: not .PONY :-P # NOTE: not .PONY :-P
.PHONY: all show show_deps clean list random .PHONY: all show show_deps clean list random install uninstall
all: $(OUT_ALL) all: $(OUT_ALL)
@ -63,7 +74,7 @@ $(1) : $(OUT_DIR)/png/$(1).png
endef endef
define dir_rule_template define dir_rule_template
$(1) : $(1) :
mkdir -p $(1) $(MAKE_DIR) $(1)
endef endef
$(foreach pony,$(PONIES),$(eval $(call rule_template,$(pony)))) $(foreach pony,$(PONIES),$(eval $(call rule_template,$(pony))))
@ -76,8 +87,8 @@ show_deps:
@$(foreach d,$(call find_deps,$(PONY)), echo $(d);) @$(foreach d,$(call find_deps,$(PONY)), echo $(d);)
clean: clean:
rm -f $(OUT_ALL) $(REMOVE_FILE) $(OUT_ALL)
rmdir --ignore-fail-on-non-empty $(OUT_DIRS) $(OUT_DIR) $(call REMOVE_DIR, $(OUT_DIRS) $(OUT_DIR))
list: list:
@$(foreach pony,$(PONIES), echo $(pony);) @$(foreach pony,$(PONIES), echo $(pony);)
@ -85,3 +96,20 @@ list:
random: PONY=$(shell make -f $(MAKEFILE) list | shuf | head -n 1) random: PONY=$(shell make -f $(MAKEFILE) list | shuf | head -n 1)
random: random:
@make --no-print-directory -f $(MAKEFILE) show PONY=$(PONY) @make --no-print-directory -f $(MAKEFILE) show PONY=$(PONY)
$(DATADIR):
$(MAKE_DIR) $(DATADIR)
$(BINDIR):
$(MAKE_DIR) $(BINDIR)
install: $(OUT_ALL)
install: $(DATADIR)
install: $(BINDIR)
$(INSTALL_DIR) $(MAKEFILE_DIR)rendered $(DATADIR)
$(INSTALL_FILE) $(MAKEFILE_DIR)systempony $(BINDIR)
uninstall:
$(UNINSTALL_DIR) $(DATADIR)
$(UNINSTALL_FILE) $(BINDIR)/systempony
$(call REMOVE_DIR, $(DATADIR) $(DATAROOT) $(BINDIR))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -193,7 +193,7 @@ done
SELFDIR=$(dirname $(readlink -se "${BASH_SOURCE[0]}")) SELFDIR=$(dirname $(readlink -se "${BASH_SOURCE[0]}"))
ponydir="$SELFDIR/rendered/ansi/" ponydir="$SELFDIR/rendered/ansi/"
[ ! -d "$ponydir" ] && ponydir="$SELFDIR/../share/systempony/rendered/ansi/" [ ! -d "$ponydir" ] && ponydir="$SELFDIR/../share/ascii-pony/rendered/ansi/"
ponyfile="$ponydir/$PONY.colored.txt" ponyfile="$ponydir/$PONY.colored.txt"
if [ -f "$ponyfile" ] if [ -f "$ponyfile" ]