Hash :
94046104
Author :
Thomas de Grivel
Date :
2020-02-24T15:19:27
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
#! /bin/sh
#
# This is part of Patchwork13! the real-time data synthesis toolkit.
# http://patchwork13.sourceforge.net/
#
# pw13_std - the patchwork13 standard patches library
# Copyright (C) 2005 Thomas de Grivel <billitch@yahoo.fr>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##
#
# pw13-makefile-am - Generate or update Makefile.am for a patch library dir
#
##
ME=$(basename $0)
PW13=pw13-0
SRC=.pw13src
PREV_SRC=${SRC}'~'
if [ -z "$1" ] || [ -z "$2" ]
then {
echo "Usage: $ME libname topdir [subdir]"
exit 1
}
fi
LIBNAME="$1"
TOPDIR="$2"
SUBDIR="$3"
DIR=$(pwd)
test -e $SRC && (
cp -f $SRC $PREV_SRC || (
echo "${ME}: I need write access to ${PREV_SRC} !"
exit 2
)
)
ls *.pw13*.[ch] 2>/dev/null > $SRC
[ -e Makefile.am ] &&
diff --brief $SRC $PREV_SRC 2>/dev/null >/dev/null && (
echo "${ME}: Makefile.am is up to date.";
rm -f ${PREV_SRC};
true ) && exit 0
rm -f ${PREV_SRC}
PATCHES=$(echo $(ls *.pw13p.c *.pw13p.cc 2>/dev/null | awk -F . '{print $1"."$2".la"}'))
DT_HEADERS=$(ls *.pw13dt.h *.pw13dt.hh 2> /dev/null)
DT_LIBS=$(echo $(ls *.pw13dt.c *.pw13dt.cc 2>/dev/null | awk -F . '{print $1"."$2".la"}'))
libname="`echo "$LIBNAME" | tr [a-z] [A-Z]`"
{
echo '# Makefile.am - generated by pw13-makefile-am'
echo
echo 'AUTOMAKE_OPTIONS = gnu'
# echo 'CONFIGURE_DEPENDENCIES = pw13sources'
echo
echo "patchdir=\$(libdir)/$PW13/$LIBNAME/$SUBDIR"
echo 'patch_LTLIBRARIES =' $PATCHES $DT_LIBS
echo
echo "INCLUDES=\$(PW13_CFLAGS) \$(PW13_${libname}_CFLAGS)"
echo
if test -n ${DT_HEADERS}; then
echo 'library_include_HEADERS =' $DT_HEADERS
echo 'library_includedir=$(includedir)/'$PW13'/'$LIBNAME
echo
fi
echo 'pw13_patch_class.def:'
echo ' echo "EXPORT" > pw13_patch_class.def'
echo ' echo " pw13_dl_patch_class_init" >> pw13_patch_class.def'
echo
echo 'if OS_WIN32'
echo 'win32_cflags = -DWIN32'
echo 'pw13_patch_class_win32_symbols = ' \
'-export-symbols pw13_patch_class.def'
echo 'endif'
echo 'INCLUDES += ${win32_cflags}'
echo
for PATCH_SRC in $(ls *.pw13p.c *.pw13p.cc *.pw13dt.c 2>/dev/null); do
PATCH_SRC_BASE=$(basename $PATCH_SRC .c)
PATCH_SRC_BASE=$(basename $PATCH_SRC_BASE .cc)
PATCH_SRC_=$(echo $PATCH_SRC_BASE | tr -c '[:alnum:][:space:]' '_')
PATCH_LDFLAGS=$(grep patch_class_LDFLAGS $PATCH_SRC \
| awk -F '=' '{print $2}')
echo 'if OS_WIN32'
echo "${PATCH_SRC}: pw13_patch_class.def"
echo 'endif'
echo "${PATCH_SRC_}_la_SOURCES = ${PATCH_SRC}"
# echo "${PATCH_SRC_}_la_CFLAGS = -W -Wall"
echo "${PATCH_SRC_}_la_LDFLAGS = -module -no-undefined ${PATCH_LDFLAGS} "\
'$(pw13_patch_class_win32_symbols)'
echo "${PATCH_SRC_}_la_LIBADD = \$(PW13_LIBS) \$(PW13_${libname}_LIBS)"
done
echo
echo 'CLEANFILES = pw13_patch_class.def'
echo
echo 'Makefile.am: pw13sources'
echo '.PHONY: pw13sources'
echo 'pw13sources:'
echo " $0 $*; \\"
echo " R=$\$?; \\"
echo " if [ $\$R -ne 0 ]; then \\"
echo " if [ $\$R -eq 42 ]; then \\"
echo " echo \"pw13-makefile-am: updating $SUBDIR/Makefile\" && \\"
echo " cd $TOPDIR && \\"
echo " automake --gnu $SUBDIR/Makefile && \\"
echo " ./config.status $SUBDIR/Makefile && \\"
echo " \${MAKE} -C ${SUBDIR}; \\"
echo " else \\"
echo " exit $\$R; \\"
echo " fi; \\"
echo " fi"
echo
echo "EXTRA_DIST = $SRC"
} > Makefile.am
echo "$ME: Updated Makefile.am"
exit 42