Carmen En

286
-1

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
286
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Ralf Seepold Universidad Carlos III de Madrid
  • Ralf Seepold Universidad Carlos III de Madrid
  • Ralf Seepold Universidad Carlos III de Madrid
  • Ralf Seepold Universidad Carlos III de Madrid
  • Ralf Seepold Universidad Carlos III de Madrid
  • Ralf Seepold Universidad Carlos III de Madrid
  • Ralf Seepold Universidad Carlos III de Madrid
  • Ralf Seepold Universidad Carlos III de Madrid
  • Carmen En

    1. 1. IES Felipe Trigo - DAI <ul><li>Desarrollo de Aplicaciones Informáticas </li></ul><ul><li>MAKEFILE </li></ul>
    2. 2. Contents <ul><li>Introduction </li></ul><ul><li>General concept </li></ul><ul><li>Dependencies </li></ul><ul><li>Structure of Makefile and rules </li></ul><ul><li>Variables </li></ul><ul><li>Conditions </li></ul><ul><li>Implicit rules </li></ul>
    3. 3. Introduction: MAKE <ul><li>make is a widely used tool for program development in scenarios with multiple, interdependent files . </li></ul><ul><li>It uses rules predefined in a file called makefile o Makefile . </li></ul><ul><li>Construct a 'target' file indicated by the user and derived from a number of 'source' files, from which the target depends . </li></ul><ul><ul><li>$> make –h Help about make </li></ul></ul><ul><ul><li>$> make –n commands that make would execute </li></ul></ul><ul><ul><li>$> make –f filename Specifies that the file containing the rules is called neither 'makefile' nor 'Makefile', but 'filename'. </li></ul></ul>
    4. 4. Introduction: MAKE <ul><li>The make tool supports program development </li></ul><ul><li>Typically, only a small amount of data is changed when the compiler is called </li></ul><ul><li>The make tool keeps track which portions of the entire program have been changed </li></ul><ul><li>Make compiles only those parts </li></ul><ul><li>Make has a powerful dependency graph that is derived from rules </li></ul>
    5. 5. The general concept .c .h .s .o a.out Compiler Assembler Linker Executable program .c .h .s .o a.out Compiler Assembler Linker Executable program .c .s .o
    6. 6. Separation <ul><li>You need dependencies </li></ul><ul><ul><li>“ .h” is required for the first and second .c file </li></ul></ul>.c .h .s .o a.out Compiler Assembler Linker Executable program .c .s .o First Second
    7. 7. Dependency in file MAKEFILE gcc –c data.c gcc –c io.c gcc –c main.c gcc –o project data.o main.o io.o .o .o .o .c .h .c .h .c Main.c Data.c IO.c Data.h IO.h project
    8. 8. Dependency in file MAKEFILE # # First example of a Makefile # project: data.o main.o io.o gcc data.o main.o io.o –o project data.o: data.c data.h gcc –c data.c main.o: data.h io.h main.c gcc –c main.c io.o: io.h io.c gcc –c io.c .o .o .o .c .h .c .h .c Main.c Data.c IO.c Data.h IO.h project
    9. 9. Dependency: Edit data.c .o .o .o .c .h .c .h .c Main.c Data.c IO.c Data.h IO.h project Edit project : data.o main.o io.o gcc data.o main.o io.o –o project data.o : data.c data.h gcc –c data.c main.o: data.h io.h main.c gcc –c main.c io.o: io.h io.c gcc –c io.c
    10. 10. Rules Makefile Computer Architecture Laboratory 2010 main.o : main.c define.h $(CC) –c main.c Shell command(s) Target(s) Separator (:) Dependencies Tabulator symbol

    ×