build.zsh can be installed on the user’s system. o/

Yeah, it’s pretty much useless. But it allowed me to run tests and fix a
few minor bugs, so… whatever?
This commit is contained in:
Luka Vandervelden 2015-04-06 23:00:08 +02:00
parent f30e64e604
commit 2725adf5c4
4 changed files with 79 additions and 10 deletions

View File

@ -13,7 +13,7 @@ LDFLAGS :=
Q := @ Q := @
all: build.zsh all: build.zsh build/binary.zsh build/library.zsh build/ofile.zsh build/script.zsh
build.zsh: build.zsh:
@ -28,6 +28,58 @@ build.zsh.uninstall:
@echo ' [RM] $(BINDIR)/build.zsh' @echo ' [RM] $(BINDIR)/build.zsh'
$(Q)rm -f '$(DESTDIR)$(BINDIR)/build.zsh' $(Q)rm -f '$(DESTDIR)$(BINDIR)/build.zsh'
build/binary.zsh:
build/binary.zsh.install: build/binary.zsh
@echo ' [IN] $(SHAREDIR)/build.zsh/binary.zsh'
$(Q)mkdir -p '$(DESTDIR)$(SHAREDIR)/build.zsh'
$(Q)install -m0755 build/binary.zsh $(DESTDIR)$(SHAREDIR)/build.zsh/binary.zsh
build/binary.zsh.clean:
build/binary.zsh.uninstall:
@echo ' [RM] $(SHAREDIR)/build.zsh/binary.zsh'
$(Q)rm -f '$(DESTDIR)$(SHAREDIR)/build.zsh/binary.zsh'
build/library.zsh:
build/library.zsh.install: build/library.zsh
@echo ' [IN] $(SHAREDIR)/build.zsh/library.zsh'
$(Q)mkdir -p '$(DESTDIR)$(SHAREDIR)/build.zsh'
$(Q)install -m0755 build/library.zsh $(DESTDIR)$(SHAREDIR)/build.zsh/library.zsh
build/library.zsh.clean:
build/library.zsh.uninstall:
@echo ' [RM] $(SHAREDIR)/build.zsh/library.zsh'
$(Q)rm -f '$(DESTDIR)$(SHAREDIR)/build.zsh/library.zsh'
build/ofile.zsh:
build/ofile.zsh.install: build/ofile.zsh
@echo ' [IN] $(SHAREDIR)/build.zsh/ofile.zsh'
$(Q)mkdir -p '$(DESTDIR)$(SHAREDIR)/build.zsh'
$(Q)install -m0755 build/ofile.zsh $(DESTDIR)$(SHAREDIR)/build.zsh/ofile.zsh
build/ofile.zsh.clean:
build/ofile.zsh.uninstall:
@echo ' [RM] $(SHAREDIR)/build.zsh/ofile.zsh'
$(Q)rm -f '$(DESTDIR)$(SHAREDIR)/build.zsh/ofile.zsh'
build/script.zsh:
build/script.zsh.install: build/script.zsh
@echo ' [IN] $(SHAREDIR)/build.zsh/script.zsh'
$(Q)mkdir -p '$(DESTDIR)$(SHAREDIR)/build.zsh'
$(Q)install -m0755 build/script.zsh $(DESTDIR)$(SHAREDIR)/build.zsh/script.zsh
build/script.zsh.clean:
build/script.zsh.uninstall:
@echo ' [RM] $(SHAREDIR)/build.zsh/script.zsh'
$(Q)rm -f '$(DESTDIR)$(SHAREDIR)/build.zsh/script.zsh'
$(DESTDIR)$(PREFIX): $(DESTDIR)$(PREFIX):
@echo ' [DIR] $(PREFIX)' @echo ' [DIR] $(PREFIX)'
$(Q)mkdir -p $(DESTDIR)$(PREFIX) $(Q)mkdir -p $(DESTDIR)$(PREFIX)
@ -43,12 +95,12 @@ $(DESTDIR)$(SHAREDIR):
$(DESTDIR)$(INCLUDEDIR): $(DESTDIR)$(INCLUDEDIR):
@echo ' [DIR] $(INCLUDEDIR)' @echo ' [DIR] $(INCLUDEDIR)'
$(Q)mkdir -p $(DESTDIR)$(INCLUDEDIR) $(Q)mkdir -p $(DESTDIR)$(INCLUDEDIR)
install: subdirs.install build.zsh.install install: subdirs.install build.zsh.install build/binary.zsh.install build/library.zsh.install build/ofile.zsh.install build/script.zsh.install
@: @:
subdirs.install: subdirs.install:
uninstall: subdirs.uninstall build.zsh.uninstall uninstall: subdirs.uninstall build.zsh.uninstall build/binary.zsh.uninstall build/library.zsh.uninstall build/ofile.zsh.uninstall build/script.zsh.uninstall
@: @:
subdirs.uninstall: subdirs.uninstall:
@ -58,7 +110,7 @@ test: all subdirs subdirs.test
subdirs.test: subdirs.test:
clean: build.zsh.clean clean: build.zsh.clean build/binary.zsh.clean build/library.zsh.clean build/ofile.zsh.clean build/script.zsh.clean
distclean: clean distclean: clean
@ -126,6 +178,10 @@ help:
@echo '' @echo ''
@echo 'Project targets: ' @echo 'Project targets: '
@echo ' - build.zsh script' @echo ' - build.zsh script'
@echo ' - build/binary.zshscript'
@echo ' - build/library.zshscript'
@echo ' - build/ofile.zshscript'
@echo ' - build/script.zshscript'
@echo '' @echo ''
@echo 'Makefile options:' @echo 'Makefile options:'
@echo ' - gnu: true' @echo ' - gnu: true'

View File

@ -153,8 +153,12 @@ function duplicated {
return 1 return 1
} }
for i in build/*.zsh; do for dir in "@SHAREDIR@/build.zsh" build; do
. $i [[ -d "$dir" ]] && {
for i in "$dir"/*.zsh; do
. "$i"
done
}
done done
## ##
@ -256,6 +260,7 @@ function main {
else else
write "${target}.install: \$(DESTDIR)${installdir}" write "${target}.install: \$(DESTDIR)${installdir}"
write "\t@echo '$(IN ${installdir}/${target})'" write "\t@echo '$(IN ${installdir}/${target})'"
write "\t@mkdir -p '\$(DESTDIR)/${installdir}'"
write "\t${Q}install -m755 $target \$(DESTDIR)${installdir}/$target" write "\t${Q}install -m755 $target \$(DESTDIR)${installdir}/$target"
write write
fi fi

View File

@ -21,18 +21,20 @@ function binary.build {
function binary.install { function binary.install {
local install="${install[$target]:-\$(BINDIR)}" local install="${install[$target]:-\$(BINDIR)}"
local basename="$(basename "${target}")"
write "${target}.install: ${target}" write "${target}.install: ${target}"
write "\t@echo '$(IN "${install}/${target}")'" write "\t@echo '$(IN "${install}/${basename}")'"
write "\t${Q}mkdir -p '\$(DESTDIR)${install}'" write "\t${Q}mkdir -p '\$(DESTDIR)${install}'"
write "\t${Q}install -m0755 ${target} \$(DESTDIR)${install}/${target}" write "\t${Q}install -m0755 ${target} \$(DESTDIR)${install}/${basename}"
write write
} }
function binary.uninstall { function binary.uninstall {
local install="${install[$target]:-\$(BINDIR)}" local install="${install[$target]:-\$(BINDIR)}"
local basename="$(basename "${target}")"
write "${target}.uninstall:" write "${target}.uninstall:"
write "\t@echo '$(RM ${install}/${target})'" write "\t@echo '$(RM ${install}/${basename})'"
write "\t${Q}rm -f '\$(DESTDIR)${install}/${target}'" write "\t${Q}rm -f '\$(DESTDIR)${install}/${basename}'"
write write
} }

View File

@ -5,5 +5,11 @@ version=0.2
targets=(build.zsh) targets=(build.zsh)
type[build.zsh]=script type[build.zsh]=script
for i in build/*.zsh; do
targets+=($i)
type[$i]=script
install[$i]='$(SHAREDIR)/build.zsh'
done
dist=(build/*.zsh project.zsh Makefile) dist=(build/*.zsh project.zsh Makefile)