Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Makefile project with install target
Makefile project with install target [message #1740941] Sat, 20 August 2016 12:18 Go to next message
Ramon Caballero is currently offline Ramon CaballeroFriend
Messages: 2
Registered: August 2016
Junior Member
Hi,

I'm working in a Makefile project (where I provide my own makefile) and I'm trying to add an 'install' target which aims to copy some files to /usr/local/include/mylib/ (I'm on Ubuntu), like that:

install:
    mkdir -p /usr/local/include/path/
    cp ./src/*.hpp /usr/local/include/path/


As expected, I get a Permission denied error because the directory I'm trying to create needs sudo permissions. So I change the target to be:

install:
    sudo mkdir -p /usr/local/include/path/
    sudo cp ./src/*.hpp /usr/local/include/path/


But then I get sudo: no tty present and no askpass program specified error message. I've been reading about how to solve this and everyone says to modify sudoers file to grant permissions to my user for some commands so I won't need to type sudo password.

I'm not convinced about this being a proper way to do that or give my user full access to /usr/local/include/, any suggestions? is it a good practice to use this type of targets in Eclipse?

Thanks.
Re: Makefile project with install target [message #1740949 is a reply to message #1740941] Sun, 21 August 2016 03:16 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
This is off topic here as this forum is for dealing with CDT issues.

It's probably a bad idea to do this from Eclipse but essentially not much different than "sudo make install".
Do you really want each user to be able to change things in system files?

But if you insist, the following may be helpful
http://unix.stackexchange.com/questions/190571/sudo-in-non-interactive-script

Re: Makefile project with install target [message #1740954 is a reply to message #1740949] Sun, 21 August 2016 09:02 Go to previous message
Ramon Caballero is currently offline Ramon CaballeroFriend
Messages: 2
Registered: August 2016
Junior Member
Sorry for the off topic question, I thought this could be related to CDT as it's using makefile inside Eclipse where I'm having the problem.

Anyway, I also think now it's not good idea to do this from Eclipse, so I'll copy the files to somewhere in my home folder while developing.

Thanks.
Previous Topic:IDE adds -werror to makefile build
Next Topic:issues with using ODBC libraries in Win7
Goto Forum:
  


Current Time: Fri Apr 26 11:28:03 GMT 2024

Powered by FUDForum. Page generated in 0.03148 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top