From 802812e99f331831dfde32ff4e271efc30e927ee Mon Sep 17 00:00:00 2001 From: Luka Vandervelden Date: Sun, 7 Jul 2019 11:50:32 +0200 Subject: [PATCH] Makefile update. - kanband is now Makefile-produced. - Improved dependency handling for client-related files (ls, css). --- Makefile | 77 +++++++++++++++++++++++++++++++++++------------------ index.html | 4 +-- project.zsh | 25 +++++++++-------- 3 files changed, 67 insertions(+), 39 deletions(-) diff --git a/Makefile b/Makefile index 69fba48..2494aa0 100644 --- a/Makefile +++ b/Makefile @@ -16,35 +16,53 @@ LDFLAGS := Q := @ -all: public/main.js public/style.css +all: kanband main.js style.css @: -public/main.js: public/main.bundle.js public - @echo ' MIN > public/main.js' - $(Q)npx babel --minified public/main.bundle.js -o public/main.js +kanband: src/main.cr + @echo ' CR > kanband' + $(Q)crystal src/main.cr -o 'kanband' -public/main.bundle.js: client/index.ls public - @echo ' BUN > public/main.bundle.js' - $(Q)npx browserify -t browserify-livescript client/index.ls -o public/main.bundle.js +kanband.install: kanband + @echo ' IN > $(BINDIR)/kanband' + $(Q)mkdir -p '$(DESTDIR)$(BINDIR)' + $(Q)install -m0755 kanband $(DESTDIR)$(BINDIR)/kanband + +kanband.clean: + @echo ' RM > kanband' + $(Q)rm -f kanband + +kanband.uninstall: + @echo ' RM > $(BINDIR)/kanband' + $(Q)rm -f '$(DESTDIR)$(BINDIR)/kanband' + +main.js: main.bundle.js + @echo ' MIN > main.js' + $(Q)npx babel --minified main.bundle.js -o main.js -public/main.js.clean: - @echo ' RM > public/main.js' - $(Q)rm -f public/main.js - @echo ' RM > public/main.bundle.js' - $(Q)rm -f public/main.bundle.js +main.bundle.js: client/index.ls client/bulma.ls + @echo ' BUN > main.bundle.js' + $(Q)npx browserify -t browserify-livescript client/index.ls -o main.bundle.js -public/style.css: client/style.sass public - @echo ' CSS > public/style.css' - $(Q)sassc client/style.sass > public/style.css +main.js.clean: + @echo ' RM > main.js' + $(Q)rm -f main.js + @echo ' RM > main.bundle.js' + $(Q)rm -f main.bundle.js -public/style.css.clean: +style.css: client/style.sass + @echo ' CSS > style.css' + $(Q)sassc client/style.sass > style.css + + +style.css.clean: + @echo ' RM > style.css' + $(Q)rm -f style.css -public: - $(Q)mkdir -p public $(DESTDIR)$(PREFIX): @echo ' DIR > $(PREFIX)' $(Q)mkdir -p $(DESTDIR)$(PREFIX) @@ -63,12 +81,12 @@ $(DESTDIR)$(INCLUDEDIR): $(DESTDIR)$(MANDIR): @echo ' DIR > $(MANDIR)' $(Q)mkdir -p $(DESTDIR)$(MANDIR) -install: subdirs.install public/main.js.install public/style.css.install +install: subdirs.install kanband.install main.js.install style.css.install @: subdirs.install: -uninstall: subdirs.uninstall public/main.js.uninstall public/style.css.uninstall +uninstall: subdirs.uninstall kanband.uninstall main.js.uninstall style.css.uninstall @: subdirs.uninstall: @@ -78,7 +96,7 @@ test: all subdirs subdirs.test subdirs.test: -clean: public/main.js.clean public/style.css.clean +clean: kanband.clean main.js.clean style.css.clean distclean: clean @@ -93,22 +111,28 @@ dist-gz: $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION).tar.gz: distdir @echo ' TAR > $(PACKAGE)-$(VERSION).tar.gz' $(Q)tar czf $(PACKAGE)-$(VERSION).tar.gz \ + $(PACKAGE)-$(VERSION)/src/main.cr \ $(PACKAGE)-$(VERSION)/client/index.ls \ - $(PACKAGE)-$(VERSION)/client/style.sass + $(PACKAGE)-$(VERSION)/client/style.sass \ + $(PACKAGE)-$(VERSION)/client/bulma.ls dist-xz: $(PACKAGE)-$(VERSION).tar.xz $(PACKAGE)-$(VERSION).tar.xz: distdir @echo ' TAR > $(PACKAGE)-$(VERSION).tar.xz' $(Q)tar cJf $(PACKAGE)-$(VERSION).tar.xz \ + $(PACKAGE)-$(VERSION)/src/main.cr \ $(PACKAGE)-$(VERSION)/client/index.ls \ - $(PACKAGE)-$(VERSION)/client/style.sass + $(PACKAGE)-$(VERSION)/client/style.sass \ + $(PACKAGE)-$(VERSION)/client/bulma.ls dist-bz2: $(PACKAGE)-$(VERSION).tar.bz2 $(PACKAGE)-$(VERSION).tar.bz2: distdir @echo ' TAR > $(PACKAGE)-$(VERSION).tar.bz2' $(Q)tar cjf $(PACKAGE)-$(VERSION).tar.bz2 \ + $(PACKAGE)-$(VERSION)/src/main.cr \ $(PACKAGE)-$(VERSION)/client/index.ls \ - $(PACKAGE)-$(VERSION)/client/style.sass + $(PACKAGE)-$(VERSION)/client/style.sass \ + $(PACKAGE)-$(VERSION)/client/bulma.ls help: @echo ' :: kanban-0.1' @@ -134,8 +158,9 @@ help: @echo ' - MANDIR  ${MANDIR}' @echo '' @echo 'Project targets: ' - @echo ' - public/main.js livescript' - @echo ' - public/style.css css' + @echo ' - kanband  crystal' + @echo ' - main.js  livescript' + @echo ' - style.css  css' @echo '' @echo 'Makefile options:' @echo ' - gnu: false' diff --git a/index.html b/index.html index 779c98b..237f9ee 100644 --- a/index.html +++ b/index.html @@ -4,9 +4,9 @@ Kanban - + - + diff --git a/project.zsh b/project.zsh index a589ab6..5f1f238 100644 --- a/project.zsh +++ b/project.zsh @@ -2,16 +2,19 @@ package=kanban version=0.1 -targets=() +targets=(kanband) +type[kanband]=crystal +sources[kanband]=src/main.cr +depends[kanband]="$(ls src/*.cr | grep -v '/main.cr$')" -targets+=(public/main.js) -type[public/main.js]=livescript -sources[public/main.js]=client/index.ls -depends[public/main.js]="$(ls client/*.ls | grep -v /index.ls$ | tr '\n' ' ')" +targets+=(main.js) +type[main.js]=livescript +sources[main.js]=client/index.ls +depends[main.js]="$(ls client/*.ls | grep -v /index.ls$ | tr '\n' ' ')" -targets+=(public/style.css) -type[public/style.css]=css -sources[public/style.css]=client/style.sass +targets+=(style.css) +type[style.css]=css +sources[style.css]=client/style.sass # # implementation details below, bruh~ @@ -36,12 +39,12 @@ function CSS { } function livescript.build { - write "${target}: ${target%.js}.bundle.js $(dirname $target)" + write "${target}: ${target%.js}.bundle.js $(dirdep $target)" write "\t@echo '$(MIN ${target%.js}.js)'" write "\t${Q}npx babel --minified ${target%.js}.bundle.js -o ${target}" write "\n" - write "${target%.js}.bundle.js: ${sources[$target]} ${depends[$target]} $(dirname $target)" + write "${target%.js}.bundle.js: ${sources[$target]} ${depends[$target]} $(dirdep $target)" write "\t@echo '$(BUN ${target%.js}.bundle.js)'" write "\t${Q}npx browserify -t browserify-livescript ${sources[$target]} -o ${target%.js}.bundle.js" write "\n" @@ -65,7 +68,7 @@ function livescript.uninstall { } function css.build { - write "${target}: ${sources[$target]} $(dirname $target)" + write "${target}: ${sources[$target]} $(dirdep $target)" write "\t@echo '$(CSS ${target})'" write "\t${Q}sassc ${sources[$target]} > ${target}" write "\n"