Can't Execute Makefile, Even As Root!

6,330

First off:

  1. Don't compile things as root, it is totally unnecessary. It may be needed for the final make install, but most likely not otherwise.
  2. Don't compile things in /usr/bin, that's where (base system) utilities are installed.

Instead:

  1. Compile things as "you" (ordinary user).
  2. Compile things somewhere in your home directory, for example in a temporary ~/build directory under which you have unpacked the sources.

The Makefile is not an executable. It is a file containing instructions for the make program for how to build a particular piece of software.

You use the Makefile by simply typing make.

If the software came with any installation instructions (look for an INSTALL file), read them.

Share:
6,330

Related videos on Youtube

GremlinsBane
Author by

GremlinsBane

Updated on September 18, 2022

Comments

  • GremlinsBane
    GremlinsBane over 1 year

    I'm trying to compile a c program, but when I try to execute the makefile, I get "Permission denied".

    This is what I did :

    root@mycpu:/usr/bin# MakeFile
    -bash: /usr/bin/MakeFile: Permission denied
    root@mycpu:/usr/bin# 
    
    • smw
      smw about 7 years
      Makefiles are usually executed explicitly with make e.g. make -f MakeFile or just make if you have named the file suitably (it will look for a makefile or Makefile in the current directory by default).
    • Dmitry Grigoryev
      Dmitry Grigoryev about 7 years
      This question looks like one of those nightmares which don't make any sense but are scary as hell.
    • radrow
      radrow over 3 years
      I don't get why this question is downvoted
  • GremlinsBane
    GremlinsBane about 7 years
    Man, I feel stupid. Thank you for your help!
  • Kusalananda
    Kusalananda about 7 years
    @GremlinsBane The stupider you feel, the less likely it is that you will be in the same situation again. Also, I have definitely done things like this! :-)
  • GremlinsBane
    GremlinsBane about 7 years
    That's encouraging!
  • JdeBP
    JdeBP about 7 years
    A common Debian trick is for a debian/rules file to be an executable makefile, with #!/usr/bin/make -sf as its interpreter. But at beginner level, yes, makefiles are not directly executable.