make: g: No such file or directory make: *** No rule to make target `g'. Stop

3k Views Asked by At

I have a sample makefile called 'g' saved in my user folder. I googled how to properly run make and this article says I should run it like this:

make -f g

but when I run it the way the article tells me to this is what shows up:

make: g: No such file or directory
make: *** No rule to make target `g'.  Stop.

output from running file g:

g: ERROR: cannot open `g' (No such file or directory)

output from runnng pwd:

/home/vagrant

The makefile is saved in: c:/Users/g.MK is there a certain place where I need to save the file so the system can find it?

Again I have the sample makefile saved in my user folder so I dont know why it says no such file or directoryI've tried running cd /g but I still get -bash: cd: /g: No such file or directory Does anyone know why the system cant find the file? Thanks for all your help in advance.

Here is the sample makefile:

edit : main.o kbd.o command.o display.o \
       insert.o search.o files.o utils.o
        cc -o edit main.o kbd.o command.o display.o \
               insert.o search.o files.o utils.o

main.o : main.c defs.h
    cc -c main.c
kbd.o : kbd.c defs.h command.h
    cc -c kbd.c
command.o : command.c defs.h command.h
    cc -c command.c
display.o : display.c defs.h buffer.h
    cc -c display.c
insert.o : insert.c defs.h buffer.h
    cc -c insert.c
search.o : search.c defs.h buffer.h
    cc -c search.c
files.o : files.c defs.h buffer.h command.h
    cc -c files.c
utils.o : utils.c defs.h
    cc -c utils.c
clean :
    rm edit main.o kbd.o command.o display.o \
       insert.o search.o files.o utils.o

Im on:

Linux vagrantlucid32 2.6.32-73-generic-pae #140-Ubuntu SMP Tue Feb 10 15:30:51 UTC 2015 i686 GNU/Linux Ubuntu 10.04.4 LTS

1

There are 1 best solutions below

3
G.M. On

When you type...

make -f g

make expects to find a file named g in the current working directory.

Since the makefile you want to use has the real path...

c:/Users/g.MK

you need to use...

make -f c:/Users/g.MK