E
E
EVOSandru62018-11-27 23:07:07
linux
EVOSandru6, 2018-11-27 23:07:07

How to write a regular expression check in the Makefile and the body inside?

Hello guys,
how to write a regular expression check in the Makefile and the body inside:
I need that if the word Ubuntu is found in the lsb_release expression , then execute one variable definition, otherwise - the second one.

ifeq ((lsb_release -i | awk '/Ubuntu/{print $0}'))
  echo ubuntu;
  _SUDO=sudo;
else
  echo centos;
  _SUDO=;
endif

Now I have:
Makefile:7: *** invalid syntax in conditional. stop.

If this block is removed, then the error when calling commands disappears.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
3
3vi1_0n3, 2018-11-27
@EVOSandru6

ifeq requires two parameters
https://www.gnu.org/software/make/manual/make.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question