» How do i get the user name in a Makefile?
How do i get the user name in a Makefile?
|November 22, 2011
Posted by forumadmin
I’m making a simple game for Ubuntu and to update the highscore list, it needs a single file at runtime, called ‘highscores.bin’.
I wish to put this file at
I’ve researched a little and found that from inside a Makefile i can get the environment variable $USER.
So in the Makefile, at the ‘install’ target, i’ve added:
mkdir -p $(DESTDIR)home/$$USER/.game_name
But when i run ‘sudo make install’, the Makefile installs it as:
How can i get the (non-root) user name in a Makefile?
P.S.: I’m writing the Makefile by hand. No ./configure
P.S.2: I dont want to do
mkdir -p ~/.game_name
because i want to be able to change DESTDIR if i want to install to a temporary directory.
More Related Questions
- How to Link libgcc while android kernel compiling I am required to perform casting of unsigned long long to double in android kernel space. For this I am trying to link with libgcc. I have gone through the tutorial . I am using this […]
- Makefile that distincts between Windows and Unix-like systems I would like to have the same Makefile for building on Linux and on Windows. I use the default GNU make on Linux and the mingw32-make (also GNU make) on Windows.
I want the Makefile to […]
- How to automate download and instalation of Java JDK on Linux? As of around 15.04.2012 the wget command for the Java download link seems to be broken on Linux is there a workaround?
Is oracle complying with the eu cookie law in your country by doing […]
- How to compile/install node.js(could not configure a cxx compiler!) (Ubuntu). How can I compile/install node.js on Ubuntu? It failed with an error about cxx compiler. Asked By - Alfred Read Answers
- How to find the real user home directory using python? I see that if we change the HOME(linux) or USERPROFILE(windows) environmental variable and run a python script, it returns the new value as the user home when I […]
- meaning of tilde in linux bash (not home directory) First off, I know that ~/ is the home directory. CDing to ~ or ~/ takes me to the home directory.
However, cd ~X takes me to a special place, where X seems to be anything.
In bash, if I […]
- Applying and transferring all settings/binaries of one user to another user in Linux In a linux machine, we may have to compile our programs with respect to that linux machine.
Now, if we already have some other users (not root. A typical user.) who have already compiled […]
- building/installing package with monodevelop failed, "Cannot open assembly /usr/local/lib/…" I want to build/install a mono/c# app I made on Linux.
I made a packaging project and added a "tarball" package, using a generated autotools makefile. When i build the package and try to […]
- LD_LIBRARY_PATH I have tried to link VINCIA to ROOT, but there is a problem related to the location of the shared libraries in my system. Since I have installed all these tools in a directory which is […]
- How to change JAVA.HOME for Eclipse/ANT I am trying to sign a jar file using an ANT script. I know this has to be pointed at the JDK directory for jarsigner.exe to run, but when I echo java.home it returns the JRE directory. […]