Reputation: 341
Say I have a file foo.c
and there is no Makefile
, when I call make foo
the implicit rules of make
conveniently kick in and compile foo.c
. Is there an easy way to add a couple flags such as -g
and -Wall
into the implicit rules?
I've seen that I could use pattern rules in a Makefile
, but I'd rather have these flags in the implicit rules apply across the entirety of my local machine (mac OS).
Upvotes: 1
Views: 149
Reputation: 282
I think I found an article for what you're looking for:
http://seshbot.com/blog/2014/06/16/make-with-no-makefile-for-c-plus-plus-playgrounds/
Basically, it tells you to set the environment variables to the flags you always want to be passed by default
Upvotes: 0
Reputation: 1906
You can prepend CFLAGS
to the command line:
CFLAGS='-g -Wall' make foo
Upvotes: 3