diff --git a/make/make.mk b/make/make.mk index b3764027..27d64e80 100644 --- a/make/make.mk +++ b/make/make.mk @@ -37,8 +37,11 @@ install-links: do-install-links: @$(call install_links,MAKE) -$(BUILD_PKG_CONFIG): $(PROJECT_DESCR_FILE) - /bin/bash $(MOD_SCRIPT_DIR)/create-pkg-config.sh $< > $@.tmp +$(BUILD_PKG_CONFIG): $(PROJECT_DESCR_FILE) $(MODDIR)/make/make.mk $(MOD_SCRIPT_DIR)/create-pkg-config.sh + /bin/bash $(MOD_SCRIPT_DIR)/create-pkg-config.sh \ + -d "$(PROJECT_DESCR)" \ + -F $< \ + > $@.tmp mv $@.tmp $@ clean.pkg-config: diff --git a/scripts/create-pkg-config.sh b/scripts/create-pkg-config.sh index e750d646..cc95da40 100644 --- a/scripts/create-pkg-config.sh +++ b/scripts/create-pkg-config.sh @@ -1,21 +1,62 @@ #!/bin/bash +usage() +{ + cat <<- EOT | sed 's/^ *|//' + | + | $myname [options] + | + | options are + | + | -h: display this help message and exit sucessfully + | -F filename read project description file + | -d "description" use description + | + EOT + goodbye $1 +} + set -e -# ytools_config_files="$1" -. ytools-functions.sh -descr=`_ytools_cat_section "$1" description` +project_descr_file="$1" +myname=`basename $0` + +eval set -- `getopt -- F:d: "$@"` + +while [ "$1" != -- ]; do +case $1 in + -h) + usage 0;; + -F) + project_descr_file="$2" + shift + ;; + -d) + description="$2" + shift + ;; + *) + usage 1;; +esac +shift +done +shift + +[ -r "$project_descr_file" ] && { + . ytools-functions.sh + descr=`_ytools_cat_section "$project_descr_file" description` +} cat <<-EOT prefix=/usr -exec_prefix=${prefix} -includedir=${prefix}/include -libdir=${exec_prefix}/lib +exec_prefix=\${prefix} +includedir=\${prefix}/include +libdir=\${exec_prefix}/lib Name: foo Description: $descr Version: 1.0.0 -Cflags: -I${includedir}/foo -Libs: -L${libdir} -lfoo +Cflags: -I\${includedir}/foo +Libs: -L\${libdir} -lfoo EOT