tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: MAKEFLAGS overload



At Tue, 16 Apr 2024 12:44:40 -0400, Chuck Cranor <chuck%ece.cmu.edu@localhost> wrote:
Subject: MAKEFLAGS overload
>
> looking at the "all" target in work/icb-5.0.9/Makefile it has:
>
> all:            $(PREREQS)
>         @for dir in ${DIRS}; do \
>                 (echo Making in $${dir}; \
>                  cd $${dir}; sh ./gen ${MFLAGS} -${MAKEFLAGS}); done

icb should probably be built with GNU Make, or a true POSIX-compliant
Make, not any BSD Pmake.

BSD Pmake treats MAKEFLAGS differently from GNU Make, UNIX Make, and
perhaps some other Makes, and is not strictly POSIX-compliant.

> https://docs.oracle.com/cd/E19504-01/802-5880/make-65/index.html
>
>     MAKEFLAGS contains flags (that is, single-character options)
>     for the make command. Unlike other FLAGS macros, the MAKEFLAGS
>     value is a concatenation of flags, without a leading `-'. For
>     instance the string eiknp would be a recognized value for
>     MAKEFLAGS, while -f x.mk or macro=value would not.


POSIX allows for both ways to use MAKEFLAGS and says:

  MAKEFLAGS

    This variable shall be interpreted as a character string
    representing a series of option characters to be used as the default
    options.  The implementation shall accept both of the following
    formats (but need not accept them when intermixed):

      * The characters are option letters without the leading
        <hyphen-minus> characters or <blank> separation used on a make
        utility command line.

      * The characters are formatted in a manner similar to a portion of
        the make utility command line:  options are preceded by
        <hyphen-minus> characters and <blank>-separated as described in
        XBD Utility Syntax Guidelines.  The macro= value macro
        definition operands can also be included.  The difference
        between the contents of MAKEFLAGS and the make utility command
        line is that the contents of the variable shall not be subjected
        to the word expansions (see wordexp) associated with parsing the
        command line values.

GNU Make is halfway in between:

    Flags such as '-s' and '-k' are passed automatically to the
    sub-'make' through the variable 'MAKEFLAGS'.  This variable is set
    up automatically by 'make' to contain the flag letters that 'make'
    received.  Thus, if you do 'make -ks' then 'MAKEFLAGS' gets the
    value 'ks'.
  ....
    'MAKEFLAGS' begins with a hyphen only when it begins with an option
    that has no single-letter version, such as
    '--warn-undefined-variables'

> how should we resolve this issue?

I would suggest trying to add the following line to the package
Makefile and see if that fixes it:

	USE_TOOLS+=	gmake

Ultimately upstream should fix their Makefile(s).  Their use of
MAKEFLAGS is basically wrong.  MAKEFLAGS should never be used on
command-lines in recipes as it is always passed through the environment
to sub-makes (and MFLAGS was deprecated in all Make's I know of decades
ago!).

--
					Greg A. Woods <gwoods%acm.org@localhost>

Kelowna, BC     +1 250 762-7675           RoboHack <woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>     Avoncote Farms <woods%avoncote.ca@localhost>

Attachment: pgpV2FRt0NjFz.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index