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 <help-make-bounces+sharma__r=hotmail....@gnu.org> on behalf of 
Sébastien Hinderer <sebastien.hinde...@inria.fr>
Sent: Thursday, September 14, 2017 4:52 AM
To: help-make@gnu.org
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
Help-make@gnu.org
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 bug-m...@gnu.org instead of posting them here. To see the 
collection of ...



_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to