terminal - why am I getting this makefile error? - makefile

I am trying to run makefile but getting this error.
"make *** no targets specified and no makefile found. stop."
I have followed all the standards for makefile and referred many posts regarding this error but none of them helped me. anyone has a solution for this which isn't on the internet.
ouput as follows:
yuliam-MBP:~ yuliamosh$ cd /Users/yuliamosh/Documents/make1/
yuliam-MBP:make1 yuliamosh$ ls
Makefile.make a.out main.cpp message.cpp message.h
yuliam-MBP:make1 yuliamosh$ g++ main.cpp message.cpp
yuliam-MBP:make1 yuliamosh$ ./a.out
Makefile Example!
yuliam-MBP:make1 yuliamosh$ make
make: *** No targets specified and no makefile found. Stop.
yuliam-MBP:make1 yuliamosh$

gnu make assume you name the file just Makefile. So all you should need to do is rename Makefile.make to Makefile.
The hint in the error message is: no makefile found

It was an editor problem. I used vim to edit my Makefile. Now it's working successfully.

Related

Include path problem when compiling wxWidgets app

I'm now compiling wxWidgets' hello world sample: https://docs.wxwidgets.org/trunk/overview_helloworld.html
using MingGW-w64 and it's mingw32-make on windows, and I'm using the pre-compiled Windows binaries it provides.
I have already compile successfully using
g++ -o hello -I/d/local/wxWidgets/lib/gcc810_x64_dll/mswu -I/d/local/wxWidgets/include -L/d/local/wxWidgets/lib/gcc810_x64_dll hello.cpp -lwxbase31u -lwxmsw31u_core
(I run this git-bash), and it can be execute normally too.
But when I copy the same line into makefile like this:
all: hello
hello: hello.cpp
g++ -o hello -I/d/local/wxWidgets/lib/gcc810_x64_dll/mswu -I/d/local/wxWidgets/include -L/d/local/wxWidgets/lib/gcc810_x64_dll hello.cpp -lwxbase31u -lwxmsw31u_core
and run with mingw32-make.exe in terminal, this error happened:
hello.cpp:3:10: fatal error: wx/wxprec.h: No such file or directory
#include <wx/wxprec.h>
^~~~~~~~~~~~~
compilation terminated.
mingw32-make: *** [makefile:3: hello] Error 1
I'm not sure if it's the including path problem, because It actually compile successfully when I run the same line in terminal directlty.
Are you also using the "git bash" terminal when you try with your Makefile ?
Regards
Xav'
After trying executing in cmd and git-bash a few times. I found it's probably the path style problem. I tried 2 cases of path specification below:
First:
g++ -o hello -I/d/local/wxWidgets/lib/gcc810_x64_dll/mswu -I/d/local/wxWidgets/include -L/d/local/wxWidgets/lib/gcc810_x64_dll hello.cpp -lwxbase31u -lwxmsw31u_core
Second:
g++ -o hello -ID:\local\wxWidgets\lib\gcc810_x64_dll\mswu -ID:\local\wxWidgets\include -LD:\local\wxWidgets\lib\gcc810_x64_dll hello.cpp -lwxbase31u -lwxmsw31u_core
Git-bash(execute in terminal directly): only first case successfully compiled.
Git-bash(using mingw32-make): only second case successfully compiled.
cmd(execute in terminal directly): only second case successfully compiled.
cmd(using mingw32-make): only second case successfully compiled.
Conclusion: I think mingw32-make using "traditional" Windows path style (backslash), even under git-bash.
Update:
I found that mingw32-make also support forword slash, so I can rewrite as:
g++ -o hello -ID:/local/wxWidgets/lib/gcc810_x64_dll/mswu ...
So I think it's better to use relative path in makefile, to prevent that (D:) in path, and also more portable(unix/linux use backslash too).

How can I specify include and library locations for mingw32-make under msys2?

I have a suite of Windows programs that up to now I have built under msys, one of which uses libxml2. I am currently trying to switch to building them under msys2 and the latter one is hitting a problem. My updated Makefile includes this:
CFLAGS += -I/mingw32/include/libxml2
$(BINDIR)/%.o: %.c
#-$(MKDIR) $(BINDIR)
$(CC) $(CFLAGS) -c $*.c -o $#
But when I run make (mingw32-make) the compile fails as follows:
[csv-gen]: mingw32-make
gcc -std=c99 -Werror -Wall -D_XOPEN_SOURCE -O -I/mingw32/include/libxml2 -c xmlParse.c -o ../../bin/Win32/csv-gen/xmlParse.o
xmlParse.c:36:27: fatal error: libxml/parser.h: No such file or directory
#include "libxml/parser.h"
^
compilation terminated.
Makefile:66: recipe for target '../../bin/Win32/csv-gen/xmlParse.o' failed
mingw32-make: *** [../../bin/Win32/csv-gen/xmlParse.o] Error 1
Yet that libxml/parser.h file does exist under the /mingw32/include/libxml2 path given by the -I option:
[csv-gen]: ls /mingw32/include/libxml2/libxml/parser.h
/mingw32/include/libxml2/libxml/parser.h
And the strange thing is that if I run the exact same gcc command directly from the msys bash shell (copying and pasting it from the make output above) then it compiles fine with no errors.
And I have the exact same problem with the link phase where it doesn't find the libxml2.a library in the path given to gcc by -L/mingw32/lib, and again I run the gcc link command directly from the shell and it works fine.
So why would gcc's -I/mingw32/include/libxml2 and -L/mingw32/lib options not work when run via mingw32-make yet the exact same options work fine on calling gcc directly from the shell?
I did try making the paths explicit Windows paths (d:/msys64/mingw32/...) and also tried quoting them, to no avail.
It turned out that the answer was to use explicit Windows paths, which as I said above I had tried, but when I tried again it worked so I must have previously made some mistake doing that. I found this by using the output from pkg-config which gives:
[csv-gen]: pkg-config --cflags libxml-2.0
-ID:/msys64/mingw32/include/libxml2
So apparently the problem is that mingw32-make doesn't fully understand the msys filing system, or at least not /mingw32 and /mingw64 paths in it.

make[1]: exec(f77) failed (No such file or directory) on DragonFly BSD

I get this error when trying to compile html-xml-utils-6.9 on DragonFly BSD. Funny thing is, when doing grep -r f77 in the source directory, the result is empty. So no such option is in the constructed Makefile after ./configure.
This is my configure output: http://pastebin.com/4tKEXQKG
I tried to do alias f77="gfortran48", but the problem remains. gfortran48 is an installed compiler, I've checked with man gfortran48.
My full error output:
/home/olle2/Downloads/html-xml-utils-6.9$ make
make all-am
f77 -O -c html.e
make[1]: exec(f77) failed (No such file or directory)
*** Error code 1
Stop.
make[1]: stopped in /home/olle2/Downloads/html-xml-utils-6.9
*** Error code 1
Stop.
make: stopped in /home/olle2/Downloads/html-xml-utils-6.9
Any ideas?
Related thread: make: f77: No such file or directory
Aliases aren't available to non-interactive shells generally so an alias isn't the right solution to this problem.
The default FC make variable is f77 so that is likely what is in use in the makefile. This also indicates your solution.
Try make FC=gfortran48 or similar.
Solved with this line:
./configure LDFLAGS="-L/usr/local/lib -liconv" && gmake && echo $?
(gmake instead of make gives saner error messages.)
Thanks to #dragonflybsd IRC channel!

How to run makefile in Cygwin

I am trying to run Makefile in cygwin.
Error msg:
$ make /cygdrive/d/IoT/trunk/Macchina/TestBed/Makefile
make.exe: *** No rule to make target `/cygdrive/d/IoT/trunk/Macchina/TestBed/Makefile'. Stop.
You don't give make the makefile as an argument like that.
cd to that directory and run make.
Or if that makefile is intended to be used from other directories as well then you can try make -f /cygdrive/d/IoT/trunk/Macchina/TestBed/Makefile.

Can't get 'make' to work on OSX; have to use 'make -f <file>'

I'm trying to get started building my own make files, but am having some trouble getting my Mac to use them. I can issue the command make -f makefile.txt and it compiles my project fine; however, just using make produces the following:
make: *** No targets specified and no makefile found. Stop.
My makefile looks like this:
all:
g++ main.c -o hello
Am I doing something wrong?
You're naming the Makefile inappropriately. It should be named simply Makefile (with no extension), not makefile.txt.

Resources