Various.
- nodist[file] can be used to prevent inclusion of something in the tarballs, even if it’s a source or something that should normally be included. - filename[target] can be used to rename files at installation-time. - A moonscript module was added. - Many modules update. - Some grooming, some deprecated code removed. - Makefile regenerated.
This commit is contained in:
parent
7cc71afbe7
commit
711e92c22d
24
Makefile
24
Makefile
@ -15,7 +15,7 @@ LDFLAGS :=
|
|||||||
|
|
||||||
Q := @
|
Q := @
|
||||||
|
|
||||||
all: build.zsh build/binary.zsh build/library.zsh build/ofile.zsh build/script.zsh build/sharedlib.zsh build/staticlib.zsh
|
all: build.zsh build/binary.zsh build/library.zsh build/moon.zsh build/ofile.zsh build/script.zsh build/sharedlib.zsh build/staticlib.zsh
|
||||||
|
|
||||||
build.zsh: build.zsh.in
|
build.zsh: build.zsh.in
|
||||||
@echo '[01;32m [SED] [01;37mbuild.zsh[00m'
|
@echo '[01;32m [SED] [01;37mbuild.zsh[00m'
|
||||||
@ -62,6 +62,19 @@ build/library.zsh.uninstall:
|
|||||||
@echo '[01;37m [RM] [01;37m$(SHAREDIR)/build.zsh/library.zsh[00m'
|
@echo '[01;37m [RM] [01;37m$(SHAREDIR)/build.zsh/library.zsh[00m'
|
||||||
$(Q)rm -f '$(DESTDIR)$(SHAREDIR)/build.zsh/library.zsh'
|
$(Q)rm -f '$(DESTDIR)$(SHAREDIR)/build.zsh/library.zsh'
|
||||||
|
|
||||||
|
build/moon.zsh:
|
||||||
|
|
||||||
|
build/moon.zsh.install: build/moon.zsh
|
||||||
|
@echo '[01;31m [IN] [01;37m$(SHAREDIR)/build.zsh/moon.zsh[00m'
|
||||||
|
$(Q)mkdir -p '$(DESTDIR)$(SHAREDIR)/build.zsh'
|
||||||
|
$(Q)install -m0755 build/moon.zsh $(DESTDIR)$(SHAREDIR)/build.zsh/moon.zsh
|
||||||
|
|
||||||
|
build/moon.zsh.clean:
|
||||||
|
|
||||||
|
build/moon.zsh.uninstall:
|
||||||
|
@echo '[01;37m [RM] [01;37m$(SHAREDIR)/build.zsh/moon.zsh[00m'
|
||||||
|
$(Q)rm -f '$(DESTDIR)$(SHAREDIR)/build.zsh/moon.zsh'
|
||||||
|
|
||||||
build/ofile.zsh:
|
build/ofile.zsh:
|
||||||
|
|
||||||
build/ofile.zsh.install: build/ofile.zsh
|
build/ofile.zsh.install: build/ofile.zsh
|
||||||
@ -129,12 +142,12 @@ $(DESTDIR)$(SHAREDIR):
|
|||||||
$(DESTDIR)$(INCLUDEDIR):
|
$(DESTDIR)$(INCLUDEDIR):
|
||||||
@echo '[01;35m [DIR] [01;37m$(INCLUDEDIR)[00m'
|
@echo '[01;35m [DIR] [01;37m$(INCLUDEDIR)[00m'
|
||||||
$(Q)mkdir -p $(DESTDIR)$(INCLUDEDIR)
|
$(Q)mkdir -p $(DESTDIR)$(INCLUDEDIR)
|
||||||
install: subdirs.install build.zsh.install build/binary.zsh.install build/library.zsh.install build/ofile.zsh.install build/script.zsh.install build/sharedlib.zsh.install build/staticlib.zsh.install
|
install: subdirs.install build.zsh.install build/binary.zsh.install build/library.zsh.install build/moon.zsh.install build/ofile.zsh.install build/script.zsh.install build/sharedlib.zsh.install build/staticlib.zsh.install
|
||||||
@:
|
@:
|
||||||
|
|
||||||
subdirs.install:
|
subdirs.install:
|
||||||
|
|
||||||
uninstall: subdirs.uninstall build.zsh.uninstall build/binary.zsh.uninstall build/library.zsh.uninstall build/ofile.zsh.uninstall build/script.zsh.uninstall build/sharedlib.zsh.uninstall build/staticlib.zsh.uninstall
|
uninstall: subdirs.uninstall build.zsh.uninstall build/binary.zsh.uninstall build/library.zsh.uninstall build/moon.zsh.uninstall build/ofile.zsh.uninstall build/script.zsh.uninstall build/sharedlib.zsh.uninstall build/staticlib.zsh.uninstall
|
||||||
@:
|
@:
|
||||||
|
|
||||||
subdirs.uninstall:
|
subdirs.uninstall:
|
||||||
@ -144,7 +157,7 @@ test: all subdirs subdirs.test
|
|||||||
|
|
||||||
subdirs.test:
|
subdirs.test:
|
||||||
|
|
||||||
clean: build.zsh.clean build/binary.zsh.clean build/library.zsh.clean build/ofile.zsh.clean build/script.zsh.clean build/sharedlib.zsh.clean build/staticlib.zsh.clean
|
clean: build.zsh.clean build/binary.zsh.clean build/library.zsh.clean build/moon.zsh.clean build/ofile.zsh.clean build/script.zsh.clean build/sharedlib.zsh.clean build/staticlib.zsh.clean
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
|
|
||||||
@ -161,6 +174,7 @@ $(PACKAGE)-$(VERSION).tar.gz: distdir
|
|||||||
$(Q)tar czf $(PACKAGE)-$(VERSION).tar.gz \
|
$(Q)tar czf $(PACKAGE)-$(VERSION).tar.gz \
|
||||||
$(PACKAGE)-$(VERSION)/build/binary.zsh \
|
$(PACKAGE)-$(VERSION)/build/binary.zsh \
|
||||||
$(PACKAGE)-$(VERSION)/build/library.zsh \
|
$(PACKAGE)-$(VERSION)/build/library.zsh \
|
||||||
|
$(PACKAGE)-$(VERSION)/build/moon.zsh \
|
||||||
$(PACKAGE)-$(VERSION)/build/ofile.zsh \
|
$(PACKAGE)-$(VERSION)/build/ofile.zsh \
|
||||||
$(PACKAGE)-$(VERSION)/build/script.zsh \
|
$(PACKAGE)-$(VERSION)/build/script.zsh \
|
||||||
$(PACKAGE)-$(VERSION)/build/sharedlib.zsh \
|
$(PACKAGE)-$(VERSION)/build/sharedlib.zsh \
|
||||||
@ -174,6 +188,7 @@ $(PACKAGE)-$(VERSION).tar.xz: distdir
|
|||||||
$(Q)tar cJf $(PACKAGE)-$(VERSION).tar.xz \
|
$(Q)tar cJf $(PACKAGE)-$(VERSION).tar.xz \
|
||||||
$(PACKAGE)-$(VERSION)/build/binary.zsh \
|
$(PACKAGE)-$(VERSION)/build/binary.zsh \
|
||||||
$(PACKAGE)-$(VERSION)/build/library.zsh \
|
$(PACKAGE)-$(VERSION)/build/library.zsh \
|
||||||
|
$(PACKAGE)-$(VERSION)/build/moon.zsh \
|
||||||
$(PACKAGE)-$(VERSION)/build/ofile.zsh \
|
$(PACKAGE)-$(VERSION)/build/ofile.zsh \
|
||||||
$(PACKAGE)-$(VERSION)/build/script.zsh \
|
$(PACKAGE)-$(VERSION)/build/script.zsh \
|
||||||
$(PACKAGE)-$(VERSION)/build/sharedlib.zsh \
|
$(PACKAGE)-$(VERSION)/build/sharedlib.zsh \
|
||||||
@ -187,6 +202,7 @@ $(PACKAGE)-$(VERSION).tar.bz2: distdir
|
|||||||
$(Q)tar cjf $(PACKAGE)-$(VERSION).tar.bz2 \
|
$(Q)tar cjf $(PACKAGE)-$(VERSION).tar.bz2 \
|
||||||
$(PACKAGE)-$(VERSION)/build/binary.zsh \
|
$(PACKAGE)-$(VERSION)/build/binary.zsh \
|
||||||
$(PACKAGE)-$(VERSION)/build/library.zsh \
|
$(PACKAGE)-$(VERSION)/build/library.zsh \
|
||||||
|
$(PACKAGE)-$(VERSION)/build/moon.zsh \
|
||||||
$(PACKAGE)-$(VERSION)/build/ofile.zsh \
|
$(PACKAGE)-$(VERSION)/build/ofile.zsh \
|
||||||
$(PACKAGE)-$(VERSION)/build/script.zsh \
|
$(PACKAGE)-$(VERSION)/build/script.zsh \
|
||||||
$(PACKAGE)-$(VERSION)/build/sharedlib.zsh \
|
$(PACKAGE)-$(VERSION)/build/sharedlib.zsh \
|
||||||
|
35
build.zsh.in
35
build.zsh.in
@ -116,7 +116,9 @@ function subdirs {
|
|||||||
|
|
||||||
function get_distfiles {
|
function get_distfiles {
|
||||||
for file in "${dist[@]}" $(echo ${sources[@]}) $(echo ${depends[@]}); do
|
for file in "${dist[@]}" $(echo ${sources[@]}) $(echo ${depends[@]}); do
|
||||||
|
if [[ -z "${nodist[$file]}" ]]; then
|
||||||
echo "$file"
|
echo "$file"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
typeset -a src
|
typeset -a src
|
||||||
@ -184,7 +186,7 @@ done
|
|||||||
|
|
||||||
function main {
|
function main {
|
||||||
typeset -a prefixes directories
|
typeset -a prefixes directories
|
||||||
typeset -A ldflags cflags sources type depends install auto
|
typeset -A ldflags cflags sources type depends install auto filename nodist
|
||||||
|
|
||||||
prefixes=(
|
prefixes=(
|
||||||
PREFIX '/usr/local'
|
PREFIX '/usr/local'
|
||||||
@ -278,6 +280,10 @@ function main {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "${installdir}" == "-" ]]; then
|
||||||
|
write "${target}.install:"
|
||||||
|
write ""
|
||||||
|
else
|
||||||
if exists "${type[$target]}.install"; then
|
if exists "${type[$target]}.install"; then
|
||||||
${type[$target]}.install
|
${type[$target]}.install
|
||||||
else
|
else
|
||||||
@ -285,13 +291,19 @@ function main {
|
|||||||
error "No install[${type[${target}]}] and no default installation directory."
|
error "No install[${type[${target}]}] and no default installation directory."
|
||||||
error "Your “install” rule will be broken!"
|
error "Your “install” rule will be broken!"
|
||||||
else
|
else
|
||||||
|
local F="${filename[$target]}"
|
||||||
|
if [[ -z "$F" ]]; then
|
||||||
|
F="${target}"
|
||||||
|
fi
|
||||||
|
|
||||||
write "${target}.install: \$(DESTDIR)${installdir}"
|
write "${target}.install: \$(DESTDIR)${installdir}"
|
||||||
write "\t@echo '$(IN ${installdir}/${target})'"
|
write "\t@echo '$(IN ${installdir}/${filename})'"
|
||||||
write "\t@mkdir -p '\$(DESTDIR)/${installdir}'"
|
write "\t@mkdir -p '\$(DESTDIR)/${installdir}'"
|
||||||
write "\t${Q}install -m755 $target \$(DESTDIR)${installdir}/$target"
|
write "\t${Q}install -m755 $target \$(DESTDIR)${installdir}/$filename"
|
||||||
write
|
write
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if exists "${type[$target]}.clean"; then
|
if exists "${type[$target]}.clean"; then
|
||||||
${type[$target]}.clean
|
${type[$target]}.clean
|
||||||
@ -375,14 +387,14 @@ function main {
|
|||||||
(( ${#targets[@]} > 0 )) && {
|
(( ${#targets[@]} > 0 )) && {
|
||||||
for target in ${targets[@]}; do
|
for target in ${targets[@]}; do
|
||||||
write -n " ${target}.clean"
|
write -n " ${target}.clean"
|
||||||
(
|
#(
|
||||||
typeset -a src
|
# typeset -a src
|
||||||
src=($(echo ${sources[$target]}))
|
# src=($(echo ${sources[$target]}))
|
||||||
|
|
||||||
for file in ${src[@]}; do
|
# for file in ${src[@]}; do
|
||||||
write -n " ${file%.c}.o.clean"
|
# write -n " ${file%.c}.o.clean"
|
||||||
done
|
# done
|
||||||
)
|
#)
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
write
|
write
|
||||||
@ -460,6 +472,9 @@ function main {
|
|||||||
for VAR __ in ${prefixes}; do
|
for VAR __ in ${prefixes}; do
|
||||||
printf " @echo ' - ${fg_bold[blue]}%-14s${fg[white]}\${$VAR}${reset_color}'\n" "$VAR" >> $Makefile
|
printf " @echo ' - ${fg_bold[blue]}%-14s${fg[white]}\${$VAR}${reset_color}'\n" "$VAR" >> $Makefile
|
||||||
done
|
done
|
||||||
|
for VAR __ in ${variables}; do
|
||||||
|
printf " @echo ' - ${fg_bold[blue]}%-14s${fg[white]}\${$VAR}${reset_color}'\n" "$VAR" >> $Makefile
|
||||||
|
done
|
||||||
|
|
||||||
write " @echo ''"
|
write " @echo ''"
|
||||||
write " @echo '${fg_bold[white]}Project targets: ${reset_color}'"
|
write " @echo '${fg_bold[white]}Project targets: ${reset_color}'"
|
||||||
|
@ -21,7 +21,11 @@ function binary.build {
|
|||||||
|
|
||||||
function binary.install {
|
function binary.install {
|
||||||
local install="${install[$target]:-\$(BINDIR)}"
|
local install="${install[$target]:-\$(BINDIR)}"
|
||||||
local basename="$(basename "${target}")"
|
local basename="${filename[$target]}"
|
||||||
|
if [[ -z "$basename" ]]; then
|
||||||
|
basename="$(basename "${target}")"
|
||||||
|
fi
|
||||||
|
|
||||||
write "${target}.install: ${target}"
|
write "${target}.install: ${target}"
|
||||||
write "\t@echo '$(IN "${install}/${basename}")'"
|
write "\t@echo '$(IN "${install}/${basename}")'"
|
||||||
write "\t${Q}mkdir -p '\$(DESTDIR)${install}'"
|
write "\t${Q}mkdir -p '\$(DESTDIR)${install}'"
|
||||||
@ -31,7 +35,11 @@ function binary.install {
|
|||||||
|
|
||||||
function binary.uninstall {
|
function binary.uninstall {
|
||||||
local install="${install[$target]:-\$(BINDIR)}"
|
local install="${install[$target]:-\$(BINDIR)}"
|
||||||
local basename="$(basename "${target}")"
|
local basename="${filename[$target]}"
|
||||||
|
if [[ -z "$basename" ]]; then
|
||||||
|
basename="$(basename "${target}")"
|
||||||
|
fi
|
||||||
|
|
||||||
write "${target}.uninstall:"
|
write "${target}.uninstall:"
|
||||||
write "\t@echo '$(RM ${install}/${basename})'"
|
write "\t@echo '$(RM ${install}/${basename})'"
|
||||||
write "\t${Q}rm -f '\$(DESTDIR)${install}/${basename}'"
|
write "\t${Q}rm -f '\$(DESTDIR)${install}/${basename}'"
|
||||||
@ -39,7 +47,18 @@ function binary.uninstall {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function binary.clean {
|
function binary.clean {
|
||||||
write "${target}.clean:"
|
for target in ${targets[@]}; do
|
||||||
|
write -n " ${target}.clean"
|
||||||
|
(
|
||||||
|
typeset -a src
|
||||||
|
src=($(echo ${sources[$target]}))
|
||||||
|
|
||||||
|
for file in ${src[@]}; do
|
||||||
|
write -n " ${file%.c}.o.clean"
|
||||||
|
done
|
||||||
|
)
|
||||||
|
done
|
||||||
|
|
||||||
write "\t@echo '$(RM ${target})'"
|
write "\t@echo '$(RM ${target})'"
|
||||||
write "\t${Q}rm -f ${target}"
|
write "\t${Q}rm -f ${target}"
|
||||||
write
|
write
|
||||||
|
67
build/moon.zsh
Normal file
67
build/moon.zsh
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
|
||||||
|
function MOON {
|
||||||
|
echo "${fg_bold[yellow]} [MOON] ${fg_bold[white]}$@${reset_color}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function moon.build {
|
||||||
|
write -n "${target}:"
|
||||||
|
|
||||||
|
typeset -l S
|
||||||
|
|
||||||
|
if [[ -n "${sources[$target]}" ]]; then
|
||||||
|
S="${sources[$target]}"
|
||||||
|
else
|
||||||
|
S="${target%.lua}.moon"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -e "${S%% *}" ]]; then
|
||||||
|
write " ${S}"
|
||||||
|
write "\t@echo '$(MOON "${target}")'"
|
||||||
|
# write "\t@echo '$(SED "${basename}")'"
|
||||||
|
# write -n "\t${Q}sed -e '"
|
||||||
|
# write -n "s&@LIBDIR@&\$(LIBDIR)&;"
|
||||||
|
# write -n "s&@BINDIR@&\$(BINDIR)&;"
|
||||||
|
# write -n "s&@SHAREDIR@&\$(SHAREDIR)&;"
|
||||||
|
# write "' '${basename}.in' > '${basename}'"
|
||||||
|
write "\t${Q}moonc -p $S > '${target}'"
|
||||||
|
# write "\t${Q}chmod +x '${basename}'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
write "\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
function moon.install {
|
||||||
|
binary.install "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function moon.uninstall {
|
||||||
|
binary.uninstall "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function moon.clean {
|
||||||
|
typeset -l S
|
||||||
|
|
||||||
|
if [[ -n "${sources[$target]}" ]]; then
|
||||||
|
S="${sources[$target]}"
|
||||||
|
else
|
||||||
|
S="${target%.lua}.moon"
|
||||||
|
fi
|
||||||
|
|
||||||
|
write "${target}.clean:"
|
||||||
|
|
||||||
|
if [[ -e "${S%% *}" ]]; then
|
||||||
|
write "\t@echo '$(RM ${target})'"
|
||||||
|
write "\t${Q}rm -f ${target}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
write
|
||||||
|
}
|
||||||
|
|
||||||
|
function moon.distfiles {
|
||||||
|
if [[ -e "${target}.moon" ]]; then
|
||||||
|
echo "${target}.moon"
|
||||||
|
else
|
||||||
|
echo "${target}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
@ -28,7 +28,3 @@ function ofile.uninstall {
|
|||||||
write
|
write
|
||||||
}
|
}
|
||||||
|
|
||||||
function ofile.clean {
|
|
||||||
binary.clean "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -1,15 +1,23 @@
|
|||||||
|
|
||||||
function script.build {
|
function script.build {
|
||||||
|
typeset -l S
|
||||||
|
|
||||||
|
if [[ -n "${sources[$target]}" ]]; then
|
||||||
|
S="${sources[$target]}"
|
||||||
|
else
|
||||||
|
S="${target}.in"
|
||||||
|
fi
|
||||||
|
|
||||||
write -n "${target}:"
|
write -n "${target}:"
|
||||||
|
|
||||||
if [[ -e "${target}.in" ]]; then
|
if [[ -e "${S%% *}" ]]; then
|
||||||
write " ${target}.in"
|
write " $S"
|
||||||
write "\t@echo '$(SED "${target}")'"
|
write "\t@echo '$(SED "${target}")'"
|
||||||
write -n "\t${Q}sed -e '"
|
write -n "\t${Q}sed -e '"
|
||||||
write -n "s&@LIBDIR@&\$(LIBDIR)&;"
|
write -n "s&@LIBDIR@&\$(LIBDIR)&;"
|
||||||
write -n "s&@BINDIR@&\$(BINDIR)&;"
|
write -n "s&@BINDIR@&\$(BINDIR)&;"
|
||||||
write -n "s&@SHAREDIR@&\$(SHAREDIR)&;"
|
write -n "s&@SHAREDIR@&\$(SHAREDIR)&;"
|
||||||
write "' '${target}.in' > '${target}'"
|
write "' $S > '${target}'"
|
||||||
write "\t${Q}chmod +x '${target}'"
|
write "\t${Q}chmod +x '${target}'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -25,9 +33,17 @@ function script.uninstall {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function script.clean {
|
function script.clean {
|
||||||
|
typeset -l S
|
||||||
|
|
||||||
|
if [[ -n "${sources[$target]}" ]]; then
|
||||||
|
S="${sources[$target]}"
|
||||||
|
else
|
||||||
|
S="${target}.in"
|
||||||
|
fi
|
||||||
|
|
||||||
write "${target}.clean:"
|
write "${target}.clean:"
|
||||||
|
|
||||||
if [[ -e "${target}.in" ]]; then
|
if [[ -e "${S%% *}" ]]; then
|
||||||
write "\t@echo '$(RM ${target})'"
|
write "\t@echo '$(RM ${target})'"
|
||||||
write "\t${Q}rm -f ${target}"
|
write "\t${Q}rm -f ${target}"
|
||||||
fi
|
fi
|
||||||
|
@ -59,10 +59,3 @@ function sharedlib.uninstall {
|
|||||||
write
|
write
|
||||||
}
|
}
|
||||||
|
|
||||||
function sharedlib.clean {
|
|
||||||
write "${target}.clean:"
|
|
||||||
write "\t@echo '$(RM ${target})'"
|
|
||||||
write "\t${Q}rm -f ${target}"
|
|
||||||
write
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -37,10 +37,3 @@ function staticlib.uninstall {
|
|||||||
write
|
write
|
||||||
}
|
}
|
||||||
|
|
||||||
function staticlib.clean {
|
|
||||||
write "${target}.clean:"
|
|
||||||
write "\t@echo '$(RM ${target})'"
|
|
||||||
write "\t${Q}rm -f ${target}"
|
|
||||||
write
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user