help-make
[Top][All Lists]
Advanced

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

Re: Running case commands with the shell function?


From: Rakesh Sharma
Subject: Re: Running case commands with the shell function?
Date: Sat, 16 Sep 2017 13:24:25 +0000

Hi Sebstien,


You could also choose to make do with the GNU-make's builtins and avoid forking 
to the shell.


TARGET := i386-XXXX-openbsd5.8YYYY

1-9 := 1 2 3 4 5 6 7 8 9
flags := \
   $(strip \
      $(if $(subst i386,,$(firstword $(subst -, ,$(TARGET)))),,\
         $(if $(strip \
               $(foreach i,\
                  $(addprefix -openbsd,\
                     $(addprefix 5.,$(wordlist 5,9,$(1-9)))\
                                    $(wordlist 6,9,$(1-9))),\
                  $(findstring $i,$(TARGET)))),-ccopt -nopie)))

$(info $(flags))

--Rakesh


________________________________
From: Help-make <address@hidden> on behalf of Sébastien Hinderer 
<address@hidden>
Sent: Thursday, September 14, 2017 4:52 AM
To: address@hidden
Subject: Running case commands with the shell function?

Dear all,

I'd like to be able to write something like this:

flags := \
  $(shell \
    case "$(TARGET)" in \
      i386-*-openbsd5.[5-9]*|i386-*-openbsd[6-9].*) \
        echo "-ccopt -nopie";; \
      *);; \
    esac \
  )

Of course this does not work because the first closing parenthesis is
interpreted as ending the call to the shell function.

Is there a way to actually achieve this, please?

Thanks!

Sébastien.

_______________________________________________
Help-make mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-make
Help-make -- Users list for the GNU implementation of 
make<https://lists.gnu.org/mailman/listinfo/help-make>
lists.gnu.org
This list is for users and installers of GNU make to ask for help. Please send 
bug reports to address@hidden instead of posting them here. To see the 
collection of ...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]