Makefile update.
- kanband is now Makefile-produced. - Improved dependency handling for client-related files (ls, css).
This commit is contained in:
parent
8b5e0a0c02
commit
802812e99f
77
Makefile
77
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 '[01;31m MIN > [01;37mpublic/main.js[00m'
|
||||
$(Q)npx babel --minified public/main.bundle.js -o public/main.js
|
||||
kanband: src/main.cr
|
||||
@echo '[01;35m CR > [01;37mkanband[00m'
|
||||
$(Q)crystal src/main.cr -o 'kanband'
|
||||
|
||||
|
||||
public/main.bundle.js: client/index.ls public
|
||||
@echo '[01;32m BUN > [01;37mpublic/main.bundle.js[00m'
|
||||
$(Q)npx browserify -t browserify-livescript client/index.ls -o public/main.bundle.js
|
||||
kanband.install: kanband
|
||||
@echo '[01;31m IN > [01;37m$(BINDIR)/kanband[00m'
|
||||
$(Q)mkdir -p '$(DESTDIR)$(BINDIR)'
|
||||
$(Q)install -m0755 kanband $(DESTDIR)$(BINDIR)/kanband
|
||||
|
||||
kanband.clean:
|
||||
@echo '[01;37m RM > [01;37mkanband[00m'
|
||||
$(Q)rm -f kanband
|
||||
|
||||
kanband.uninstall:
|
||||
@echo '[01;37m RM > [01;37m$(BINDIR)/kanband[00m'
|
||||
$(Q)rm -f '$(DESTDIR)$(BINDIR)/kanband'
|
||||
|
||||
main.js: main.bundle.js
|
||||
@echo '[01;31m MIN > [01;37mmain.js[00m'
|
||||
$(Q)npx babel --minified main.bundle.js -o main.js
|
||||
|
||||
|
||||
public/main.js.clean:
|
||||
@echo '[01;37m RM > [01;37mpublic/main.js[00m'
|
||||
$(Q)rm -f public/main.js
|
||||
@echo '[01;37m RM > [01;37mpublic/main.bundle.js[00m'
|
||||
$(Q)rm -f public/main.bundle.js
|
||||
main.bundle.js: client/index.ls client/bulma.ls
|
||||
@echo '[01;32m BUN > [01;37mmain.bundle.js[00m'
|
||||
$(Q)npx browserify -t browserify-livescript client/index.ls -o main.bundle.js
|
||||
|
||||
|
||||
public/style.css: client/style.sass public
|
||||
@echo '[01;33m CSS > [01;37mpublic/style.css[00m'
|
||||
$(Q)sassc client/style.sass > public/style.css
|
||||
main.js.clean:
|
||||
@echo '[01;37m RM > [01;37mmain.js[00m'
|
||||
$(Q)rm -f main.js
|
||||
@echo '[01;37m RM > [01;37mmain.bundle.js[00m'
|
||||
$(Q)rm -f main.bundle.js
|
||||
|
||||
|
||||
public/style.css.clean:
|
||||
style.css: client/style.sass
|
||||
@echo '[01;33m CSS > [01;37mstyle.css[00m'
|
||||
$(Q)sassc client/style.sass > style.css
|
||||
|
||||
|
||||
style.css.clean:
|
||||
@echo '[01;37m RM > [01;37mstyle.css[00m'
|
||||
$(Q)rm -f style.css
|
||||
|
||||
public:
|
||||
$(Q)mkdir -p public
|
||||
$(DESTDIR)$(PREFIX):
|
||||
@echo '[01;35m DIR > [01;37m$(PREFIX)[00m'
|
||||
$(Q)mkdir -p $(DESTDIR)$(PREFIX)
|
||||
@ -63,12 +81,12 @@ $(DESTDIR)$(INCLUDEDIR):
|
||||
$(DESTDIR)$(MANDIR):
|
||||
@echo '[01;35m DIR > [01;37m$(MANDIR)[00m'
|
||||
$(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 '[01;33m TAR > [01;37m$(PACKAGE)-$(VERSION).tar.gz[00m'
|
||||
$(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 '[01;33m TAR > [01;37m$(PACKAGE)-$(VERSION).tar.xz[00m'
|
||||
$(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 '[01;33m TAR > [01;37m$(PACKAGE)-$(VERSION).tar.bz2[00m'
|
||||
$(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 '[01;37m :: kanban-0.1[00m'
|
||||
@ -134,8 +158,9 @@ help:
|
||||
@echo ' - [01;34mMANDIR [37m ${MANDIR}[00m'
|
||||
@echo ''
|
||||
@echo '[01;37mProject targets: [00m'
|
||||
@echo ' - [01;33mpublic/main.js[37m livescript[00m'
|
||||
@echo ' - [01;33mpublic/style.css[37m css[00m'
|
||||
@echo ' - [01;33mkanband [37m crystal[00m'
|
||||
@echo ' - [01;33mmain.js [37m livescript[00m'
|
||||
@echo ' - [01;33mstyle.css [37m css[00m'
|
||||
@echo ''
|
||||
@echo '[01;37mMakefile options:[00m'
|
||||
@echo ' - gnu: false'
|
||||
|
@ -4,9 +4,9 @@
|
||||
<title>Kanban</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" href="public/style.css"/>
|
||||
<link rel="stylesheet" href="/style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script src="public/main.js"></script>
|
||||
<script src="/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
25
project.zsh
25
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"
|
||||
|
Loading…
Reference in New Issue
Block a user