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.master
parent
7cc71afbe7
commit
711e92c22d
24
Makefile
24
Makefile
|
@ -15,7 +15,7 @@ LDFLAGS :=
|
|||
|
||||
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
|
||||
@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'
|
||||
$(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.install: build/ofile.zsh
|
||||
|
@ -129,12 +142,12 @@ $(DESTDIR)$(SHAREDIR):
|
|||
$(DESTDIR)$(INCLUDEDIR):
|
||||
@echo '[01;35m [DIR] [01;37m$(INCLUDEDIR)[00m'
|
||||
$(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:
|
||||
|
||||
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:
|
||||
|
@ -144,7 +157,7 @@ test: all subdirs 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
|
||||
|
||||
|
@ -161,6 +174,7 @@ $(PACKAGE)-$(VERSION).tar.gz: distdir
|
|||
$(Q)tar czf $(PACKAGE)-$(VERSION).tar.gz \
|
||||
$(PACKAGE)-$(VERSION)/build/binary.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/library.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/moon.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/ofile.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/script.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/sharedlib.zsh \
|
||||
|
@ -174,6 +188,7 @@ $(PACKAGE)-$(VERSION).tar.xz: distdir
|
|||
$(Q)tar cJf $(PACKAGE)-$(VERSION).tar.xz \
|
||||
$(PACKAGE)-$(VERSION)/build/binary.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/library.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/moon.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/ofile.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/script.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/sharedlib.zsh \
|
||||
|
@ -187,6 +202,7 @@ $(PACKAGE)-$(VERSION).tar.bz2: distdir
|
|||
$(Q)tar cjf $(PACKAGE)-$(VERSION).tar.bz2 \
|
||||
$(PACKAGE)-$(VERSION)/build/binary.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/library.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/moon.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/ofile.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/script.zsh \
|
||||
$(PACKAGE)-$(VERSION)/build/sharedlib.zsh \
|
||||
|
|
53
build.zsh.in
53
build.zsh.in
|
@ -116,7 +116,9 @@ function subdirs {
|
|||
|
||||
function get_distfiles {
|
||||
for file in "${dist[@]}" $(echo ${sources[@]}) $(echo ${depends[@]}); do
|
||||
echo "$file"
|
||||
if [[ -z "${nodist[$file]}" ]]; then
|
||||
echo "$file"
|
||||
fi
|
||||
done
|
||||
|
||||
typeset -a src
|
||||
|
@ -184,7 +186,7 @@ done
|
|||
|
||||
function main {
|
||||
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=(
|
||||
PREFIX '/usr/local'
|
||||
|
@ -278,18 +280,28 @@ function main {
|
|||
fi
|
||||
fi
|
||||
|
||||
if exists "${type[$target]}.install"; then
|
||||
${type[$target]}.install
|
||||
if [[ "${installdir}" == "-" ]]; then
|
||||
write "${target}.install:"
|
||||
write ""
|
||||
else
|
||||
if [[ -z "${installdir}" ]]; then
|
||||
error "No install[${type[${target}]}] and no default installation directory."
|
||||
error "Your “install” rule will be broken!"
|
||||
if exists "${type[$target]}.install"; then
|
||||
${type[$target]}.install
|
||||
else
|
||||
write "${target}.install: \$(DESTDIR)${installdir}"
|
||||
write "\t@echo '$(IN ${installdir}/${target})'"
|
||||
write "\t@mkdir -p '\$(DESTDIR)/${installdir}'"
|
||||
write "\t${Q}install -m755 $target \$(DESTDIR)${installdir}/$target"
|
||||
write
|
||||
if [[ -z "${installdir}" ]]; then
|
||||
error "No install[${type[${target}]}] and no default installation directory."
|
||||
error "Your “install” rule will be broken!"
|
||||
else
|
||||
local F="${filename[$target]}"
|
||||
if [[ -z "$F" ]]; then
|
||||
F="${target}"
|
||||
fi
|
||||
|
||||
write "${target}.install: \$(DESTDIR)${installdir}"
|
||||
write "\t@echo '$(IN ${installdir}/${filename})'"
|
||||
write "\t@mkdir -p '\$(DESTDIR)/${installdir}'"
|
||||
write "\t${Q}install -m755 $target \$(DESTDIR)${installdir}/$filename"
|
||||
write
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -375,14 +387,14 @@ function main {
|
|||
(( ${#targets[@]} > 0 )) && {
|
||||
for target in ${targets[@]}; do
|
||||
write -n " ${target}.clean"
|
||||
(
|
||||
typeset -a src
|
||||
src=($(echo ${sources[$target]}))
|
||||
#(
|
||||
# typeset -a src
|
||||
# src=($(echo ${sources[$target]}))
|
||||
|
||||
for file in ${src[@]}; do
|
||||
write -n " ${file%.c}.o.clean"
|
||||
done
|
||||
)
|
||||
# for file in ${src[@]}; do
|
||||
# write -n " ${file%.c}.o.clean"
|
||||
# done
|
||||
#)
|
||||
done
|
||||
}
|
||||
write
|
||||
|
@ -460,6 +472,9 @@ function main {
|
|||
for VAR __ in ${prefixes}; do
|
||||
printf " @echo ' - ${fg_bold[blue]}%-14s${fg[white]}\${$VAR}${reset_color}'\n" "$VAR" >> $Makefile
|
||||
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 '${fg_bold[white]}Project targets: ${reset_color}'"
|
||||
|
|
|
@ -21,7 +21,11 @@ function binary.build {
|
|||
|
||||
function binary.install {
|
||||
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 "\t@echo '$(IN "${install}/${basename}")'"
|
||||
write "\t${Q}mkdir -p '\$(DESTDIR)${install}'"
|
||||
|
@ -31,7 +35,11 @@ function binary.install {
|
|||
|
||||
function binary.uninstall {
|
||||
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 "\t@echo '$(RM ${install}/${basename})'"
|
||||
write "\t${Q}rm -f '\$(DESTDIR)${install}/${basename}'"
|
||||
|
@ -39,7 +47,18 @@ function binary.uninstall {
|
|||
}
|
||||
|
||||
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${Q}rm -f ${target}"
|
||||
write
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
function ofile.clean {
|
||||
binary.clean "$@"
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
|
||||
function script.build {
|
||||
typeset -l S
|
||||
|
||||
if [[ -n "${sources[$target]}" ]]; then
|
||||
S="${sources[$target]}"
|
||||
else
|
||||
S="${target}.in"
|
||||
fi
|
||||
|
||||
write -n "${target}:"
|
||||
|
||||
if [[ -e "${target}.in" ]]; then
|
||||
write " ${target}.in"
|
||||
if [[ -e "${S%% *}" ]]; then
|
||||
write " $S"
|
||||
write "\t@echo '$(SED "${target}")'"
|
||||
write -n "\t${Q}sed -e '"
|
||||
write -n "s&@LIBDIR@&\$(LIBDIR)&;"
|
||||
write -n "s&@BINDIR@&\$(BINDIR)&;"
|
||||
write -n "s&@SHAREDIR@&\$(SHAREDIR)&;"
|
||||
write "' '${target}.in' > '${target}'"
|
||||
write "' $S > '${target}'"
|
||||
write "\t${Q}chmod +x '${target}'"
|
||||
fi
|
||||
|
||||
|
@ -25,9 +33,17 @@ function script.uninstall {
|
|||
}
|
||||
|
||||
function script.clean {
|
||||
typeset -l S
|
||||
|
||||
if [[ -n "${sources[$target]}" ]]; then
|
||||
S="${sources[$target]}"
|
||||
else
|
||||
S="${target}.in"
|
||||
fi
|
||||
|
||||
write "${target}.clean:"
|
||||
|
||||
if [[ -e "${target}.in" ]]; then
|
||||
if [[ -e "${S%% *}" ]]; then
|
||||
write "\t@echo '$(RM ${target})'"
|
||||
write "\t${Q}rm -f ${target}"
|
||||
fi
|
||||
|
|
|
@ -59,10 +59,3 @@ function sharedlib.uninstall {
|
|||
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
|
||||
}
|
||||
|
||||
function staticlib.clean {
|
||||
write "${target}.clean:"
|
||||
write "\t@echo '$(RM ${target})'"
|
||||
write "\t${Q}rm -f ${target}"
|
||||
write
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue