Talk:Makefile: Difference between revisions
Content deleted Content added
→Proper use of CFLAGS: new section |
→Proper use of CFLAGS: use of += instead of = |
||
Line 121:
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)
:How about CFLAGS += ...? e.g.
<pre>
CFLAGS += -g -Wall
make
gcc -g -Wall -o test test.c
CFLAGS=-O3 make
gcc -O3 -g -Wall -o test test.c
</pre>
:Obviously this can lead to errors if the user-specified flags conflict with those you specify. [[User:Jnc100|John]] 06:02, 25 May 2012 (CDT)
|