2014-11-05 13:32:11 +01:00
|
|
|
|
|
|
|
function binary.build {
|
|
|
|
write -n "${target}:"
|
|
|
|
for i in ${src[@]}; do
|
|
|
|
write -n " ${i%.*}.o"
|
|
|
|
done
|
|
|
|
write " ${depends[$target]}"
|
|
|
|
write "\t@echo '$(LD ${target})'"
|
2015-04-05 11:00:54 +02:00
|
|
|
write -n "\t$Q\$(CC) -o ${target} \$(LDFLAGS)"
|
|
|
|
write -n " ${src[@]//.c/.o}"
|
|
|
|
write " ${ldflags[$target]}"
|
2014-11-05 13:32:11 +01:00
|
|
|
write
|
|
|
|
|
|
|
|
for i in ${src[@]}; do
|
2015-04-06 22:42:56 +02:00
|
|
|
targets+=("${i%.c}.o")
|
|
|
|
type[${i%.c}.o]=ofile
|
|
|
|
auto[${i%.c}.o]=true
|
|
|
|
cflags[${i%.c}.o]="${cflags[$target]}"
|
2014-11-05 13:32:11 +01:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
function binary.install {
|
|
|
|
local install="${install[$target]:-\$(BINDIR)}"
|
2015-04-06 23:00:08 +02:00
|
|
|
local basename="$(basename "${target}")"
|
2014-11-05 13:32:11 +01:00
|
|
|
write "${target}.install: ${target}"
|
2015-04-06 23:00:08 +02:00
|
|
|
write "\t@echo '$(IN "${install}/${basename}")'"
|
2015-04-06 22:42:56 +02:00
|
|
|
write "\t${Q}mkdir -p '\$(DESTDIR)${install}'"
|
2015-04-06 23:00:08 +02:00
|
|
|
write "\t${Q}install -m0755 ${target} \$(DESTDIR)${install}/${basename}"
|
2014-11-05 13:32:11 +01:00
|
|
|
write
|
|
|
|
}
|
|
|
|
|
|
|
|
function binary.uninstall {
|
|
|
|
local install="${install[$target]:-\$(BINDIR)}"
|
2015-04-06 23:00:08 +02:00
|
|
|
local basename="$(basename "${target}")"
|
2014-11-05 13:32:11 +01:00
|
|
|
write "${target}.uninstall:"
|
2015-04-06 23:00:08 +02:00
|
|
|
write "\t@echo '$(RM ${install}/${basename})'"
|
|
|
|
write "\t${Q}rm -f '\$(DESTDIR)${install}/${basename}'"
|
2014-11-05 13:32:11 +01:00
|
|
|
write
|
|
|
|
}
|
|
|
|
|
|
|
|
function binary.clean {
|
|
|
|
write "${target}.clean:"
|
|
|
|
write "\t@echo '$(RM ${target})'"
|
|
|
|
write "\t${Q}rm -f ${target}"
|
|
|
|
write
|
|
|
|
}
|
|
|
|
|