Table of Contents

verbose

how to print invocated commands including non echoed ones ”@foo” ?

make -n

but dont invocated them :

Solution :

remake -d

This helped to hack autotools makefiles

ENV

If you need only a few known variables exporting in makefile can be an option, here is an example of what I am using.

  $ grep ID /etc/os-release 
  ID=ubuntu
  ID_LIKE=debian
  $ cat Makefile
  default: help rule/setup/lsb
  
  source?=.
  
  help:
          -${MAKE} --version | head -n1
  
  rule/setup/%:
          echo ID=${@F}
  
  rule/setup/lsb: /etc/os-release
          ${source} $< && export ID && ${MAKE} rule/setup/$${ID}
  $ make
  make --version | head -n1
  GNU Make 3.81
  . /etc/os-release && export ID && make rule/setup/${ID}
  make[1]: Entering directory `/tmp'
  echo ID=ubuntu
  ID=ubuntu

paths

VPATH :

OBJ_DIRS?=$(shell find . -iname "*.o" | sed -e "s|\(.*\)/.*|\1|g" | sort | uniq | tr '\n' ':')
VPATH=${OBJ_DIRS}
show-vpath: ${OBJS}
    echo "VPATH="
    echo ${^D} | tr ' ' '\n' | sort | uniq | tr '\n' ':' "
  

regex

RegEx :

test: ${CURDIR}
echo ${<:%-1.0.0=%}
echo ${<:%-1.0.0=%-snapshot}
echo ${<:%-%=%-snapshot}
echo ${<:%-1.0.0=%-snapshot}
install-libs: ${modules_jni}
echo ${^:TuxGuitar-%=tuxguitar-%} 
for t in ${^} ; do  \
 echo install -s  $$t/$${t/TuxGuitar/tuxguitar} \
 ; done

install

install-list:

   find . -type f -perm -u+x -exec file '{}' \;

ERROR

" *** target pattern contains no `%'.  Stop."
pwd | grep ':' 

Message :

# rzr@lap:linux/ # [0] # make
Makefile:129: *** multiple target patterns.  Stop.

Cause :

# rzr@lap:linux/ # [0] # pwd  
/home/rzr/var/cache/url/git/ssh/git@github.com:/rzr/linux/src/linux

Solution :

# rzr@lap:ssh/ # [0] # mv git\@github.com\: git\@github.com/

MISC

MORE

gnumake.txt · Last modified: 2023/12/02 23:36 by rzr
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki