File indexing completed on 2024-11-17 05:08:35
0001 #!/usr/bin/env bash 0002 0003 # Create Makefile.in and Makefile in a directory (containing a Makefile.am !) 0004 # Saves time compared to re-running configure completely 0005 0006 if [ $# -ne 1 ]; then 0007 echo "$0 : creates a Makefile from a Makefile.am" 0008 echo 0009 echo "Usage : $0 relativepath/Makefile" 0010 echo "So the argument is the file you want to create." 0011 echo 0012 else 0013 if test -f config.status && test -f configure; then 0014 : 0015 else 0016 if test ! -f Makefile && test -n "$OBJ_SUBDIR"; then 0017 cd $OBJ_SUBDIR 0018 else 0019 if test ! -f Makefile && test -n "$OBJ_REPLACEMENT"; then 0020 objdir=`pwd | sed -e "$OBJ_REPLACEMENT"` 0021 cd $objdir 0022 fi 0023 fi 0024 0025 if test ! -f Makefile && test -n "$OBJ_SUBDIR"; then 0026 cd $OBJ_SUBDIR 0027 fi 0028 0029 if test ! -f Makefile; then 0030 echo "$0: in the current directory there is no Makefile" 0031 echo "you will have to run it from the top build dir." 0032 echo "if you do not have a Makefile there - rerun configure" 0033 exit 0034 fi 0035 0036 fi 0037 0038 # Handle arg with missing "/Makefile" 0039 relpath=$1 0040 if test -n "`echo $relpath | grep \/$`"; then 0041 relpath=`echo $relpath | sed 's/\/$//'` 0042 fi 0043 if test -z "`echo $relpath | grep 'Makefile$'`"; then 0044 relpath="$relpath/Makefile" 0045 fi 0046 0047 # Strip leading ./, otherwise config.status chokes 0048 relpath=`echo "$relpath" | sed -e 's,^\./,,'` 0049 0050 # Go up to toplevel dir 0051 while test ! -f config.status; do 0052 relpath="`basename $PWD`/$relpath" 0053 cd .. 0054 done 0055 0056 # Find out top_srcdir. 0057 top_srcdir=`egrep '^top_srcdir *=' Makefile | sed -e "s#top_srcdir *= *##"` 0058 0059 ( 0060 if cd $top_srcdir ; then 0061 # Check if unsermake or automake was used to create the toplevel Makefile.in 0062 # (the one in $relpath might not exist yet) 0063 if test -n "`sed -n -e '1p' Makefile.in | grep unsermake`"; then 0064 if test -n "`sed -n -e '1p' Makefile.in | grep automake`"; then # old unsermake 0065 if test -z "$UNSERMAKE"; then 0066 echo "unsermake was used to build this module, but \$UNSERMAKE isn't set!" 0067 exit 1 0068 fi 0069 $UNSERMAKE $relpath 0070 exit 2 0071 else # new unsermake 0072 UNSERMAKE=`type -p unsermake` 0073 if test ! -x "$UNSERMAKE"; then 0074 echo 'Makefile was created with unsermake, but there' 0075 echo 'is no unsermake in $PATH' 0076 exit 1 0077 fi 0078 $UNSERMAKE -c $relpath 0079 fi 0080 else 0081 # Suck in AUTOCONF/AUTOMAKE detection code 0082 UNSERMAKE=no 0083 eval `admin/detect-autoconf.pl` 0084 /bin/sh admin/missing --run $AUTOMAKE $relpath || exit 0085 if test -f admin/am_edit; then perl admin/am_edit $relpath.in ;\ 0086 else 0087 if test -f ../admin/am_edit; then perl ../admin/am_edit $relpath.in ; \ 0088 fi 0089 fi 0090 fi 0091 fi 0092 ) 0093 case $? in 0094 1) 0095 exit 1 0096 ;; 0097 2) 0098 createrulesfile="true" 0099 ;; 0100 *) 0101 ;; 0102 esac 0103 if test -f `dirname $relpath`; then 0104 rm `dirname $relpath` 0105 fi 0106 CONFIG_FILES=$relpath CONFIG_HEADERS= ./config.status 0107 if test "$createrulesfile" = "true"; then 0108 CONFIG_FILES="$relpath.rules $relpath.calls" CONFIG_HEADERS= ./config.status 0109 fi 0110 fi