lipu-sona/bin/Makefile

54 lines
1.3 KiB
Makefile
Raw Permalink Normal View History

2020-06-05 11:49:29 +03:00
-include Makefile.cfg
2020-03-13 16:06:12 +03:00
2024-08-20 21:07:39 +05:00
OUTDIR=../public
PAGEDIR=../pages
SRCDIR=../src
TPLDIR=../templates
STATICDIR=../static
2020-03-13 15:35:20 +03:00
2020-06-05 11:49:29 +03:00
ifndef THEME
THEME=theme
endif
2020-10-05 13:32:44 +03:00
THEME_FLAGS=-c style,fencedcode
# _PNGS = $(shell find $(PAGEDIR) -name \*.png)
# PNGS = $(patsubst $(PAGEDIR)/%,$(OUTDIR)/%,$(_PNGS))
2020-03-13 15:35:20 +03:00
_PAGES = $(shell find $(PAGEDIR) -name \*.md)
PAGES_HTML = $(patsubst $(PAGEDIR)/%.md,$(OUTDIR)/%/index.html,$(_PAGES))
2020-05-31 12:12:45 +03:00
# _DIRECTORIES = $(shell find $(PAGEDIR)/* -type d)
# DIRECTORIES = $(patsubst $(PAGEDIR)/, $(OUTDIR)/, $(_PAGES))
2020-03-14 20:27:53 +03:00
2024-08-20 21:07:39 +05:00
_STATIC_FILES = $(shell find -L $(STATICDIR)/ -type f -name \* | grep -v \\.h$)
_STATIC_HEADERS = $(shell find -L $(STATICDIR)/ -type f -name \*\\.h)
OUT_STATIC = $(patsubst $(STATICDIR)/%,$(OUTDIR)/%,$(_STATIC_FILES)) $(patsubst $(STATICDIR)/%.h,$(OUTDIR)/%,$(_STATIC_HEADERS))
2020-03-13 15:35:20 +03:00
.SUFFIXES:
2020-03-13 16:06:12 +03:00
.PHONY: all upload
2020-03-13 15:35:20 +03:00
2022-10-22 12:15:03 +03:00
all: $(PAGES_HTML) $(OUT_STATIC)
2020-03-13 15:35:20 +03:00
2020-03-14 20:27:53 +03:00
upload:
./upload.sh
$(OUTDIR)//index.html: $(PAGEDIR)/.md $(TPLDIR)/default.tpl
@mkdir -p $(@D)
$(THEME) $(THEME_FLAGS) -t $(TPLDIR)/default.tpl -p $(patsubst $(OUTDIR)/%,%,$@) -o $@ $<
$(OUTDIR)/%/index.html: $(PAGEDIR)/%.md $(TPLDIR)/default.tpl
2020-03-14 20:27:53 +03:00
@mkdir -p $(@D)
2020-10-05 13:32:44 +03:00
$(THEME) $(THEME_FLAGS) -t $(TPLDIR)/default.tpl -p $(patsubst $(OUTDIR)/%,%,$@) -o $@ $<
2020-03-13 15:35:20 +03:00
2024-08-20 21:07:39 +05:00
$(OUTDIR)/%: $(STATICDIR)/%.h
@mkdir -p $(@D)
cpp -E -P -o $@ $<
2024-08-20 21:07:39 +05:00
$(OUTDIR)/%: $(STATICDIR)/%
2020-03-14 20:27:53 +03:00
@mkdir -p $(@D)
2020-03-13 15:35:20 +03:00
cp -r $< $@
clean:
2024-08-20 21:07:39 +05:00
rm -rf $(OUTDIR)/*