KDevelop4/Manual/Building (compiling) projects with custom Makefiles/uk: Difference between revisions
(Created page with "{{Note_(uk)|1='''KDevelop''' 4.x не може працювати з '''GNU autotools''' безпосередньо на час написання цього підручника...") |
(Created page with "Якщо під час компіляції буде виявлено помилку, просто наведіть вказівник миші на повідомлення пр...") |
||
Line 8: | Line 8: | ||
The first step is to teach '''KDevelop''' about targets in your Makefiles. There are two ways to do that: selecting individual Makefile targets, and choosing a set of targets you may want to build frequently. For both approaches, open | The first step is to teach '''KDevelop''' about targets in your Makefiles. There are two ways to do that: selecting individual Makefile targets, and choosing a set of targets you may want to build frequently. For both approaches, open | ||
the | the '''Projects''' tool by clicking on the <menuchoice>Projects</menuchoice> button on the perimeter of '''KDevelop's''' main window (if you don't have this button see above how to add a tool's button there). The '''Projects''' tool window has two parts: the top half — titled '''Projects''' — lists all of your projects and let's you expand the underlying directory trees. The bottom half — titled '''Project Selection''' — lists a subset of those projects that will be built if you choose the menu item <menuchoice>Project -> Build selection</menuchoice> or hit <keycap>F8</keycap>; we'll come back to this part below. | ||
<span id="Building individual Makefile targets"></span> | <span id="Building individual Makefile targets"></span> | ||
=== Збирання окремих цілей з Makefile === | === Збирання окремих цілей з Makefile === | ||
Line 16: | Line 16: | ||
[[Image:kdevelop-1a.png|thumb|500px|center]] | [[Image:kdevelop-1a.png|thumb|500px|center]] | ||
To build any of the targets listed there, click on it with the right mouse button and select <menuchoice>Build</menuchoice>. For example, doing this with the "clean" target will simply execute "make clean". You can see this happening in the subwindow titled | To build any of the targets listed there, click on it with the right mouse button and select <menuchoice>Build</menuchoice>. For example, doing this with the "clean" target will simply execute "make clean". You can see this happening in the subwindow titled '''Build''' that opens up, showing the command and the output. (This window corresponds to the '''Build''' tool, so you can close and later re-open the window using the <menuchoice>Build</menuchoice> tool button on the perimeter of the main window. It is shown at the bottom right of the picture.) | ||
<span id="Selecting a collection of Makefile targets for repeated building"></span> | <span id="Selecting a collection of Makefile targets for repeated building"></span> | ||
=== Вибір збірки цілей з Makefile для регулярного збирання === | === Вибір збірки цілей з Makefile для регулярного збирання === | ||
Line 23: | Line 23: | ||
hit the <keycap>F8</keycap> function key. | hit the <keycap>F8</keycap> function key. | ||
The list of selected Makefile targets is shown in the bottom half of the | The list of selected Makefile targets is shown in the bottom half of the '''Projects''' tool view. | ||
By default, the selection contains all projects, but you can change that. For example, if your list of projects contains three projects (a base library L and two applications A and B), but you're currently only working on project A, then you may want to remove project B from the selection by highlighting it in the selection and hitting the red <menuchoice>-</menuchoice> button. Furthermore, you probably want to make sure that the library L is built before project A by moving entries in the selection up and down using the buttons to the right of the list. You can also get a particular Makefile target into the selection by right-clicking onto it and selecting <menuchoice>Add to buildset</menuchoice>, or just highlighting it and hitting the green <menuchoice>+</menuchoice> button just above the list of selected targets. | By default, the selection contains all projects, but you can change that. For example, if your list of projects contains three projects (a base library L and two applications A and B), but you're currently only working on project A, then you may want to remove project B from the selection by highlighting it in the selection and hitting the red <menuchoice>-</menuchoice> button. Furthermore, you probably want to make sure that the library L is built before project A by moving entries in the selection up and down using the buttons to the right of the list. You can also get a particular Makefile target into the selection by right-clicking onto it and selecting <menuchoice>Add to buildset</menuchoice>, or just highlighting it and hitting the green <menuchoice>+</menuchoice> button just above the list of selected targets. | ||
Line 31: | Line 31: | ||
=== Обробка повідомлень про помилки === | === Обробка повідомлень про помилки === | ||
Якщо під час компіляції буде виявлено помилку, просто наведіть вказівник миші на повідомлення про помилку і клацніть лівою кнопкою миші. Курсор буде переведено до рядка (і, якщо вказано, позиції у рядку), де було виявлено помилку. Залежно від типу помилки, '''KDevelop''' може також запропонувати вам декілька варіантів дій для її виправлення, наприклад, за допомогою оголошення неоголошеної змінної, якщо таку змінну було виявлено. | |||
{{Prevnext2 | {{Prevnext2 |
Revision as of 13:31, 25 May 2011
Збирання (компіляція) проектів з нетиповими Makefile
У багатьох проектах спосіб збирання файлів коду та визначення тих файлів, які слід повторно зібрати у разі внесення змін до коду, виконується за допомогою файлів Makefile, обробку яких здійснює програма make (див., наприклад, GNU make). У простих проектах нескладно створити такий файл власноруч. У великих проектах створення таких файлів часто покладається на GNU autotools (autoconf, autoheader, automake). У цьому розділі ми припускатимемо, що файл Makefile вашого проекту вже створено, вам просто потрібно вказати KDevelop, у який спосіб слід взаємодіяти з цим файлом.
./configure
або подібний до нього скрипт з командного рядка вручну. Якщо ви бажаєте зробити це з самого вікна KDevelop, відкрийте панель інструмента Konsole (якщо потрібно, додайте цю панель у нижній частині головного вікна за допомогою пункту меню ), у якій можна буде віддати команду оболонці і вкажіть команду ./configure
.
The first step is to teach KDevelop about targets in your Makefiles. There are two ways to do that: selecting individual Makefile targets, and choosing a set of targets you may want to build frequently. For both approaches, open the Projects tool by clicking on the F8; we'll come back to this part below.
button on the perimeter of KDevelop's main window (if you don't have this button see above how to add a tool's button there). The Projects tool window has two parts: the top half — titled Projects — lists all of your projects and let's you expand the underlying directory trees. The bottom half — titled Project Selection — lists a subset of those projects that will be built if you choose the menu item or hitЗбирання окремих цілей з Makefile
In the top part of the project view, expand the sub-tree for one project, let's say the one for which you want to run a particular Makefile target. This will give you icons for (i) directories under this project, (ii) files in the top-level directory for this project, (iii) Makefile targets KDevelop can identify. These categories are shown in the picture at right. Note that KDevelop understands Makefile syntax to a certain degree and therefore can offer you targets defined in this Makefile (though this understanding has its limits if targets are composed or implicit).
To build any of the targets listed there, click on it with the right mouse button and select
. For example, doing this with the "clean" target will simply execute "make clean". You can see this happening in the subwindow titled Build that opens up, showing the command and the output. (This window corresponds to the Build tool, so you can close and later re-open the window using the tool button on the perimeter of the main window. It is shown at the bottom right of the picture.)Вибір збірки цілей з Makefile для регулярного збирання
Right-clicking on individual Makefile targets every time you want to build something will quickly get old. Rather, we'd like to have individual targets for one or more of the projects in the session that we can repeatedly build without much mouse work. This is where the concept of "Build target selections" comes in: it is a collection of Makefile targets that are built one-after-the-other whenever you hit the F8 function key.
button in the button list at the top, select the menu item, or hit theThe list of selected Makefile targets is shown in the bottom half of the Projects tool view. By default, the selection contains all projects, but you can change that. For example, if your list of projects contains three projects (a base library L and two applications A and B), but you're currently only working on project A, then you may want to remove project B from the selection by highlighting it in the selection and hitting the red
button. Furthermore, you probably want to make sure that the library L is built before project A by moving entries in the selection up and down using the buttons to the right of the list. You can also get a particular Makefile target into the selection by right-clicking onto it and selecting , or just highlighting it and hitting the green button just above the list of selected targets.KDevelop allows you to configure what to do whenever you build the selection. To this end, use the menu item
. There, you can for example select the number of simultaneous jobs "make" should execute — if your computer has, say, 8 processor cores, then entering 8 in this field would be a useful choice. In this dialog, the is a Makefile target used for all targets in the selection.Обробка повідомлень про помилки
Якщо під час компіляції буде виявлено помилку, просто наведіть вказівник миші на повідомлення про помилку і клацніть лівою кнопкою миші. Курсор буде переведено до рядка (і, якщо вказано, позиції у рядку), де було виявлено помилку. Залежно від типу помилки, KDevelop може також запропонувати вам декілька варіантів дій для її виправлення, наприклад, за допомогою оголошення неоголошеної змінної, якщо таку змінну було виявлено.