0
I would like to know if there is a way to change the rules applied automatically by make when there is no makefile. To give an example, if you write make foo
in a directory containing a file called foo.cpp
it executes
g++ foo.cpp -o foo
even if there is no makefile
in the directory.
I would like to change them to suit my needs, say something like
g++ foo.cpp -o foo --std=c++11 -W -O2 -I ....
but also to add new rules for other extensions such as .c, .java or .tex
I know how to define the new rules, but I don't know where to specify them other than creating a makefile in every directory. I suppose there is some file that holds all these builtin rules but I haven't been able to find it or how to overload it with one of my own.
I'm working mostly with Mingw and cygwin.
Thanks for your answer. The list of rules is very useful as it allows me to tailor its behaviour to my needs. I'm still surprised that there is no way to override these rules or remove them. – Esteban Crespi – 2017-10-03T14:16:36.967
You can override them. Using a Makefile. You can also disable them, by using
--no-builtin-rules
. It’s all in the manual. – Daniel B – 2017-10-03T14:18:04.697