Thank you very much Sergey Matveev.  I have studied your proposed redo files 
for st and learned a lot.  Here are my new and improved (you had a bug in 
default.o.do in that you forgot to depend on $src) redo files for st.  Please 
take a look and tell me what you think.

Note that there are neither 'options' nor 'all' targets for simplicity--I don't 
that they are very useful.  The redo command has the -x and -v options if you 
want more details.  Also, I de-automated your automatic generation of the 
source (.c) and object (.o) files because it didn't work properly as you 
discussed in your message.  If it's going to be automatic, I want it to work 
automatically.

---- config.rc ----

CC=${CC:-cc}
VERSION=0.8.4
PREFIX=/usr/local
MANPREFIX=${PREFIX}/share/man
X11INC=/usr/X11R6/include
X11LIB=/usr/X11R6/lib
PKG_CONFIG=pkg-config

INCS="-I${X11INC}"
INCS="$INCS `${PKG_CONFIG} --cflags fontconfig`"
INCS="$INCS `${PKG_CONFIG} --cflags freetype2`"

LIBS="-L${X11LIB} -lm -lrt -lX11 -lutil -lXft"
LIBS="$LIBS `${PKG_CONFIG} --libs fontconfig`"
LIBS="$LIBS `${PKG_CONFIG} --libs freetype2`"

STCPPFLAGS="-DVERSION=\"${VERSION}\" -D_XOPEN_SOURCE=600"
STCFLAGS="${INCS} ${STCPPFLAGS} ${CPPFLAGS} ${CFLAGS}"
STLDFLAGS="${LIBS} ${LDFLAGS}"

OBJ="st.o x.o"

---- clean.do ----

redo-ifchange config.rc
. ./config.rc
rm -f st $OBJ st-${VERSION}.tar.gz

---- default.o.do ----

src=$2.c
redo-ifchange $src config.rc `sed -n 's/#include "\(.*\)"$/\1/p' $src`
. ./config.rc
printf 'recompiling %s\n' $2.c >&2
$CC $STCFLAGS -o $3 -c $2.c

---- st.do ----

redo-ifchange config.rc
. ./config.rc
redo-ifchange $OBJ
printf 'relinking\n' >&2
$CC -o $3 $OBJ $STLDFLAGS

Reply via email to