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: Mon, 18 Sep 2017 14:26:36 +0000

Hi Sebastien,

If you prefer sticking to the more maintainable, shell-based version then I 
would suggest  that you change the double quotes around the $(TARGET) in the 
case structure, as this would hinder the shell from working if there were to be 
dollar signs $ , double quotes " , or back quotes `  present in the make 
variable $(TARGET)

Although that possibility no doubt is remote, but since as this is from a 
maintenance standpoint , you don't want a fully-functional and verified 
Makefile to suddenly blow up at the customer's end ! That is why it's never a 
good idea to provide the shell with unknown inputs when those  are to be 
interpreted as instructions. (my 2 francs)

######################

TARGET := i386-'foo'-openbsd5.6y
iflags := \
    case '$(subst ','\'',$(TARGET))' in \
      i386-*-openbsd5.[5-9]*|i386-*-openbsd[6-9].*)\
        echo "-ccopt -nopie";; \
      *) :;; \
    esac

######################

Thanks,
/Rakesh

________________________________
From: Help-make <address@hidden> on behalf of Sébastien Hinderer 
<address@hidden>
Sent: Monday, September 18, 2017 1:17 AM
To: address@hidden
Subject: Re: Running case commands with the shell function?

Dear Rakesh,

Many thanks for your two e-mails and for the nice makefile-only solution
you propose.

I definitely find it elegant and also interesting from a "cultural" or
"theoretical" point of view to know that there _is_ a Makefile-only
solution to this.

That being said, I must also take maintainability and readability by
others into account, so I went for the external shell script solution.

Best wishes and thanks to all for your enlightening contributions,

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]