56 lines
1.6 KiB
Bash
Executable file
56 lines
1.6 KiB
Bash
Executable file
#!/bin/sh
|
|
#******************************************************************************#
|
|
# Arguments #
|
|
#******************************************************************************#
|
|
# Initialize the variables
|
|
no_file=
|
|
version=
|
|
|
|
# Read the arguments
|
|
for arg ; do case "$arg" in
|
|
--no-file) no_file=y ;;
|
|
--version=*) version="${arg#*=}" ;;
|
|
*) echo "'${arg}': Did not read." ;;
|
|
esac; done
|
|
|
|
# Make version as numbers
|
|
vnum=$(echo ${version} | cut -d- -f1)
|
|
version_major=$(( $(echo ${vnum} | cut -d. -f1) ))
|
|
version_minor=$(( $(echo ${vnum} | cut -s -d. -f2) ))
|
|
version_rev=$(( $(echo ${vnum} | cut -s -d. -f3) ))
|
|
version_indev=$(echo ${version} | cut -s -d- -f2)
|
|
version_indev=$([ ${version_indev} ] && echo 1 || echo 0)
|
|
|
|
# Constitute version thingies
|
|
version_num=$(printf "0x%02X%02X%04X" \
|
|
${version_major} ${version_minor} ${version_rev})
|
|
|
|
#******************************************************************************#
|
|
# Write the file #
|
|
#******************************************************************************#
|
|
# Beginning
|
|
cat <<_EOF
|
|
#ifndef LIBG1M_CONFIG_H
|
|
# define LIBG1M_CONFIG_H
|
|
# define LIBG1M_VERSION "${version}"
|
|
# define LIBG1M_VERNUM ${version_num}
|
|
# define LIBG1M_MAJOR ${version_major}
|
|
# define LIBG1M_MINOR ${version_minor}
|
|
# define LIBG1M_REV ${version_rev}
|
|
# define LIBG1M_INDEV ${version_indev}
|
|
|
|
_EOF
|
|
|
|
# File part
|
|
if [ "$no_file" ]; then cat <<_EOF
|
|
/* FILE interface is disabled */
|
|
# define G1M_DISABLED_FILE 1
|
|
|
|
_EOF
|
|
fi
|
|
|
|
# End of the file
|
|
cat <<_EOF
|
|
#endif /* LIBG1M_CONFIG_H */
|
|
_EOF
|