$ cat Makefile TARGET := i386-x-openbsd5.5y iflags := \ case "$(TARGET)" in \ i386-*-openbsd5.[5-9]*|i386-*-openbsd[6-9].*)\ echo "-ccopt -nopie";; \ *);; \ esac
flags := $(shell $(iflags)) all: echo $(flags) $ make echo -ccopt -nopie -ccopt -nopie If you can't get make to parse a macro properly due to embedded special chars, I've found that often embedding the bad stuff in an internal macro and then calling the internal macro from the outer macro works wonders. Regards, John On Thu, Sep 14, 2017 at 5:52 AM, Sébastien Hinderer < sebastien.hinde...@inria.fr> wrote: > 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 mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make