Results 1 to 4 of 4

Thread: Is it possible to run make install from another directory?

  1. #1
    Join Date
    May 2014
    Beans
    4

    Is it possible to run make install from another directory?

    Hi all. I know that
    Code:
    make install
    is run from inside the directory which contains the makefile. Is it possible to run make install on this directory from outside of it?
    Last edited by Alex_Baggott; April 8th, 2015 at 06:06 PM.

  2. #2
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: Is it possible to run make install from another directory?

    Why?

  3. #3
    Join Date
    Apr 2012
    Beans
    7,256

    Re: Is it possible to run make install from another directory?

    You could use the -C flag, I think

    Code:
           -C dir, --directory=dir
                Change to directory dir before reading the makefiles or doing any‐
                thing else.  If multiple -C options are specified, each is  inter‐
                preted  relative to the previous one: -C / -C etc is equivalent to
                -C /etc.  This is typically used  with  recursive  invocations  of
                make.
    i.e.

    Code:
    make -C path/to/dir/containing/makefile install
    e.g.
    Code:
    $ make -C forums/src/ hello
    make: Entering directory `/home/steeldriver/Documents/forums/src'
    g++ -Wall -g -o hello hello.cpp

  4. #4
    Join Date
    May 2014
    Beans
    4

    Re: Is it possible to run make install from another directory?

    Thanks. That worked beautifully.

    For any others wondering about this, it also works with "make install", i.e.:
    Code:
    make install -C  <directory_name>

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •