Overriding defaults from within Makefile?

Is there a way to set options and override defaults from within a Makefile?

I have my own "make libraries" and don't want to include sys.mk when compiling within my project directory. I also don't care to set MAKEFLAGS since when I'm not in one of my projects I would rather have the default behavior. Is there a way to do this?

P.S. Right now I'm imagining some sort of hack if I can't do this. Such as a "make" script earlier in the path to replace /usr/bin/make and check for a special file if it exists to then invoke make with -r. Or maybe a zsh hook to change a make alias depending on the current directory.
 
BlueCoder, I realize this thread is a bit old. But it isn't quite apparent to me exactly what you mean, when you talk about Makefile. Are you attempting to create a program yourself, with your own source? This would then mean you're speaking of your own Makefile. In which case, you have no "preconceived" variables, other than those you chose/make. OTOH if you're speaking of specific application Makefile's within the FreeBSD ports tree, things (your environment) are different, and you can still define your environment with great flexibility. There are a wealth of KNOBS, and other DEFINES, available. Many, if not all, are fairly easily ascertainable, by looking through the files in /usr/ports/Mk/.

If I haven't covered it. Perhaps you could be a bit more specific, and maybe provide an example.

All the best.

--Chris
 
Back
Top