readline/Makefile: move up before with no scheme
rename symlink(s) use phony targets, delegate the symlink creation management command sequence to a single point in the project inside the readline/Makefile
This commit is contained in:
parent
80c043db79
commit
acefe4811f
|
|
@ -12,10 +12,9 @@ SRCS = CmdSubrs.c CmdAB.c CmdCD.c CmdE.c CmdFI.c \
|
||||||
|
|
||||||
module: ${MAGICDIR}/readline/readline lib${MODULE}.o
|
module: ${MAGICDIR}/readline/readline lib${MODULE}.o
|
||||||
|
|
||||||
|
# Delegate this task to the readline/Makefile
|
||||||
${MAGICDIR}/readline/readline:
|
${MAGICDIR}/readline/readline:
|
||||||
@if ( ! test -f ${MAGICDIR}/readline/readline ) ; then \
|
${MAKE} -C ${MAGICDIR}/readline readline-create-symlinks
|
||||||
(cd ${MAGICDIR}/readline; ln -s `ls | grep readline` readline) ; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
include ${MAGICDIR}/defs.mak
|
include ${MAGICDIR}/defs.mak
|
||||||
include ${MAGICDIR}/rules.mak
|
include ${MAGICDIR}/rules.mak
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ MAGICDIR = ..
|
||||||
|
|
||||||
include ${MAGICDIR}/defs.mak
|
include ${MAGICDIR}/defs.mak
|
||||||
|
|
||||||
module: readline readline/libreadline.a readline/libhistory.a
|
module: readline-create-symlinks libreadline.a libhistory.a
|
||||||
|
|
||||||
depend:
|
depend:
|
||||||
|
|
||||||
|
|
@ -11,17 +11,58 @@ depend:
|
||||||
# link has been removed, and code is now just in real directory
|
# link has been removed, and code is now just in real directory
|
||||||
# "readline".
|
# "readline".
|
||||||
|
|
||||||
readline:
|
#
|
||||||
|
# The symlink resolves where the source for readline is coming from,
|
||||||
|
# so it is a well known path ${top_builddir}/readline/readline
|
||||||
|
#
|
||||||
|
# For the purpose of #include <readline/readline/readline.h> to work
|
||||||
|
#
|
||||||
|
# Then we do an out of tree build in build-readline subdir in $builddir
|
||||||
|
#
|
||||||
|
# Then we symlink the output archives inside build-readline to
|
||||||
|
# ${top_builddir}/readline/lib*.a so they are on a well known path
|
||||||
|
# for the project to find and link against.
|
||||||
|
#
|
||||||
|
|
||||||
readline/libhistory.a: readline/libreadline.a
|
.PHONY: readline-create-symlinks
|
||||||
|
readline-create-symlinks:
|
||||||
|
@if ! test -e readline ; then \
|
||||||
|
readline_target_dir=$$(ls | grep readline | grep -v "^readline$$" | tail -n1); \
|
||||||
|
if test -d "$${readline_target_dir}" ; then \
|
||||||
|
$(LN) -nsf "$${readline_target_dir}" ./readline ; \
|
||||||
|
fi; \
|
||||||
|
fi
|
||||||
|
|
||||||
readline/libreadline.a:
|
libhistory.a: build-readline/libhistory.a
|
||||||
@echo --- building GNU readline
|
@if ! test -e libhistory.a ; then \
|
||||||
(cd readline; CC="${CC}" CFLAGS="${CFLAGS}" LOCAL_DEFS="${READLINE_DEFS}" ./configure --disable-shared ; ${MAKE})
|
$(LN) -nsf build-readline/libreadline.a libhistory.a ; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
libreadline.a: build-readline/libreadline.a
|
||||||
|
@if ! test -e libreadline.a ; then \
|
||||||
|
$(LN) -nsf build-readline/libreadline.a libreadline.a ; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
build-readline/libreadline.a build-readline/libhistory.a: readline-create-symlinks build-readline
|
||||||
|
|
||||||
|
.PHONY: build-readline
|
||||||
|
build-readline:
|
||||||
|
@if ! test -e build-readline/Makefile ; then \
|
||||||
|
echo --- building GNU readline ; \
|
||||||
|
$(MKDIR) -p build-readline ; \
|
||||||
|
(cd build-readline && CC="${CC}" CFLAGS="${CFLAGS}" LOCAL_DEFS="${READLINE_DEFS}" \
|
||||||
|
"../readline/configure" --disable-shared) || exit 1 ; \
|
||||||
|
fi
|
||||||
|
@(cd build-readline && ${MAKE}) || exit 1
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@if ( test -f readline/Makefile ) ; then \
|
@if test -f build-readline/Makefile ; then \
|
||||||
(cd readline && ${MAKE} distclean) ; \
|
(cd build-readline && ${MAKE} distclean) ; \
|
||||||
fi
|
fi
|
||||||
${RM} readline
|
@for d in build-readline/doc build-readline/examples build-readline/shlib build-readline ; do \
|
||||||
|
test -d "$$d" && $(RMDIR) "$$d" 2>/dev/null ; \
|
||||||
|
done ; true
|
||||||
|
$(RM) libhistory.a
|
||||||
|
$(RM) libreadline.a
|
||||||
|
$(RM) readline
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue