0

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

  • From the same directory in which you run `make` please run `file g` and edit your question to include the output. You might also want to include the output of `pwd` and the full, absolute path to the file `g`. – G.M. Oct 09 '19 at 17:58
  • Are you sure you're running `make -f g` (note the `-f` option)? The output you're getting looks a lot like you're running just `make g` (missing the `-f` option). – MadScientist Oct 09 '19 at 18:06
  • Please _cut and paste_ the command you typed and the output you got, directly into your question (prefix it with 4 spaces so it's formatted as code) so we can see exactly what is happening. – MadScientist Oct 09 '19 at 18:07
  • Hi guys, I just edited my question with the output requested. The command I typed was `make -f g` and the output was: `make: g: No such file or directory make: *** No rule to make target g'.` @G.M. @MadScientist – shubuya hushimo Oct 09 '19 at 18:41

1 Answers1

0

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
G.M.
  • 12,232
  • 2
  • 15
  • 18
  • Hi it still says: `make: c:/Users/g.MK: No such file or directory make: *** No rule to make target ` Do you have anymore suggestions? I thought about saving it in the vagrant home folder but I dont know where the home folder is. Thanks for your help. – shubuya hushimo Oct 09 '19 at 23:08
  • Then, contrary to what you've said, I don't think your makefile is at `c:/Users/g.MK`. Also, you're using Ubuntu Linux so why does the `makefile` path begin with a drive letter `c:`? This doesn't make any sense to me at all right now. – G.M. Oct 10 '19 at 08:17
  • I have this installed on windows: `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` – shubuya hushimo Oct 10 '19 at 14:13