La herramienta make - PowerPoint PPT Presentation

About This Presentation
Title:

La herramienta make

Description:

Instituto de Astrof sica de Canarias. La herramienta make. C mo leer y modificar un Makefile. rea de Instrumentaci n. Esperanza P ez ... – PowerPoint PPT presentation

Number of Views:26
Avg rating:3.0/5.0
Slides: 41
Provided by: jesu72
Category:

less

Transcript and Presenter's Notes

Title: La herramienta make


1
La herramienta make
  • Cómo leer y modificar un Makefile

2
gt make ?
busca por makefile
busca por Makefile
3
gt make ?make No makefile found. Stop.
4
gt make ?make No makefile found. Stop.gt
make f mimakefile.mak ?
objetivo dependencias
5
gt make ?make No makefile found. Stop.gt
make f mimakefile.mak ?
main main.f
dependecias
objetivo
6
gt make ?make No makefile found. Stop.gt
make f mimakefile.mak ?f77 main.f o main
main main.f
.f extensión reconocida
sólo si no existe o si antiguo
7
gt make ?make No makefile found. Stop.gt
make f mimakefile.mak ?make main is up date.
main main.f
8
gt make ?
main main.f fn1.f fn2.f
?
dependecias
objetivo
9
gt make ?
main main.f fn1.f fn2.f main2 main2.f
fn3.f fn4.f
objetivo1
objetivo2
10
gt make objetivogt make main2 ?
main main.f fn1.f fn2.f main2 main2.f
fn3.f fn4.f
objetivo1
objetivo2
11
gt make objetivo ?
main main.o fn1.o fn2.o main.o
main.f fn1.o fn1.f fn2.o fn2.f
jerarquía
12
gt make objetivo ?
main main.o fn1.o fn2.o TAB f77 O o main
main.o fn1.o fn2.o main.o main.f fn1.o
fn1.f fn2.o fn2.f
línea de comando
13
gt make objetivo ?
main main.o fn1.o fn2.o TAB f77 O o main
main.o fn1.o fn2.o main.o main.f TAB f77 O
c main.f fn1.o fn1.f fn2.o fn2.f
línea de comando
14
gt make objetivo ?
main main.o fn1.o fn2.o TAB f77 O o main
main.o fn1.o fn2.o main.o main.f TAB f77 O
c main.f fn1.o fn1.f TAB f77 O c
fn1.f fn2.o fn2.f
línea de comando
15
gt make objetivo ?
main main.o fn1.o fn2.o TAB f77 O o main
main.o fn1.o fn2.o main.o main.f TAB f77 O
c main.f fn1.o fn1.f TAB f77 O c
fn1.f fn2.o fn2.f TAB f77 O c fn2.f
línea de comando
ojo con los tabuladores
16
gt make objetivo ?
main main.o fn1.o fn2.o TAB f77 O o main
main.o fn1.o fn2.o main.o main.f TAB f77 O
c main.f fn1.o fn1.f TAB f77 O c
fn1.f fn2.o fn2.f TAB f77 O c fn2.f
  • orden shell sh
  • división líneas \
  • ? un comando
  • ? una línea ojo
  • sin eco _at_

17
gt make objetivo ?
main main.o fn1.o fn2.o TAB f77 O o main
main.o fn1.o fn2.o TAB _at_ echo Muevo el
ejecutable. TAB _at_ mv main .. ls TAB _at_ cd
.. \ RETURN chmod ax main main.o
main.f TAB f77 O c main.f fn1.o
fn1.f TAB f77 O c fn1.f fn2.o
fn2.f TAB f77 O c fn2.f
  • orden shell sh
  • división líneas \
  • ? un comando
  • ? una línea ojo
  • sin eco _at_

18
gt make objetivo ?
main main.o fn1.o fn2.o TAB f77 O o main
main.o fn1.o fn2.o main.o main.f TAB f77 O
c main.f fn1.o fn1.f TAB f77 O c
fn1.f fn2.o fn2.f TAB f77 O c fn2.f fn1.o
include.inc fn2.o include.inc
repetición de objetivos
19
gt make limpia ?
main main.o fn1.o fn2.o TAB f77 O o main
main.o fn1.o fn2.o main.o main.f TAB f77 O
c main.f fn1.o fn1.f TAB f77 O c
fn1.f fn2.o fn2.f TAB f77 O c fn2.f fn1.o
fn2.o include.inc limpia TAB rm
podemos agrupar
objetivo etiqueta
20
gt make todo ?gt make libreria.a ?gt make limpia
?gt
todo libreria.a main limpia main main.o
fn1.o fn2.o TAB f77 O o main main.o fn1.o
fn2.o main.o main.f TAB f77 O c
main.f fn1.o fn1.f TAB f77 O c
fn1.f fn2.o fn2.f TAB f77 O c fn2.f fn1.o
fn2.o include.inc libreria.a
libfn.o TAB ar r libreria.a libfn.o libfn.o
libfn.f TAB f77 O c libfn.f limpia
TAB rm
?
21
gt make ?
nombre valor
macro se referencia como (nombre) o nombre
22
gt make ?
  • macros del usuario
  • macros internas
  • variables de entorno
  • línea de ejecución
  • indefinidas vacías

Orden de prioridad 1) macros internas 2)
variables entorno 3) en Makefile 4) línea de
ejecución
EXE main OBJS main.o fn1.o fn2.o INCS
include.inc FFLAGS O LDFLAGS
FFLAGS EXE OBJS TAB f77 LDFLAGS
o EXE OBJS TAB cp EXE
/home/usuario/bin main.o main.f TAB f77
FFLAGS c main.f fn1.o fn1.f TAB f77
FFLAGS c fn1.f fn2.o fn2.f TAB f77
FFLAGS c fn2.f fn1.o fn2.o INCS
23
gt touch fn2.f ?gt make FFLAGS v O ?f77 v
O c fn2.f f77 v O o main main.o fn1.o fn2.o
EXE main OBJS main.o fn1.o fn2.o DIR
HOME/bin FFLAGS O LDFLAGS
FFLAGS EXE OBJS TAB FC
LDFLAGS o EXE OBJS TAB cp EXE
DIR main.o main.f TAB FC FFLAGS c
main.f fn1.o fn1.f TAB FC FFLAGS c
fn1.f fn2.o fn2.f TAB FC FFLAGS c
fn2.f fn1.o fn2.o include.inc
  • FFLAGS ignorada
  • FC f77 (interna)
  • podemos FC f90
  • make p
  • no usar en rutas

24
gt touch fn2.f ?gt make FFLAGS v O ?f77 v
O c fn2.f f77 v O o main main.o fn1.o fn2.o
EXE main SRCS main.f fn1.f fn2.f OBJS
SRCS.f.o FFLAGS O LDFLAGS
FFLAGS EXE OBJS TAB FC
LDFLAGS o EXE OBJS TAB cp EXE
HOME/bin main.o main.f TAB FC
FFLAGS c main.f fn1.o fn1.f TAB FC
FFLAGS c fn1.f fn2.o fn2.f TAB FC
FFLAGS c fn2.f fn1.o fn2.o include.inc
OBJS SRCS pero sustituyendo .f por .o
25
gt touch fn2.f ?gt make FFLAGS v O ?f77 v
O c fn2.f f77 v O o main main.o fn1.o fn2.o
EXE main SRCS main.f fn1.f fn2.f OBJS
SRCS.f.o FFLAGS O LDFLAGS
FFLAGS EXE OBJS TAB FC
LDFLAGS o EXE OBJS TAB cp EXE
HOME/bin main.o main.f TAB FC
FFLAGS c main.f fn1.o fn1.f TAB FC
FFLAGS c fn1.f fn2.o fn2.f TAB FC
FFLAGS c fn2.f fn1.o fn2.o include.inc
? lista de dependencias _at_
objetivo en comandos _at_ objetivo
(sólo Unix) en dependencias
26
gt touch fn2.f ?gt make FFLAGS v O ?f77 v
O c fn2.f f77 v O o main main.o fn1.o fn2.o
EXE main SRCS fn1.f fn2.f OBJS
SRCS.f.o FFLAGS O LDFLAGS
FFLAGS EXE _at_.o OBJS TAB FC
LDFLAGS o EXE OBJS TAB cp EXE
HOME/bin main.o main.f TAB FC
FFLAGS c main.f fn1.o fn1.f TAB FC
FFLAGS c fn1.f fn2.o fn2.f TAB FC
FFLAGS c fn2.f fn1.o fn2.o include.inc
omitimos main.f
_at_.o main.o
27
gt touch fn2.f ?gt make FFLAGS v O ?f77 v
O c fn2.f f77 v O o main main.o fn1.o fn2.o
EXE main SRCS fn1.f fn2.f OBJS
SRCS.f.o FFLAGS O LDFLAGS
FFLAGS EXE _at_.o OBJS TAB FC
LDFLAGS o _at_ OBJS TAB cp _at_
HOME/bin main.o main.f TAB FC
FFLAGS c main.f fn1.o fn1.f TAB FC
FFLAGS c fn1.f fn2.o fn2.f TAB FC
FFLAGS c fn2.f fn1.o fn2.o include.inc
omitimos main.f
_at_.o main.o
_at_ main
28
gt touch fn2.f ?gt make FFLAGS v O ?f77 v
O c fn2.f f77 v O o main main.o fn1.o fn2.o
EXE main SRCS fn1.f fn2.f OBJS
SRCS.f.o FFLAGS O LDFLAGS
FFLAGS EXE _at_.o OBJS TAB FC
LDFLAGS o _at_ ? TAB cp _at_
HOME/bin main.o main.f TAB FC
FFLAGS c main.f fn1.o fn1.f TAB FC
FFLAGS c fn1.f fn2.o fn2.f TAB FC
FFLAGS c fn2.f fn1.o fn2.o include.inc
omitimos main.f
_at_.o main.o
_at_ main
? main.o fn1.o fn2.o
29
gt touch fn2.f ?gt make FFLAGS v O ?f77 v
O c fn2.f f77 v O o main main.o fn1.o fn2.o
EXE main SRCS fn1.f fn2.f OBJS
SRCS.f.o FFLAGS O LDFLAGS
FFLAGS EXE _at_.o OBJS TAB FC
LDFLAGS o _at_ ? TAB cp _at_
HOME/bin main.o main.f TAB FC
FFLAGS c ? fn1.o fn1.f TAB FC
FFLAGS c fn1.f fn2.o fn2.f TAB FC
FFLAGS c fn2.f fn1.o fn2.o include.inc
omitimos main.f
_at_.o main.o
_at_ main
? main.o fn1.o fn2.o
? main.f
30
gt touch fn2.f ?gt make FFLAGS v O ?f77 v
O c fn2.f f77 v O o main main.o fn1.o fn2.o
EXE main SRCS fn1.f fn2.f OBJS
SRCS.f.o FFLAGS O LDFLAGS
FFLAGS EXE _at_.o OBJS TAB FC
LDFLAGS o _at_ ? TAB cp _at_
HOME/bin main.o main.f TAB FC
FFLAGS c ? fn1.o fn1.f TAB FC
FFLAGS c ? fn2.o fn2.f TAB FC
FFLAGS c fn2.f fn1.o fn2.o include.inc
omitimos main.f
_at_.o main.o
_at_ main
? main.o fn1.o fn2.o
? main.f
? fn1.f
31
gt touch fn2.f ?gt make FFLAGS v O ?f77 v
O c fn2.f f77 v O o main main.o fn1.o fn2.o
EXE main SRCS fn1.f fn2.f OBJS
SRCS.f.o FFLAGS O LDFLAGS
FFLAGS EXE _at_.o OBJS TAB FC
LDFLAGS o _at_ ? TAB cp _at_
HOME/bin main.o main.f TAB FC
FFLAGS c ? fn1.o fn1.f TAB FC
FFLAGS c ? fn2.o fn2.f TAB FC
FFLAGS c ? fn1.o fn2.o include.inc
omitimos main.f
_at_.o main.o
_at_ main
? main.o fn1.o fn2.o
? main.f
? fn1.f
? fn2.f
32
gt touch fn2.f ?gt make FFLAGS v O ?f77 v
O c fn2.f f77 v O o main main.o fn1.o fn2.o
EXE main SRCS fn1.f fn2.f OBJS
SRCS.f.o FFLAGS O LDFLAGS
FFLAGS EXE _at_.o OBJS TAB FC
LDFLAGS o _at_ ? TAB cp _at_
HOME/bin main.o main.f TAB FC
FFLAGS c ? fn1.o fn1.f TAB FC
FFLAGS c ? fn2.o fn2.f TAB FC
FFLAGS c ? OBJS include.inc
OBJS fn1.o fn2.o
se desdobla
33
gt touch fn2.f ?gt make FFLAGS v O ?f77 v
O c fn2.f f77 v O o main main.o fn1.o fn2.o
EXE main SRCS fn1.f fn2.f OBJS
SRCS.f.o FFLAGS O LDFLAGS
FFLAGS EXE _at_.o OBJS TAB FC
LDFLAGS o _at_ ? TAB cp _at_
HOME/bin main.o main.f TAB FC
FFLAGS c ? fn1.o fn1.f TAB FC
FFLAGS c ? fn2.o fn2.f TAB FC
FFLAGS c ? OBJS include.inc
34
gt touch fn2.f ?gt make FFLAGS v O ?f77 v
O c fn2.f f77 v O o main main.o fn1.o fn2.o
EXE main SRCS fn1.f fn2.f INCS
include.inc OBJS SRCS.f.o DIR
HOME/bin FFLAGS O LDFLAGS
FFLAGS .f.o TAB FC FFLAGS c
lt EXE _at_.o OBJS TAB FC
LDFLAGS o _at_ ? TAB cp _at_
DIR OBJS INCS
regla para construir los .o a partir de los .f
lt .f más nuevos
35
gt touch fn2.f ?gt make FFLAGS v O ?f77 v
O c fn2.f f77 v O o main main.o fn1.o fn2.o
EXE main SRCS fn1.F fn2.F INCS
include.inc OBJS SRCS.f.o DIR
HOME/bin FFLAGS O LDFLAGS
FFLAGS .SUFFIXES .F .F.o TAB FC
FFLAGS c lt EXE _at_.o
OBJS TAB FC LDFLAGS o _at_ ? TAB cp
_at_ DIR OBJS INCS
?
añade sufijos a lista de make
36
Makefile de IRAF
Name makefile Purpose Build
and install the IRAFSTAR package. Type of
Module Description file for the make
utility. Description This description
file is used by the make utility to build
the IRAFSTAR package from the distributed
source files, to install the resulting system for
use, and to perform other housekeeping
tasks.
Pathname of the root directory
beneath which other Starlink software is
currently installed. STARLINK /star
37
Makefile de IRAF
Pathnames of Starlink sub-directories that may
be referenced when building this
package. STAR_BIN (STARLINK)/bin STAR_DATES
(STARLINK)/dates STAR_DOCS
(STARLINK)/docs STAR_ETC (STARLINK)/etc STAR_
HELP (STARLINK)/help STAR_INC
(STARLINK)/include STAR_LIB
(STARLINK)/lib STAR_SHARE (STARLINK)/share
Pathname of the root directory beneath which the
built files for this package should be
installed for use. This defaults to the user's
home directory. INSTALL (HOME) Pathname of
root directory beneath which TCLADAM is
installed. and the version number of
TCL TCL_VERS 8.2 TCL_INC_DIR
(STAR_INC) TCL_LIB_DIR (STAR_LIB)
38
Makefile de IRAF
Default macros for compiling C and Fortran
source code. CC c89 CFLAGS -O
-I(TCL_INC_DIR) -I(STAR_INC) FC fort77 FFLAGS
-O   Commands for adding to and extracting
from an archive file (.tar). TAR_IN tar
cvhf TAR_OUT tar xf --------------------------
--------------------------------------------------
--- DEFINE PACKAGE SOURCE FILES. This
section defines the set of source files for the
package.   Name of the package as specified in
documentation The value is used in messages
from make to the user. PACK_NAME IRAFSTAR  
39
Makefile de IRAF
C routines required for building the package.
This is just a list of all the C source
files. C_ROUTINES tclAppInit.c tclIrafio.c
zfiopr.c ---------------------------------------
---------------------------------------- DEFINE
FILES REQUIRED FOR BUILDING THE PACKAGE.
This section defines the set of files produced
from the source files when the package is built
and installed.   List of object files produced
by compiling the source code and rules for
performing the compilations. OBJECT_FILES
(C_ROUTINES.c.o)   Use .o, .c, .f, .ifc,
.ifl, .shl and .hlp suffix rules. .SUFFIXES .o
.c .f .ifc .ifl .shl .hlp   Implicit
rule. .c.o (CC) (CFLAGS) -c lt
40
Makefile de IRAF

PRIMARY TARGETS. Rules for
extracting source files from the source
archive. (C_ROUTINES) TAB (TAR_OUT)
(PKG_NAME)_source.tar _at_ TAB _at_ if test -r _at_
then \ else echo _at_ is not in the tar
file exit 1 fi   Rule and dependencies for
building the executable image. aitclsh
(OBJECT_FILES) TAB (FC) (FFLAGS) -o _at_ \
tclAppInit.o (STAR_LIB)/tclAdam.o \
tclIrafio.o zfiopr.o \ (LDFLAGS)
-L(TCL_LIB_DIR) \ -L(STAR_LIB) \
-ltcl(TCL_VERS)
Write a Comment
User Comments (0)
About PowerShow.com