Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nothing to be done for "Makefile"

Tags:

makefile

I am supposed to write a Makefile for a project I need to do. I have it all done but when I try to do it, I get the following output:

make: Nothing to be done for `Makefile'

What might be the cause of this?

Here's my Makefile file:

###########################################################
# Makefile for XXXXX
# name1, name2
# account1, account2
###########################################################
EXEC = a1
CC = /opt/SUNWspro/bin/cc
$(EXEC):
    $(CC) -o $(EXEC) a1.cpp a1.h a1.sic
    rm -f *.o
clean:
    rm -f *.o core diss $(EXEC)
#######################[ EOF: Makefile ]###################

Edit: Thanks to a kind user, I now know what happened.

Now I have the following output

/opt/SUNWspro/bin/cc -o a1 a1.cpp a1.h a1.sic
ld: fatal: file a1.cpp: unknown file type
ld: fatal: file processing errors. No output written to a1
make: *** [a1] Error 2

Can you please help?

like image 845
Julio Garcia Avatar asked Sep 15 '25 08:09

Julio Garcia


1 Answers

Are you typing make Makefile for some reason? Don't. Just type make. make a1 or make -f Makefile will work for your situation, too, but why bother with the extra typing?

As an aside, it's a bit weird to include header files on your compile line. Also, your makefile doesn't specify any dependencies, which is kind of the whole reason to have one in the first place...

Edit: to answer your new question, don't compile C++ code with a C compiler. That said, I'm not sure about the link error you're getting. Is a1.cpp not a normal source file (type file a1.cpp to find out)?

It seems like you are having very fundamental problems. Maybe starting with a good beginner book would be useful?

like image 182
Carl Norum Avatar answered Sep 17 '25 19:09

Carl Norum