Removed most hardcoded variables.
This commit is contained in:
parent
9cbf1debce
commit
26a33cca52
10
Makefile
10
Makefile
@ -8,12 +8,6 @@ SHAREDIR := $(PREFIX)/share
|
|||||||
INCLUDEDIR := $(PREFIX)/include
|
INCLUDEDIR := $(PREFIX)/include
|
||||||
MANDIR := $(SHAREDIR)/man
|
MANDIR := $(SHAREDIR)/man
|
||||||
|
|
||||||
CC := cc
|
|
||||||
AR := ar
|
|
||||||
RANLIB := ranlib
|
|
||||||
CFLAGS :=
|
|
||||||
LDFLAGS :=
|
|
||||||
|
|
||||||
Q := @
|
Q := @
|
||||||
|
|
||||||
all: build.zsh build/binary.zsh build/crystal.zsh build/header.zsh build/library.zsh build/livescript.zsh build/man.zsh build/moon.zsh build/ofile.zsh build/sass.zsh build/scdocman.zsh build/script.zsh build/sharedlib.zsh build/staticlib.zsh
|
all: build.zsh build/binary.zsh build/crystal.zsh build/header.zsh build/library.zsh build/livescript.zsh build/man.zsh build/moon.zsh build/ofile.zsh build/sass.zsh build/scdocman.zsh build/script.zsh build/sharedlib.zsh build/staticlib.zsh
|
||||||
@ -320,10 +314,6 @@ help:
|
|||||||
@echo ' - uninstall Deinstalls the project.'
|
@echo ' - uninstall Deinstalls the project.'
|
||||||
@echo ''
|
@echo ''
|
||||||
@echo 'CLI-modifiable variables:'
|
@echo 'CLI-modifiable variables:'
|
||||||
@echo ' - CC ${CC}'
|
|
||||||
@echo ' - CFLAGS ${CFLAGS}'
|
|
||||||
@echo ' - LDFLAGS ${LDFLAGS}'
|
|
||||||
@echo ' - DESTDIR ${DESTDIR}'
|
|
||||||
@echo ' - PREFIX ${PREFIX}'
|
@echo ' - PREFIX ${PREFIX}'
|
||||||
@echo ' - BINDIR ${BINDIR}'
|
@echo ' - BINDIR ${BINDIR}'
|
||||||
@echo ' - LIBDIR ${LIBDIR}'
|
@echo ' - LIBDIR ${LIBDIR}'
|
||||||
|
24
build.zsh.in
24
build.zsh.in
@ -75,6 +75,18 @@ function has {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function has_array_key {
|
||||||
|
local element="$1"
|
||||||
|
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
for key value ($@) {
|
||||||
|
[[ "$key" == "$element" ]] && return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
# Specialized helpers
|
# Specialized helpers
|
||||||
|
|
||||||
function get_distfiles {
|
function get_distfiles {
|
||||||
@ -211,13 +223,6 @@ function main {
|
|||||||
|
|
||||||
write
|
write
|
||||||
|
|
||||||
write "CC := ${CC:-cc}"
|
|
||||||
write "AR := ${AR:-ar}"
|
|
||||||
write "RANLIB := ${RANLIB:-ranlib}"
|
|
||||||
write "CFLAGS := ${CFLAGS}"
|
|
||||||
write "LDFLAGS := ${LDFLAGS}"
|
|
||||||
write
|
|
||||||
|
|
||||||
write "Q := @"
|
write "Q := @"
|
||||||
write
|
write
|
||||||
|
|
||||||
@ -444,15 +449,12 @@ function main {
|
|||||||
|
|
||||||
write " @echo ''"
|
write " @echo ''"
|
||||||
write " @echo '${fg_bold[white]}CLI-modifiable variables:${reset_color}'"
|
write " @echo '${fg_bold[white]}CLI-modifiable variables:${reset_color}'"
|
||||||
for VAR in CC CFLAGS LDFLAGS DESTDIR; do
|
for VAR __ in ${variables}; 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 ${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}'"
|
||||||
|
@ -1,4 +1,18 @@
|
|||||||
|
|
||||||
|
function binary.prelude {
|
||||||
|
has_array_key CC $variables || \
|
||||||
|
variables+=(CC "cc")
|
||||||
|
has_array_key CXX $variables || \
|
||||||
|
variables+=(CXX "c++")
|
||||||
|
has_array_key LD $variables || \
|
||||||
|
variables+=(LD "\${CC}")
|
||||||
|
|
||||||
|
for variable in CFLAGS CXXFLAGS LDFLAGS; do
|
||||||
|
has_array_key $variable $variables || \
|
||||||
|
variables+=($variable " ")
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
function binary.build {
|
function binary.build {
|
||||||
write -n "${target}:"
|
write -n "${target}:"
|
||||||
for i in ${src[@]}; do
|
for i in ${src[@]}; do
|
||||||
|
@ -1,15 +1,6 @@
|
|||||||
|
|
||||||
function crystal.prelude {
|
function crystal.prelude {
|
||||||
local has_crflags=false
|
if ! has_array_key CRFLAGS; then
|
||||||
|
|
||||||
for variable value in ${variables[@]}; do
|
|
||||||
if [[ "$variable" == "CRFLAGS" ]]; then
|
|
||||||
has_crflags=true
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if ! $has_crflags; then
|
|
||||||
variables+=(CRFLAGS "--release")
|
variables+=(CRFLAGS "--release")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
|
||||||
|
function library.prelude {
|
||||||
|
binary.prelude "$@"
|
||||||
|
}
|
||||||
|
|
||||||
function library.build {
|
function library.build {
|
||||||
write -n "${target}: ${target}.so ${target}.a $(dirdep $target)"
|
write -n "${target}: ${target}.so ${target}.a $(dirdep $target)"
|
||||||
write
|
write
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
|
||||||
|
function ofile.prelude {
|
||||||
|
binary.prelude "$@"
|
||||||
|
}
|
||||||
|
|
||||||
function ofile.build {
|
function ofile.build {
|
||||||
local dirname="$(dirname "$target")"
|
local dirname="$(dirname "$target")"
|
||||||
write -n "${target}: ${target%.o}.c $(dirdep $target "${target%.o}.c ${sources[$target]}" "${depends[@target]}")"
|
write -n "${target}: ${target%.o}.c $(dirdep $target "${target%.o}.c ${sources[$target]}" "${depends[@target]}")"
|
||||||
|
Loading…
Reference in New Issue
Block a user