URL:
  <https://savannah.gnu.org/bugs/?55719>
                 Summary: Variables containing hyphens are not exported
                 Project: make
            Submitted by: masahiroy
            Submitted on: Sat 16 Feb 2019 09:29:01 AM UTC
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: None
        Operating System: Any
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

Shell cannot cope with variable names consisting of characters
other than letters, numbers, and underscores.

Make allows more characters in variable names,
such as a hyphen.

The variables are exported to sub-make
by using the 'export' directive.

For example, 'export foo-bar'
will export the variable 'foo-bar' to sub-make.

However, it does not work under some circumstances.

I attached two test-cases.


Makefile1 exports 'foo-bar' to sub-make.

If you run Makefile2 on Ubuntu, where /bin/sh is a
symlink to dash, 'foo-bar' is not exported to sub-make.


$ make -f Makefile1
make sub_make=1
foo-bar: 1
foo_bar: 2
$ make -f Makefile2
make sub_make=~
foo-bar:
foo_bar: 2


I think this difference comes from
the reluctance of spawning a sub-shell.


In Makefile1, Make will directly execute
'$(MAKE) sub_make=1' without spawning a sub-shell.

In Makefile2, Make will execute 
'$(MAKE) sub_make=~' in a sub-shell since '~' is a shell special character.




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sat 16 Feb 2019 09:29:01 AM UTC  Name: Makefile1  Size: 213B   By:
masahiroy

<http://savannah.gnu.org/bugs/download.php?file_id=46276>
-------------------------------------------------------
Date: Sat 16 Feb 2019 09:29:01 AM UTC  Name: Makefile2  Size: 213B   By:
masahiroy

<http://savannah.gnu.org/bugs/download.php?file_id=46277>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55719>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to