diff --git a/configure b/configure index 7ce12e3..65df084 100755 --- a/configure +++ b/configure @@ -108,7 +108,7 @@ collect() { prefix="$4" 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") 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}\"" } +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..." 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 +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: ${TAB}rm -r "${BUILD}" "${OUT}"