home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / gnu / make-3.70-src.lha / src / amiga / make-3.70 / make.info-7 < prev    next >
Encoding:
GNU Info File  |  1993-12-17  |  16.8 KB  |  506 lines

  1. This is Info file make.info, produced by Makeinfo-1.54 from the input
  2. file ./make.texinfo.
  3.  
  4.    This file documents the GNU Make utility, which determines
  5. automatically which pieces of a large program need to be recompiled,
  6. and issues the commands to recompile them.
  7.  
  8.    This is Edition 0.45, last updated 14 December 1993, of `The GNU
  9. Make Manual', for `make', Version 3.70 Beta.
  10.  
  11.    Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
  12. Foundation, Inc.
  13.  
  14.    Permission is granted to make and distribute verbatim copies of this
  15. manual provided the copyright notice and this permission notice are
  16. preserved on all copies.
  17.  
  18.    Permission is granted to copy and distribute modified versions of
  19. this manual under the conditions for verbatim copying, provided that
  20. the entire resulting derived work is distributed under the terms of a
  21. permission notice identical to this one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that this permission notice may be stated in a
  26. translation approved by the Free Software Foundation.
  27.  
  28. 
  29. File: make.info,  Node: Quick Reference,  Next: Complex Makefile,  Prev: Makefile Conventions,  Up: Top
  30.  
  31. Quick Reference
  32. ***************
  33.  
  34.    This appendix summarizes the directives, text manipulation functions,
  35. and special variables which GNU `make' understands.  *Note Special
  36. Targets::, *Note Catalogue of Implicit Rules: Catalogue of Rules, and
  37. *Note Summary of Options: Options Summary, for other summaries.
  38.  
  39.    Here is a summary of the directives GNU `make' recognizes:
  40.  
  41. `define VARIABLE'
  42. `endef'
  43.      Define a multi-line, recursively-expanded variable.
  44.      *Note Sequences::.
  45.  
  46. `ifdef VARIABLE'
  47. `ifndef VARIABLE'
  48. `ifeq (A,B)'
  49. `ifeq "A" "B"'
  50. `ifeq 'A' 'B''
  51. `ifneq (A,B)'
  52. `ifneq "A" "B"'
  53. `ifneq 'A' 'B''
  54. `else'
  55. `endif'
  56.      Conditionally evaluate part of the makefile.
  57.      *Note Conditionals::.
  58.  
  59. `include FILE'
  60.      Include another makefile.
  61.      *Note Including Other Makefiles: Include.
  62.  
  63. `override VARIABLE = VALUE'
  64. `override VARIABLE := VALUE'
  65. `override VARIABLE += VALUE'
  66. `override define VARIABLE'
  67. `endef'
  68.      Define a variable, overriding any previous definition, even one
  69.      from the command line.
  70.      *Note The `override' Directive: Override Directive.
  71.  
  72. `export'
  73.      Tell `make' to export all variables to child processes by default.
  74.      *Note Communicating Variables to a Sub-`make': Variables/Recursion.
  75.  
  76. `export VARIABLE'
  77. `export VARIABLE = VALUE'
  78. `export VARIABLE := VALUE'
  79. `export VARIABLE += VALUE'
  80. `unexport VARIABLE'
  81.      Tell `make' whether or not to export a particular variable to child
  82.      processes.
  83.      *Note Communicating Variables to a Sub-`make': Variables/Recursion.
  84.  
  85. `vpath PATTERN PATH'
  86.      Specify a search path for files matching a `%' pattern.
  87.      *Note The `vpath' Directive: Selective Search.
  88.  
  89. `vpath PATTERN'
  90.      Remove all search paths previously specified for PATTERN.
  91.  
  92. `vpath'
  93.      Remove all search paths previously specified in any `vpath'
  94.      directive.
  95.  
  96.    Here is a summary of the text manipulation functions (*note
  97. Functions::.):
  98.  
  99. `$(subst FROM,TO,TEXT)'
  100.      Replace FROM with TO in TEXT.
  101.      *Note Functions for String Substitution and Analysis: Text
  102.      Functions.
  103.  
  104. `$(patsubst PATTERN,REPLACEMENT,TEXT)'
  105.      Replace words matching PATTERN with REPLACEMENT in TEXT.
  106.      *Note Functions for String Substitution and Analysis: Text
  107.      Functions.
  108.  
  109. `$(strip STRING)'
  110.      Remove excess whitespace characters from STRING.
  111.      *Note Functions for String Substitution and Analysis: Text
  112.      Functions.
  113.  
  114. `$(findstring FIND,TEXT)'
  115.      Locate FIND in TEXT.
  116.      *Note Functions for String Substitution and Analysis: Text
  117.      Functions.
  118.  
  119. `$(filter PATTERN...,TEXT)'
  120.      Select words in TEXT that match one of the PATTERN words.
  121.      *Note Functions for String Substitution and Analysis: Text
  122.      Functions.
  123.  
  124. `$(filter-out PATTERN...,TEXT)'
  125.      Select words in TEXT that *do not* match any of the PATTERN words.
  126.      *Note Functions for String Substitution and Analysis: Text
  127.      Functions.
  128.  
  129. `$(sort LIST)'
  130.      Sort the words in LIST lexicographically, removing duplicates.
  131.      *Note Functions for String Substitution and Analysis: Text
  132.      Functions.
  133.  
  134. `$(dir NAMES...)'
  135.      Extract the directory part of each file name.
  136.      *Note Functions for File Names: Filename Functions.
  137.  
  138. `$(notdir NAMES...)'
  139.      Extract the non-directory part of each file name.
  140.      *Note Functions for File Names: Filename Functions.
  141.  
  142. `$(suffix NAMES...)'
  143.      Extract the suffix (the last `.' and following characters) of each
  144.      file name.
  145.      *Note Functions for File Names: Filename Functions.
  146.  
  147. `$(basename NAMES...)'
  148.      Extract the base name (name without suffix) of each file name.
  149.      *Note Functions for File Names: Filename Functions.
  150.  
  151. `$(addsuffix SUFFIX,NAMES...)'
  152.      Append SUFFIX to each word in NAMES.
  153.      *Note Functions for File Names: Filename Functions.
  154.  
  155. `$(addprefix PREFIX,NAMES...)'
  156.      Prepend PREFIX to each word in NAMES.
  157.      *Note Functions for File Names: Filename Functions.
  158.  
  159. `$(join LIST1,LIST2)'
  160.      Join two parallel lists of words.
  161.      *Note Functions for File Names: Filename Functions.
  162.  
  163. `$(word N,TEXT)'
  164.      Extract the Nth word (one-origin) of TEXT.
  165.      *Note Functions for File Names: Filename Functions.
  166.  
  167. `$(words TEXT)'
  168.      Count the number of words in TEXT.
  169.      *Note Functions for File Names: Filename Functions.
  170.  
  171. `$(firstword NAMES...)'
  172.      Extract the first word of NAMES.
  173.      *Note Functions for File Names: Filename Functions.
  174.  
  175. `$(wildcard PATTERN...)'
  176.      Find file names matching a shell file name pattern (*not* a `%'
  177.      pattern).
  178.      *Note The Function `wildcard': Wildcard Function.
  179.  
  180. `$(shell COMMAND)'
  181.      Execute a shell command and return its output.
  182.      *Note The `shell' Function: Shell Function.
  183.  
  184. `$(origin VARIABLE)'
  185.      Return a string describing how the `make' variable VARIABLE was
  186.      defined.
  187.      *Note The `origin' Function: Origin Function.
  188.  
  189. `$(foreach VAR,WORDS,TEXT)'
  190.      Evaluate TEXT with VAR bound to each word in WORDS, and
  191.      concatenate the results.
  192.      *Note The `foreach' Function: Foreach Function.
  193.  
  194.    Here is a summary of the automatic variables.  *Note Automatic
  195. Variables: Automatic, for full information.
  196.  
  197. `$@'
  198.      The file name of the target.
  199.  
  200. `$%'
  201.      The target member name, when the target is an archive member.
  202.  
  203. `$<'
  204.      The name of the first dependency.
  205.  
  206. `$?'
  207.      The names of all the dependencies that are newer than the target,
  208.      with spaces between them.  For dependencies which are archive
  209.      members, only the member named is used (*note Archives::.).
  210.  
  211. `$^'
  212.      The names of all the dependencies, with spaces between them.  For
  213.      dependencies which are archive members, only the member named is
  214.      used (*note Archives::.).
  215.  
  216. `$*'
  217.      The stem with which an implicit rule matches (*note How Patterns
  218.      Match: Pattern Match.).
  219.  
  220. `$(@D)'
  221. `$(@F)'
  222.      The directory part and the file-within-directory part of `$@'.
  223.  
  224. `$(*D)'
  225. `$(*F)'
  226.      The directory part and the file-within-directory part of `$*'.
  227.  
  228. `$(%D)'
  229. `$(%F)'
  230.      The directory part and the file-within-directory part of `$%'.
  231.  
  232. `$(<D)'
  233. `$(<F)'
  234.      The directory part and the file-within-directory part of `$<'.
  235.  
  236. `$(^D)'
  237. `$(^F)'
  238.      The directory part and the file-within-directory part of `$^'.
  239.  
  240. `$(?D)'
  241. `$(?F)'
  242.      The directory part and the file-within-directory part of `$?'.
  243.  
  244.    These variables are used specially by GNU `make':
  245.  
  246. `MAKEFILES'
  247.      Makefiles to be read on every invocation of `make'.
  248.      *Note The Variable `MAKEFILES': MAKEFILES Variable.
  249.  
  250. `VPATH'
  251.      Directory search path for files not found in the current directory.
  252.      *Note `VPATH' Search Path for All Dependencies: General Search.
  253.  
  254. `SHELL'
  255.      The name of the system default command interpreter, usually
  256.      `/bin/sh'.  You can set `SHELL' in the makefile to change the
  257.      shell used to run commands.  *Note Command Execution: Execution.
  258.  
  259. `MAKE'
  260.      The name with which `make' was invoked.  Using this variable in
  261.      commands has special meaning.  *Note How the `MAKE' Variable
  262.      Works: MAKE Variable.
  263.  
  264. `MAKELEVEL'
  265.      The number of levels of recursion (sub-`make's).
  266.      *Note Variables/Recursion::.
  267.  
  268. `MAKEFLAGS'
  269. `MFLAGS'
  270.      The flags given to `make'.  You can set this in the environment or
  271.      a makefile to set flags.
  272.      *Note Communicating Options to a Sub-`make': Options/Recursion.
  273.  
  274. `SUFFIXES'
  275.      The default list of suffixes before `make' reads any makefiles.
  276.  
  277. 
  278. File: make.info,  Node: Complex Makefile,  Next: Concept Index,  Prev: Quick Reference,  Up: Top
  279.  
  280. Complex Makefile Example
  281. ************************
  282.  
  283.    Here is the makefile for the GNU `tar' program.  This is a
  284. moderately complex makefile.
  285.  
  286.    Because it is the first target, the default goal is `all'.  An
  287. interesting feature of this makefile is that `testpad.h' is a source
  288. file automatically created by the `testpad' program, itself compiled
  289. from `testpad.c'.
  290.  
  291.    If you type `make' or `make all', then `make' creates the `tar'
  292. executable, the `rmt' daemon that provides remote tape access, and the
  293. `tar.info' Info file.
  294.  
  295.    If you type `make install', then `make' not only creates `tar',
  296. `rmt', and `tar.info', but also installs them.
  297.  
  298.    If you type `make clean', then `make' removes the `.o' files, and
  299. the `tar', `rmt', `testpad', `testpad.h', and `core' files.
  300.  
  301.    If you type `make distclean', then `make' not only removes the same
  302. files as does `make clean' but also the `TAGS', `Makefile', and
  303. `config.status' files.  (Although it is not evident, this makefile (and
  304. `config.status') is generated by the user with the `configure' program,
  305. which is provided in the `tar' distribution, but is not shown here.)
  306.  
  307.    If you type `make realclean', then `make' removes the same files as
  308. does `make distclean' and also removes the Info files generated from
  309. `tar.texinfo'.
  310.  
  311.    In addition, there are targets `shar' and `dist' that create
  312. distribution kits.
  313.  
  314.      # Generated automatically from Makefile.in by configure.
  315.      # Un*x Makefile for GNU tar program.
  316.      # Copyright (C) 1991 Free Software Foundation, Inc.
  317.      
  318.      # This program is free software; you can redistribute
  319.      # it and/or modify it under the terms of the GNU
  320.      # General Public License ...
  321.      ...
  322.      ...
  323.      
  324.      SHELL = /bin/sh
  325.      
  326.      #### Start of system configuration section. ####
  327.      
  328.      srcdir = .
  329.      
  330.      # If you use gcc, you should either run the
  331.      # fixincludes script that comes with it or else use
  332.      # gcc with the -traditional option.  Otherwise ioctl
  333.      # calls will be compiled incorrectly on some systems.
  334.      CC = gcc -O
  335.      YACC = bison -y
  336.      INSTALL = /usr/local/bin/install -c
  337.      INSTALLDATA = /usr/local/bin/install -c -m 644
  338.      
  339.      # Things you might add to DEFS:
  340.      # -DSTDC_HEADERS        If you have ANSI C headers and
  341.      #                       libraries.
  342.      # -DPOSIX               If you have POSIX.1 headers and
  343.      #                       libraries.
  344.      # -DBSD42               If you have sys/dir.h (unless
  345.      #                       you use -DPOSIX), sys/file.h,
  346.      #                       and st_blocks in `struct stat'.
  347.      # -DUSG                 If you have System V/ANSI C
  348.      #                       string and memory functions
  349.      #                       and headers, sys/sysmacros.h,
  350.      #                       fcntl.h, getcwd, no valloc,
  351.      #                       and ndir.h (unless
  352.      #                       you use -DDIRENT).
  353.      # -DNO_MEMORY_H         If USG or STDC_HEADERS but do not
  354.      #                       include memory.h.
  355.      # -DDIRENT              If USG and you have dirent.h
  356.      #                       instead of ndir.h.
  357.      # -DSIGTYPE=int         If your signal handlers
  358.      #                       return int, not void.
  359.      # -DNO_MTIO             If you lack sys/mtio.h
  360.      #                       (magtape ioctls).
  361.      # -DNO_REMOTE           If you do not have a remote shell
  362.      #                       or rexec.
  363.      # -DUSE_REXEC           To use rexec for remote tape
  364.      #                       operations instead of
  365.      #                       forking rsh or remsh.
  366.      # -DVPRINTF_MISSING     If you lack vprintf function
  367.      #                       (but have _doprnt).
  368.      # -DDOPRNT_MISSING      If you lack _doprnt function.
  369.      #                       Also need to define
  370.      #                       -DVPRINTF_MISSING.
  371.      # -DFTIME_MISSING       If you lack ftime system call.
  372.      # -DSTRSTR_MISSING      If you lack strstr function.
  373.      # -DVALLOC_MISSING      If you lack valloc function.
  374.      # -DMKDIR_MISSING       If you lack mkdir and
  375.      #                       rmdir system calls.
  376.      # -DRENAME_MISSING      If you lack rename system call.
  377.      # -DFTRUNCATE_MISSING   If you lack ftruncate
  378.      #                       system call.
  379.      # -DV7                  On Version 7 Unix (not
  380.      #                       tested in a long time).
  381.      # -DEMUL_OPEN3          If you lack a 3-argument version
  382.      #                       of open, and want to emulate it
  383.      #                       with system calls you do have.
  384.      # -DNO_OPEN3            If you lack the 3-argument open
  385.      #                       and want to disable the tar -k
  386.      #                       option instead of emulating open.
  387.      # -DXENIX               If you have sys/inode.h
  388.      #                       and need it 94 to be included.
  389.      
  390.      DEFS =  -DSIGTYPE=int -DDIRENT -DSTRSTR_MISSING \
  391.              -DVPRINTF_MISSING -DBSD42
  392.      # Set this to rtapelib.o unless you defined NO_REMOTE,
  393.      # in which case make it empty.
  394.      RTAPELIB = rtapelib.o
  395.      LIBS =
  396.      DEF_AR_FILE = /dev/rmt8
  397.      DEFBLOCKING = 20
  398.      
  399.      CDEBUG = -g
  400.      CFLAGS = $(CDEBUG) -I. -I$(srcdir) $(DEFS) \
  401.              -DDEF_AR_FILE=\"$(DEF_AR_FILE)\" \
  402.              -DDEFBLOCKING=$(DEFBLOCKING)
  403.      LDFLAGS = -g
  404.      
  405.      prefix = /usr/local
  406.      # Prefix for each installed program,
  407.      # normally empty or `g'.
  408.      binprefix =
  409.      
  410.      # The directory to install tar in.
  411.      bindir = $(prefix)/bin
  412.      
  413.      # The directory to install the info files in.
  414.      infodir = $(prefix)/info
  415.      
  416.      #### End of system configuration section. ####
  417.      
  418.      SRC1 =  tar.c create.c extract.c buffer.c \
  419.              getoldopt.c update.c gnu.c mangle.c
  420.      SRC2 =  version.c list.c names.c diffarch.c \
  421.              port.c wildmat.c getopt.c
  422.      SRC3 =  getopt1.c regex.c getdate.y
  423.      SRCS =  $(SRC1) $(SRC2) $(SRC3)
  424.      OBJ1 =  tar.o create.o extract.o buffer.o \
  425.              getoldopt.o update.o gnu.o mangle.o
  426.      OBJ2 =  version.o list.o names.o diffarch.o \
  427.              port.o wildmat.o getopt.o
  428.      OBJ3 =  getopt1.o regex.o getdate.o $(RTAPELIB)
  429.      OBJS =  $(OBJ1) $(OBJ2) $(OBJ3)
  430.      AUX =   README COPYING ChangeLog Makefile.in  \
  431.              makefile.pc configure configure.in \
  432.              tar.texinfo tar.info* texinfo.tex \
  433.              tar.h port.h open3.h getopt.h regex.h \
  434.              rmt.h rmt.c rtapelib.c alloca.c \
  435.              msd_dir.h msd_dir.c tcexparg.c \
  436.              level-0 level-1 backup-specs testpad.c
  437.      
  438.      all:    tar rmt tar.info
  439.      
  440.      tar:    $(OBJS)
  441.              $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
  442.      
  443.      rmt:    rmt.c
  444.              $(CC) $(CFLAGS) $(LDFLAGS) -o $@ rmt.c
  445.      
  446.      tar.info: tar.texinfo
  447.              makeinfo tar.texinfo
  448.      
  449.      install: all
  450.              $(INSTALL) tar $(bindir)/$(binprefix)tar
  451.              -test ! -f rmt || $(INSTALL) rmt /etc/rmt
  452.              $(INSTALLDATA) $(srcdir)/tar.info* $(infodir)
  453.      
  454.      $(OBJS): tar.h port.h testpad.h
  455.      regex.o buffer.o tar.o: regex.h
  456.      # getdate.y has 8 shift/reduce conflicts.
  457.      
  458.      testpad.h: testpad
  459.              ./testpad
  460.      
  461.      testpad: testpad.o
  462.              $(CC) -o $@ testpad.o
  463.      
  464.      TAGS:   $(SRCS)
  465.              etags $(SRCS)
  466.      
  467.      clean:
  468.              rm -f *.o tar rmt testpad testpad.h core
  469.      
  470.      distclean: clean
  471.              rm -f TAGS Makefile config.status
  472.      
  473.      realclean: distclean
  474.              rm -f tar.info*
  475.      
  476.      shar: $(SRCS) $(AUX)
  477.              shar $(SRCS) $(AUX) | compress \
  478.                > tar-`sed -e '/version_string/!d' \
  479.                           -e 's/[^0-9.]*\([0-9.]*\).*/\1/' \
  480.                           -e q
  481.                           version.c`.shar.Z
  482.      
  483.      dist: $(SRCS) $(AUX)
  484.              echo tar-`sed \
  485.                   -e '/version_string/!d' \
  486.                   -e 's/[^0-9.]*\([0-9.]*\).*/\1/' \
  487.                   -e q
  488.                   version.c` > .fname
  489.              -rm -rf `cat .fname`
  490.              mkdir `cat .fname`
  491.              ln $(SRCS) $(AUX) `cat .fname`
  492.              -rm -rf `cat .fname` .fname
  493.              tar chZf `cat .fname`.tar.Z `cat .fname`
  494.      
  495.      tar.zoo: $(SRCS) $(AUX)
  496.              -rm -rf tmp.dir
  497.              -mkdir tmp.dir
  498.              -rm tar.zoo
  499.              for X in $(SRCS) $(AUX) ; do \
  500.                  echo $$X ; \
  501.                  sed 's/$$/^M/' $$X \
  502.                  > tmp.dir/$$X ; done
  503.              cd tmp.dir ; zoo aM ../tar.zoo *
  504.              -rm -rf tmp.dir
  505.  
  506.