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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
#! /bin/sh
modulesfile=modules
topdir=..
output=$topdir/Makefile
cat > $output <<EOF
#
# Makefile for dcmtk (DICOM Toolkit)
#
SHELL = /bin/sh
configdir = config
include \$(configdir)/Makefile.def
EOF
if test -f "$modulesfile" ; then
tmpmodules=`cat $modulesfile`
else
tmpmodules=`(cd $topdir; ls)`
fi
for dir in $tmpmodules; do
if test -d $topdir/$dir ; then
modules="$modules $dir"
fi
done
modules=`echo $modules | sed -e "s/config//g" | sed -e "s/doxygen//g" | sed -e "s/CVS//g"`
for module in config $modules; do
makeall="$makeall ${module}-all"
if test $module != config ; then
makelibsrcall="$makelibsrcall ${module}-libsrc-all"
fi
makeinstall="$makeinstall ${module}-install"
makeinstallbin="$makeinstallbin ${module}-install-bin"
makeinstalldoc="$makeinstalldoc ${module}-install-doc"
makeinstalldata="$makeinstalldata ${module}-install-data"
makeinstalletc="$makeinstalletc ${module}-install-etc"
makeinstalllib="$makeinstalllib ${module}-install-lib"
makeinstallinclude="$makeinstallinclude ${module}-install-include"
makeinstallsupport="$makeinstallsupport ${module}-install-support"
done
cat >> $output <<EOF
all: $makeall
libsrc-all: $makelibsrcall
install: $makeinstall dcmtk-install-doc install-man
install-all: install install-lib install-html
install-bin: $makeinstallbin
install-doc: $makeinstalldoc
install-data: $makeinstalldata
install-etc: $makeinstalletc
install-lib: $makeinstalllib
install-include: $makeinstallinclude
install-support: $makeinstallsupport
dcmtk-install-doc:
\$(configdir)/mkinstalldirs \$(DESTDIR)\$(docdir)
for file in ANNOUNCE.\$(PACKAGE_VERSION_NUMBER) CHANGES.\$(PACKAGE_VERSION_NUMBER) FAQ HISTORY VERSION; do \\
\$(INSTALL_DATA) \$\$file \$(DESTDIR)\$(docdir) ;\\
done
install-man:
(cd doxygen && \$(MAKE) DESTDIR="\$(DESTDIR)" install-man)
install-html:
(cd doxygen && \$(MAKE) DESTDIR="\$(DESTDIR)" install-html)
man:
(cd doxygen && \$(MAKE) DESTDIR="\$(DESTDIR)" man)
html:
(cd doxygen && \$(MAKE) DESTDIR="\$(DESTDIR)" html)
EOF
for module in config $modules; do
cat >> $output <<EOF
${module}-all:
(cd $module && \$(MAKE) ARCH="\$(ARCH)" DESTDIR="\$(DESTDIR)" all)
${module}-libsrc-all:
(cd $module && \$(MAKE) ARCH="\$(ARCH)" DESTDIR="\$(DESTDIR)" libsrc-all)
${module}-install:
(cd $module && \$(MAKE) ARCH="\$(ARCH)" DESTDIR="\$(DESTDIR)" install)
${module}-install-bin:
(cd $module && \$(MAKE) ARCH="\$(ARCH)" DESTDIR="\$(DESTDIR)" install-bin)
${module}-install-doc:
(cd $module && \$(MAKE) ARCH="\$(ARCH)" DESTDIR="\$(DESTDIR)" install-doc)
${module}-install-data:
(cd $module && \$(MAKE) ARCH="\$(ARCH)" DESTDIR="\$(DESTDIR)" install-data)
${module}-install-etc:
(cd $module && \$(MAKE) ARCH="\$(ARCH)" DESTDIR="\$(DESTDIR)" install-etc)
${module}-install-lib:
(cd $module && \$(MAKE) ARCH="\$(ARCH)" DESTDIR="\$(DESTDIR)" install-lib)
${module}-install-include:
(cd $module && \$(MAKE) ARCH="\$(ARCH)" DESTDIR="\$(DESTDIR)" install-include)
${module}-install-support:
(cd $module && \$(MAKE) ARCH="\$(ARCH)" DESTDIR="\$(DESTDIR)" install-support)
EOF
done
for tag in dependencies clean distclean ; do
echo "${tag}:" >> $output
for module in $modules; do
echo " (cd ${module} && \$(MAKE) ${tag})" >> $output
done
if test $tag != dependencies ; then
echo " (cd doxygen && \$(MAKE) ${tag})" >> $output
fi
echo " -(cd config && \$(MAKE) ${tag})" >> $output
if test $tag = clean ; then
echo " rm -f \$(TRASH)" >> $output
elif test $tag = distclean ; then
echo " rm -f \$(TRASH)" >> $output
fi
echo >> $output
done
output=$topdir/configure
cat > $output <<EOF
#! /bin/sh
if test -d config ; then
if test -f config/$modulesfile ; then
tmp=\`cat config/modules\`
modules=\`ls -d \$tmp\`
else
for dir in \`ls\`; do
if test -d \$dir ; then
modules="\$modules \$dir"
fi
done
fi
modules=\`echo \$modules | sed -e "s/config//g" | sed -e "s/CVS//g"\`
modules="config \$modules doxygen"
else
echo "Cannot find configure directory (config or ../config)"
exit 1
fi
if test "x--help" = "x\$*"; then
config/configure --help
elif test "x--help=short" = "x\$*"; then
config/configure --help=short
elif test "x--help=recursive" = "x\$*"; then
config/configure --help=recursive
elif test "x--version" = "x\$*"; then
config/configure --version
else
for module in \$modules ; do
echo "Running configure for module \$module."
(cd \$module && ./configure \$* )
done
fi
EOF
chmod 755 $output
|