Note: Contributed by Brian Gallew
Brian Gallew�ˤ�����
Configuring gcc to use certain flags by default is a simple matter of editing the /usr/local/lib/gcc-lib/platform/version/specs file.
gcc �ˤ����ơ���������Υե饰��ǥե���ȤǻȤ����������Ȥ��Ƥϡ� ñ��/usr/local/lib/gcc-lib/�ץ�åȥե�����/�С������/specs �ե�������Խ���������Ǥ��� The format of this file pretty simple. The file is broken into sections, each of which is three lines long. The first line is "*section_name:" (e.g. "*asm:"). The second line is a list of flags, and the third line is blank. ���Υե�����Υե����ޥåȤϤ��ʤꥷ��ץ�Ǥ����ե�����Ϥ����Ĥ��� �����������̤�Ƥ��ꡤ�ƥ��������� 3 �Ԥ��Ĥ���ޤ����ǽ�ιԤ� "*���������̾:" (���Ȥ��� "*asm:")�Ǥ��� 2���ܤιԤϥե饰�Υꥹ�Ȥǡ�3���ܤιԤ϶���Ǥ���
The easiest change to make is to append the desired default flags to the list in the appropriate section. As an example, let's suppose that I have linux running on a '486 with gcc 2.7.2 installed in the default location. In the file /usr/local/lib/gcc-lib/i486-linux/2.7.2/specs, 13 lines down I find the following section:
�ᥤ�����뤿��˰��ִ�ñ���ѹ��ϡ����ꤷ�����ǥե���ȤΥե饰�� Ŭ�ڤʥ��������Υꥹ�Ȥ��ɲä��뤳�ȤǤ�������ȡ���� �ǥե���Ȥΰ��֤� gcc 2.7.2 �����ȡ��뤵�줿 '486 ��ư���Ƥ��� linux ����äƤ��� �Ȥ��ޤ��礦���ե����� /usr/local/lib/gcc-lib/i486-linux/2.7.2/specs �� 13 ���ܤ˰ʲ��Υ����������ޤ�:
- ----------SECTION---------- *cc1: - ----------SECTION----------As you can see, there aren't any default flags. If I always wanted compiles of C code to use "-m486 -fomit-frame-pointer", I would change it to look like: ����Ǥ狼��褦�ˡ�����ǥե���ȤΥե饰�����ꤵ��Ƥ��ޤ���͡� �⤷�䤬 C �Υ����ɤ�ѥ��뤹��ݤˡ���� "-m486 -fomit-frame-pointer" ��Ȥ������Ȥ���ȡ�������ʲ��Τ褦�� �ѹ�����Ф������Ȥˤʤ�ޤ�:
- ----------SECTION---------- *cc1: - -m486 -fomit-frame-pointer - ----------SECTION----------If I wanted to be able to generate 386 code for another, older linux box lying around, I'd have to make it look like this: �⤷�䤬�����Τؤ�ˤ������äƤ���⤦ 1 �ĤθŤ� linux box �Ѥ� 386 �Υ����ɤ������������Ȥ���С����Τ褦�ˤ��ޤ���
- ----------SECTION----------
*cc1:
%{!m386:-m486} -fomit-frame-pointer
- ----------SECTION----------
This will always omit frame pointers, any will build 486-optimized
code unless -m386 is specified on the command line.
������äƤ����ȡ����ޥ�ɥ饤��� -m386 �����ꤵ��ʤ��¤ꡤ
��˥ե졼��ݥ���(frame pointers)���ά����486 �Ǻ�Ŭ�����줿
�����ɤ��Ǥ��褦�ˤʤ�ޤ���
You can actually do quite a lot of customization with the specs file. Always remember, however, that these changes are global, and affect all users of the system.
�ºݤˡ�specs �ե�����Ǥ�����¿���Υ������ޥ����뤳�Ȥ��Ǥ��ޤ��� �������ʤ��顤�������ѹ��ϥ������Х�Ǥ��ꡤ�����ƥ���Τ��٤Ƥ� �桼���˱ƶ���ڤܤ����Ȥ�˺��ʤ��Ǥ���������