On Fri, Jan 17, 2003 at 12:56:21PM +0100, Andre Majorel wrote:
# Hello all. Is there a way to know programatically whether a GNU
# makefile defines some target ?
...
# Is there a simple, supported way of knowing from outside make
# whether a target is defined ? It would have to run on all Unixen
# plus Cygwin, for versions of GNU make >= 3.79.

POSIX make supports the -n (dryrun) option. Simply do

        #!/bin/sh
        if make -n target >/dev/null 2>&1; then
                echo target is defined
        else
                echo target is not defined
        fi

This should be as portable and lightweight as it gets. I don't know
Cygwin, however.

Regards,

        Jens
-- 
Jens Schweikhardt  http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)





_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to