make -k fails on cygwin [Was: Test failures in coreutils-5.3.0 on cygwin]

Eric Blake
Fri Jan 14 09:11:00 GMT 2005

Hash: SHA1

[cross-posted to cygwin and automake lists]
I'm not sure if the bug below is with cygwin's mods to make, in automake
for using non-portable Makefile constructs, or in both.

According to Jim Meyering on 1/12/2005 9:45 AM:
>>>If you run `make -k check', it will keep going in spite of failures.
>> Nope, even with `make -k check', my run ends in:
>> ======================================
>> 1 of 5 tests failed
>> Please report to
>> ======================================
>> make[3]: *** [check-TESTS] Error 1
>> make[3]: Leaving directory `/home/eblake/coreutils-5.3.0/tests/chgrp'
>> make[2]: *** [check-am] Error 2
>> make[2]: Target `check' not remade because of errors.
>> make[2]: Leaving directory `/home/eblake/coreutils-5.3.0/tests/chgrp'
>> make[1]: *** [check-recursive] Error 1
>> make[1]: Target `check' not remade because of errors.
>> make[1]: Leaving directory `/home/eblake/coreutils-5.3.0/tests'
>> make: *** [check-recursive] Error 1
>> make: Target `check' not remade because of errors.
> Then you should use a make program that honors the -k option.
> There must be a GNU make port to cygwin.

It _is_ GNU make, but with cygwin modifications to accept --unix or
- --win32 to determine whether to use /bin/sh or the native DOS shell:
$ make --version
GNU Make 3.80
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
$ cat Makefile
	@echo ${MAKEFLAGS}
$ make
- --unix
$ make -k
- --unix -k

Now look at what automake 1.9 sticks in to the Makefiles for recursive
        @set fnord $$MAKEFLAGS; amf=$$2; \
        dot_seen=no; \
        target=`echo $@ | sed s/-recursive//`; \
        list='$(SUBDIRS)'; for subdir in $$list; do \
          echo "Making $$target in $$subdir"; \
          if test "$$subdir" = "."; then \
            dot_seen=yes; \
            local_target="$$target-am"; \
          else \
            local_target="$$target"; \
          fi; \
          (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
           || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;;
esac; \
        done; \
        if test "$$dot_seen" = "no"; then \
          $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
        fi; test -z "$$fail"

Whoops - $amf is set to --unix, rather than the desired '' or -k.  The
case statement fails, and the recursive traversal of subdirs halts in
spite of my request to keep going.  As pointed out last month on the
libtool lists,,
parsing $MAKEFLAGS is inherently non-portable.  `info make' also has a
page dedicated to "Phony Targets" that discusses the more portable way to
have a recursive target, although I don't know how well it scales to the
more than 15 recursive targets that automake creates.

     SUBDIRS = foo bar baz

     .PHONY: subdirs $(SUBDIRS)

     subdirs: $(SUBDIRS)

             $(MAKE) -C $@

     foo: baz

- --
Life is short - so eat dessert first!

Eric Blake   

Version: GnuPG v1.4.0 (Cygwin)
Comment: Using GnuPG with Thunderbird -


Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list