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 <help-make-bounces+sharma__r=hotmail....@gnu.org> on behalf of Sébastien Hinderer <sebastien.hinde...@inria.fr> Sent: Monday, September 18, 2017 1:17 AM To: help-make@gnu.org 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 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