Talk:Makefile: Difference between revisions
Content deleted Content added
→Proper use of CFLAGS: use of += instead of = |
Re: CFLAGS |
||
Line 122:
I know that using CFLAGS like I did is frowned upon, as it overwrites any environment variable the user might have set. Since I don't feel the pressure in PDCLib, and don't have any other C/C++ project using Makefiles at the moment... does anyone have a canon / working alternative? -- [[User:Solar|Solar]] 03:01, 25 May 2012 (CDT)
:My personal solution is to have a different named set of flags and append CFLAGS as appropriate:
CPARAMS := "-m32 -DNEEDED_DEFINE -DOTHER_DEFINE -Wall -Wextra -fno-omit-frame-pointer"
(...)
%.o: %.c
$(CC) $(CFLAGS) $(CPARAMS) -c -o $@ $<
:Which under many circumstances has exactly the intended effect, but it does little to prevent conflicting params/flagsets other than hoping they override in order. - [[User:Combuster|Combuster]] 15:00, 25 May 2012 (CDT)
|