Menu

saying that a file must exist

Help
2010-07-17
2013-03-15
  • Terrence M. Brannon

    I'm trying to write a simple makefile that copies a local file named edan.el to ${EDAN_DIR}/edan.el, assuming that ${EDAN_DIR}/edan.el is not already there.

    The following makefile does not work because of  the line """init: ${EDAN_EL}"""  … I'd appreciate some help with this. Thanks!

    .PHONY: init

    EDAN_DIR = ${HOME}/.emacs.d
    EDAN_EL  = ${EDAN_DIR}/edan.el

    init: ${EDAN_EL}
    cp edan.el ${EDAN_EL}

     
  • Michael Lachmann

    I think the following would work:
    $(EDAN_EL): edan.el
       cp edan.pl $(EDAN_EL)

    init: $(EDAN_EL)

    You say that $(EDAN_EL) depands on edan.pl. Whenever edan.el is newer than $(EDAN_EL), or $(EDAN_EL) doesn't exists, the copy will take place.

    you could also write above
    $(EDAN_EL): edan.el
       cp $(input) $(output)

     
  • Terrence M. Brannon

    Thanks. Is there any  difference between using parentheses instead of braces? $(VAR) versus ${VAR}

     
  • Michael Lachmann

    I think not, just what you're used to. You can also use ${{ }} when needed.

     

Log in to post a comment.