| |
������� ���� ����� ���� ����� ������� � ��������� ������ ��� ������� make. � ��������� ������� make ����� ���������� ������� ���� edit (�������� ����� ������ ����� edit):
make edit
���� �� ��������� �����-���� ���� � ��������� ������, �� make �������� � �������� ������� ������, ����������� � make-����� ����. ����������, ``������� �������'' ��������� ������ make ����� ����������� ���:
make()
{
�������_���� = ������������������()
�����������( �������_���� )
}
����� ���� ��� ������� ���� �������, make ��������� ``�����������'' ��������� ���������� ����. ������� � make-����� ������ �������, ������� ��������� ������ ���������� ���� ���� (������� ������������). �����, � ���������� ������� ����������� ������� �������� ��������� ������ (������� �����������������).
�����������( ���� )
{
������� = ������������( ���� )
�����������������( ������� )
}
��������� ������� ����������� �� ��� �������� �����. �� ������ ����� �������������� ��� �����������, ������������� � ������� (������� ���������������������). �� ������ ����� ����������� ������� - ����� �� ��������� ��������� � ������� ������� (������� ���������������������). ��� �������������, ������������� � ������� ������� ����������� (������� ����������������).
�����������������( ������� )
{
���������������������( ������� )
���� ���������������������( ������� )
{
����������������( ������� )
}
}
������� ��������������������� ���������� ��������� ��� ������������� � ������� �����������. ��������� �� ��� ����� ��������� ������ �����-������ ������. ��� ���� ������������ ����������� ������� ��������� ���������� ���� (������� �����������). �� �����������, ������� �� �������� ������, ��������� ������� ������. ��� ����� ������ ����������� ���� �� �������. ��� �� ����������, make �������� ��������� ������ � ���������� �� ������.
���������������������( ������� )
{
���� �� i=1 �� �������.�����_������������
{
���� �������������( �������.�����������[ i ] )
{
�����������( �������.�����������[ i ] )
}
�����
{
���������������������( �������.�����������[ i ] )
}
}
}
�� ������ ��������� ������ �������� ������ - ����� �� ��������� ��������� � ������� ������� ��� ���. ���������, ��� ����� ��������� ������� ����:
���������������������( ������� )
{
���� �������.����.�������������������()
return true
// ���� �������� ������ �����
���� ����������������( �������.���� )
return true
���� �� i=1 �� �������.�����_������������
{
���� �������.�����������[ i ].�������������������()
return true
�����
// ����������� �������� ������ �����
{
���� ����������������( �������.�����������[ i ] ) >
����������������( �������.���� )
return true
}
}
return false
}
� ��������� ������� ����� �� ��������� �������� edit. ������ ����� �� ���
���������� �������� ���������� ���� ����� �������� (.o), ������������� ���
�����������. ���������� edit.o, � ���� �������, ������� ���������� edit.cc �
defs.h. ��������������, ��� edit.cc �������� �������� ������, �� ��������
��������� edit.o, � defs.h �������� ������������ ������, ������� ���������� �
edit.cc. ������, ����������� �� ��� �����, ���; �������, ���, ��� �������,
������ ������ ������������. ������ edit.o ��������� �������, ���� �� �������
�����, ��� edit.cc ��� defs.h (���� �� ������ ��, ��� ������, ��� ���� �� ����
������ ��������� �� ������� ��������� ���������� edit.o). ���� edit.o ������
����� ������������, gmake ��������� �������� ``gcc -g -c -Wall edit.cc'',
�������� ����� edit.o. ����� edit.o � ��� ������ ����� .o ����� ���������,
��� ����� ������� ������ ��������� ``gcc -g -o edit ...'', ����� �������
��������� edit, ���� ���� edit ��� �� ����������, ���� ����� �� ������ .o
�����, ��� ������������ ���� edit.
����� ������� gmake ��� ����� �������, ����������� �������
gmake -f <makefile-name> <target-names>
��� <target-names> - ��� ����� �����, ������� �� ������ ��������, �
<makefile-name>, �������� ����� ����� -f, �������� ������ make-�����.
�� ���������, ����� �������� ������ ������� � �����. �� ������ (������ ��� �
������) �������� -f makefile-name, � � ���� ������ �� ��������� ����� �������
��� makefile ��� Makefile, ���� ����� �� ���� ������ ����������.
������ ������ ������� �������� �������� ��� ��� ������� ����� ���������. �������� �������, ��� ��� ��������� ������������� ������ ����, � ��� make-���� ��� �������� ���������� makefile, �� ��������� ����, ��� ����� ������� gmake ��� ���������� � ����� �������� �������� � ���������� ����� ��������� � ���� ��������.
��� ����� � ��� �� ���� ����� ���� ��������� ������, �� �� ����� ��� ���� ������� ��� ���� ������ ����� ��������. �������, �� ����� ���������� ��������� ����� ������� ��������� �������.
edit.o : edit.cc
gcc -g -c -Wall edit.cc
kbd.o : kbd.cc
gcc -g -c -Wall kbd.cc
commands.o : command.cc
gcc -g -c -Wall commands.cc
display.o : display.cc
gcc -g -c -Wall display.cc
insert.o : insert.cc
gcc -g -c -Wall insert.cc
search.o : search.cc
gcc -g -c -Wall search.cc
files.o : files.cc
gcc -g -c -Wall files.cc
utils.o : utils.cc
gcc -g -c -Wall utils.ccedit.o kbd.o commands.o display.o
![]()
insert.o search.o files.o utils.o: defs.h
kbd.o commands.o files.o : command.h
display.o insert.o search.o files.o : buffer.h
�������, � ������� �������� ��� �������, �� ����� ��������. ������ �� ������� �� ������ ����� � ������ ������� ����������� ������.