makefile stuff
This commit is contained in:
parent
966481dacd
commit
393e75ce19
1 changed files with 46 additions and 17 deletions
63
Makefile
63
Makefile
|
@ -12,38 +12,67 @@ YAMLS != find $(DATADIR) -iname "*.yaml"
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
|
||||||
|
define copy =
|
||||||
|
echo "[copy] "$@
|
||||||
|
cp $< $@
|
||||||
|
endef
|
||||||
|
|
||||||
ifneq ($(BUILDDIR),$(DATADIR))
|
ifneq ($(BUILDDIR),$(DATADIR))
|
||||||
$(BUILDDIR)/%: $(DATADIR)/%
|
$(BUILDDIR)/%: $(DATADIR)/%
|
||||||
@echo "[copy] "$@
|
@$(call copy)
|
||||||
@cp $< $@
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
$(BUILDDIR)/nsfw/%: $(DATADIR)/%
|
||||||
|
@$(call copy)
|
||||||
|
|
||||||
|
|
||||||
|
define resize =
|
||||||
|
echo "[resize] "$@
|
||||||
|
mkdir -p $(dir $@)
|
||||||
|
convert -resize "$(1)x$(1)$(2)" $(3) $< $@
|
||||||
|
endef
|
||||||
|
|
||||||
|
crop = -gravity center -crop 1:1+0
|
||||||
|
|
||||||
$(BUILDDIR)/%_small.png: $(DATADIR)/%.png
|
$(BUILDDIR)/%_small.png: $(DATADIR)/%.png
|
||||||
@echo "[resize] "$@
|
@$(call resize,$(SMALL),^,$(crop))
|
||||||
@mkdir -p $(dir $@)
|
|
||||||
@convert -resize "$(SMALL)x$(SMALL)^" -gravity center -crop 1:1+0 $< $@
|
|
||||||
|
|
||||||
$(BUILDDIR)/%_med.png: $(DATADIR)/%.png
|
$(BUILDDIR)/%_med.png: $(DATADIR)/%.png
|
||||||
@echo "[resize] "$@
|
@$(call resize,$(MED),>)
|
||||||
@mkdir -p $(dir $@)
|
|
||||||
@convert -resize "$(MED)x$(MED)>" $< $@
|
$(BUILDDIR)/nsfw/%_small.png: $(DATADIR)/%.png
|
||||||
|
@$(call resize,$(SMALL),^,$(crop))
|
||||||
|
|
||||||
|
$(BUILDDIR)/nsfw/%_med.png: $(DATADIR)/%.png
|
||||||
|
@$(call resize,$(MED),>)
|
||||||
|
|
||||||
|
|
||||||
|
define single =
|
||||||
|
echo "[single] "$@
|
||||||
|
mkdir -p $(dir $@)
|
||||||
|
$(MAKEPAGES) single $< -o $@ $(1)
|
||||||
|
endef
|
||||||
|
|
||||||
$(BUILDDIR)/%/index.html: $(DATADIR)/%/info.yaml
|
$(BUILDDIR)/%/index.html: $(DATADIR)/%/info.yaml
|
||||||
@echo "[single] "$@
|
@$(call single)
|
||||||
@mkdir -p $(dir $@)
|
|
||||||
@$(MAKEPAGES) single $< -o $@
|
|
||||||
|
|
||||||
$(BUILDDIR)/nsfw/%/index.html: $(DATADIR)/%/info.yaml
|
$(BUILDDIR)/nsfw/%/index.html: $(DATADIR)/%/info.yaml
|
||||||
@echo "[single] "$@
|
@$(call single,-n)
|
||||||
@mkdir -p $(dir $@)
|
|
||||||
@$(MAKEPAGES) single $< -o $@ -n
|
define depend-single =
|
||||||
|
echo "[deps] "$@
|
||||||
|
mkdir -p $(dir $@)
|
||||||
|
$(MAKEPAGES) depend-single $< -o $@ $(1)
|
||||||
|
endef
|
||||||
|
|
||||||
$(TMPDIR)/%.d: %.yaml
|
$(TMPDIR)/%.d: %.yaml
|
||||||
@echo "[deps] "$@
|
@$(call depend-single)
|
||||||
@mkdir -p $(dir $@)
|
|
||||||
@$(MAKEPAGES) depend-single $< -o $@
|
$(TMPDIR)/nsfw/%.d: %.yaml
|
||||||
|
@$(call depend-single,-n -p nsfw)
|
||||||
|
|
||||||
include $(TMPDIR)/$(YAMLS:.yaml=.d)
|
include $(TMPDIR)/$(YAMLS:.yaml=.d)
|
||||||
|
include $(TMPDIR)/nsfw/$(YAMLS:.yaml=.d)
|
||||||
|
|
||||||
.PHONY: clean distclean
|
.PHONY: clean distclean
|
||||||
clean:
|
clean:
|
||||||
|
|
Loading…
Reference in a new issue