Add install and uninstall recipes.

This commit is contained in:
Jordan Bancino 2023-10-02 16:02:35 -04:00
parent 8395a05807
commit dcbb488f7d

36
configure vendored
View file

@ -108,7 +108,7 @@ collect() {
prefix="$4" prefix="$4"
exec="$5" exec="$5"
find "${from}" -name "*${orig_ext}" | while IFS= read -r src; do find "${from}" -name "*${orig_ext}" -type f | while IFS= read -r src; do
src=$(echo "$src" | sed -e "s|^${from}||g") src=$(echo "$src" | sed -e "s|^${from}||g")
obj=$(echo "$src" | sed -e "s|${orig_ext}\$|${new_ext}|g") obj=$(echo "$src" | sed -e "s|${orig_ext}\$|${new_ext}|g")
@ -154,6 +154,27 @@ compile_doc() {
echo "${TAB}${OUT}/bin/hdoc -D \"Os=${LIB_NAME}\" -i \"${src}\" -o \"${out}\"" echo "${TAB}${OUT}/bin/hdoc -D \"Os=${LIB_NAME}\" -i \"${src}\" -o \"${out}\""
} }
install_out() {
src="$1"
out="$2"
echo "${TAB}install -D \"$src\" \"$out\""
}
install_man() {
src="${OUT}/man/man3/${LIB_NAME}-$(basename $1 .h).3"
out="$2"
echo "${TAB}install -D \"$src\" \"$out\""
}
uninstall_out() {
src="$1"
out="$2"
echo "${TAB}rm \"$out\""
}
echo "Generating Makefile..." echo "Generating Makefile..."
OBJS=$(collect ${SRC}/ .c .o ${BUILD}/ print_obj) OBJS=$(collect ${SRC}/ .c .o ${BUILD}/ print_obj)
@ -193,6 +214,19 @@ ${TAB}done
${LIB_NAME}: ${OUT}/lib/${LIB_NAME}.o ${OUT}/lib/lib${LIB_NAME}.a ${OUT}/lib/lib${LIB_NAME}.so ${LIB_NAME}: ${OUT}/lib/${LIB_NAME}.o ${OUT}/lib/lib${LIB_NAME}.a ${OUT}/lib/lib${LIB_NAME}.so
install: ${LIB_NAME}
${TAB}install -D ${OUT}/lib/${LIB_NAME}.o \$(PREFIX)/lib/${LIB_NAME}.o
${TAB}install -D ${OUT}/lib/lib${LIB_NAME}.a \$(PREFIX)/lib/lib${LIB_NAME}.a
${TAB}install -D ${OUT}/lib/lib${LIB_NAME}.so \$(PREFIX)/lib/lib${LIB_NAME}.so
$(collect ${INCLUDE}/ '' '' \$\(PREFIX\)/include/${LIB_NAME}/ install_out)
$(collect ${INCLUDE}/ .h .3 \$\(PREFIX\)/man/man3/${LIB_NAME}- install_man)
uninstall:
${TAB}rm -r \$(PREFIX)/lib/${LIB_NAME}.*
${TAB}rm -r \$(PREFIX)/lib/lib${LIB_NAME}.*
${TAB}rm -r \$(PREFIX)/include/${LIB_NAME}
${TAB}rm -r \$(PREFIX)/man/man3/${LIB_NAME}-*
clean: clean:
${TAB}rm -r "${BUILD}" "${OUT}" ${TAB}rm -r "${BUILD}" "${OUT}"