OT: How to call a bash function within a makefile

Discussion in 'C++' started by OnMyWayHome, Nov 12, 2005.

  1. OnMyWayHome

    OnMyWayHome Guest

    Sorry to post off-topic but I searched for usenet groups for bash and
    makefiles and I can't find a closer newsgroup. I also searched the
    internet using a variety of search strings and I can't find anything.
    If anyone has a recommendation, please let me know and I will post there.

    Here is an example GNU makefile:

    function DoThis()
    echo $0

    all :
    DoThis "Test"

    I've seen this done before where a bash function is defined within a
    makefile, and can be subsequently called when a target is matched.

    However, when I run 'make' I get the following error:

    makefile:3: *** missing separator. Stop.

    Line 3 corresponds to "function DoThis()".

    Does anyone know how to embed a bash function inside a GNU makefile?

    Any help appreciated,
    OnMyWayHome, Nov 12, 2005
    1. Advertisements

  2. Have you tried "GNU make manual"? Try it. You will get
    See above.
    Victor Bazarov, Nov 12, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.