|
|
|
# Copyright (C) 2022 Ivan Polyakov
|
|
|
|
#
|
|
|
|
# This file is part of vilor's website.
|
|
|
|
#
|
|
|
|
# Vilor's website is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# Vilor's website is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
include config.mk
|
|
|
|
|
|
|
|
DIRS := $(shell find $(SRCDIR)/pages/* -type d | sed 's/$(SRCDIR)\/pages/$(OUTDIR)/')
|
|
|
|
|
|
|
|
SRCPAGES := $(shell find $(SRCDIR)/pages/* -name '*.scm')
|
|
|
|
SRCSTYLES := $(shell find $(SRCDIR)/styles/* -name '*.scm')
|
|
|
|
SRCJS := $(shell find $(SRCDIR)/scripts/* -name '*.js')
|
|
|
|
|
|
|
|
BUILDTIME=$(shell date "+%s")
|
|
|
|
|
|
|
|
all: $(OUTDIR) $(STATICDIR) pages styles js
|
|
|
|
|
|
|
|
pages: $(SRCPAGES)
|
|
|
|
for page in $(SRCPAGES) ; do \
|
|
|
|
$(SCHEME) $(SCHEMEFLAGS) -e "(define build-time $(BUILDTIME))" -s $$page \
|
|
|
|
| sed -f scripts/minify-html.sed \
|
|
|
|
> $$(echo $$page | sed 's/.*\/pages/dist/' | sed 's/scm/xhtml/') \
|
|
|
|
; done
|
|
|
|
|
|
|
|
styles: $(SRCSTYLES)
|
|
|
|
for style in $(SRCSTYLES) ; do \
|
|
|
|
$(SCHEME) $(SCHEMEFLAGS) -e "(define build-time $(BUILDTIME))" -s $$style \
|
|
|
|
> $$(echo $$style | sed 's/.*\/styles/dist/' | sed 's/scm/$(BUILDTIME).css/') \
|
|
|
|
; done
|
|
|
|
|
|
|
|
js: $(SRCJS)
|
|
|
|
for script in $(SRCJS) ; do \
|
|
|
|
cp $$script $$(echo $$script | sed 's/.*\/scripts/dist/' | sed 's/js/$(BUILDTIME).js/') \
|
|
|
|
; done
|
|
|
|
|
|
|
|
$(OUTDIR):
|
|
|
|
mkdir -p $(OUTDIR)
|
|
|
|
mkdir -p $(DIRS)
|
|
|
|
|
|
|
|
$(STATICDIR): $(OUTDIR)
|
|
|
|
cp -rf $@/* $< || echo $(STATICDIR) "dir is empty"
|
|
|
|
cp COPYING dist/
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(OUTDIR)
|
|
|
|
|
|
|
|
.PHONY: all $(OUTDIR) $(STATICDIR) clean
|