Roland Ver. 4.5 Technical Information

Browse online or download Technical Information for Print & Scan Roland Ver. 4.5. Roland Ver. 4.5 Technical information User Manual

  • Download
  • Add to my manuals
  • Print
  • Page
    / 212
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews

Summary of Contents

Page 2

vi GNU make11 Using make to Update Archive Files . . . . . . . 12911.1 Archive Members as Targets . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 3

90 GNU make$(and condition1[,condition2[,condition3...]])The and function provides a “short-circuiting” AND operation. Each argumentis expanded, in or

Page 4

Chapter 8: Functions for Transforming Text 91undefined before the foreach function call, it is undefined after the call. See Section 6.2[The Two Flavors

Page 5 - Short Contents

92 GNU make8.7 The call FunctionThe call function is unique in that it can be used to create new parameterized functions.You can write a complex expre

Page 6

Chapter 8: Functions for Transforming Text 938.8 The value FunctionThe value function provides a way for you to use the value of a variable without ha

Page 7 - Table of Contents

94 GNU makePROGRAMS = server clientserver_OBJS = server.o server_priv.o server_access.oserver_LIBS = priv protocolclient_OBJS = client.o client_api.o

Page 8

Chapter 8: Functions for Transforming Text 95‘environment’if variable was inherited from the environment provided to make.‘environment override’if var

Page 9

96 GNU makeThe syntax of the flavor function is:$(flavor variable)Note that variable is the name of a variable to inquire about, not a reference to th

Page 10

Chapter 8: Functions for Transforming Text 978.13 The shell FunctionThe shell function is unlike any other function other than the wildcard function (

Page 12

Chapter 9: How to Run make 999 How to Run makeA makefile that says how to recompile a program can be used in more than one way. Thesimplest use is to r

Page 13 - 2 An Introduction to Makefiles

Chapter 1: Overview of make 11 Overview of makeThe make utility automatically determines which pieces of a large program need to berecompiled, and iss

Page 14 - 2.2 A Simple Makefile

100 GNU maketargets not in the makefile may be specified, if make can find implicit rules that say how tomake them.Make will set the special variable MAK

Page 15

Chapter 9: How to Run make 101install Copy the executable file into a directory that users typically search for com-mands; copy any auxiliary files that

Page 16

102 GNU makemodification times remain the same. You can use the ‘-W’ flag in conjunctionwith the ‘-n’ flag to see what would happen if you were to modify

Page 17

Chapter 9: How to Run make 1033. Use the command ‘make -t ’ to mark all the object files as up to date. The next timeyou run make, the changes in the h

Page 18 - 2.6 Another Style of Makefile

104 GNU make9.6 Testing the Compilation of a ProgramNormally, when an error happens in executing a shell command, make gives up immediately,returning

Page 19

Chapter 9: How to Run make 105are being compared and with what results, which files actually need to beremade, which implicit rules are considered and

Page 20

106 GNU make‘-h’‘--help’Remind you of the options that make understands and then exit.‘-i’‘--ignore-errors’Ignore all errors in recipes executed to re

Page 21 - 3 Writing Makefiles

Chapter 9: How to Run make 107Print the recipe that would be executed, but do not execute it (except in certaincircumstances). See Section 9.3 [Instea

Page 22 - 3.1.1 Splitting Long Lines

108 GNU make(see Section 10.3 [Variables Used by Implicit Rules], page 115); see the ‘-R’option below.‘-R’‘--no-builtin-variables’Eliminate use of the

Page 23 - 3.3 Including Other Makefiles

Chapter 9: How to Run make 109‘--no-print-directory’Disable printing of the working directory under -w. This option is useful when-w is turned on auto

Page 24 - 3.5 How Makefiles Are Remade

2 GNU makeBefore reporting a bug or trying to fix it yourself, try to isolate it to the smallest possiblemakefile that reproduces the problem. Then send

Page 26 - 3.7 How make Reads a Makefile

Chapter 10: Using Implicit Rules 11110 Using Implicit RulesCertain standard ways of remaking target files are used very often. For example, onecustomar

Page 27 - Rule Definition

112 GNU makefiles are supposed to exist. See Section 10.2 [Catalogue of Built-In Rules], page 112, for acatalogue of all the predefined implicit rules.A

Page 28 - 3.8 Secondary Expansion

Chapter 10: Using Implicit Rules 113Compiling C++ programsn.o is made automatically from n.cc, n.cpp, or n.C with a recipe of the form‘$(CXX) $(CPPFLA

Page 29

114 GNU makecc -c x.c -o x.occ -c y.c -o y.occ -c z.c -o z.occ x.o y.o z.o -o xrm -f x.orm -f y.orm -f z.oIn more complicated cases, such as when ther

Page 30

Chapter 10: Using Implicit Rules 115Texinfo and Infon.dvi is made from n.texinfo, n.texi, or n.txinfo, with the recipe‘$(TEXI2DVI) $(TEXI2DVI_FLAGS)’.

Page 31 - 4 Writing Rules

116 GNU makeFor example, the recipe used to compile a C source file actually says ‘$(CC) -c $(CFLAGS)$(CPPFLAGS)’. The default values of the variables

Page 32 - 4.2 Types of Prerequisites

Chapter 10: Using Implicit Rules 117TANGLE Program to translate Web into Pascal; default ‘tangle’.CTANGLE Program to translate C Web into C; default ‘

Page 33 - 4.3.1 Wildcard Examples

118 GNU makeOnce make has decided to use the intermediate file, it is entered in the data base as if it hadbeen mentioned in the makefile, along with th

Page 34 - 4.3.3 The Function wildcard

Chapter 10: Using Implicit Rules 119Thus, a pattern rule ‘%.o : %.c’ says how to make any file stem.o from another filestem.c.Note that expansion using

Page 35

Chapter 2: An Introduction to Makefiles 32 An Introduction to MakefilesYou need a file called a makefile to tell make what to do. Most often, the makefile

Page 36 - 4.4.2 The vpath Directive

120 GNU makedefines a rule that can make any file x.o from x.c. The recipe uses the automatic variables‘$@’ and ‘$<’ to substitute the names of the t

Page 37

Chapter 10: Using Implicit Rules 121$% The target member name, when the target is an archive member. SeeChapter 11 [Archives], page 129. For example,

Page 38

122 GNU makeOf the variables listed above, four have values that are single file names, and three havevalues that are lists of file names. These seven h

Page 39 - 4.5 Phony Targets

Chapter 10: Using Implicit Rules 123‘test’. The pattern rule prerequisites are turned into actual file names by substituting thestem for the character

Page 40

124 GNU makeSuppose the makefile mentions foo.c. For this target, make would have to considermaking it by linking an object file foo.c.o, or by C compil

Page 41

Chapter 10: Using Implicit Rules 125new rule is defined, the built-in one is replaced. The new rule’s position in the sequence ofimplicit rules is dete

Page 42

126 GNU makeA single-suffix rule is defined by a single suffix, which is the source suffix. It matchesany file name, and the corresponding implicit prerequisi

Page 43

Chapter 10: Using Implicit Rules 12710.8 Implicit Rule Search AlgorithmHere is the procedure make uses for searching for an implicit rule for a target

Page 44

128 GNU makeis executed, each of these stored file names are entered into the data base and marked ashaving been updated and having the same update sta

Page 45

Chapter 11: Using make to Update Archive Files 12911 Using make to Update Archive FilesArchive files are files containing named sub-files called members;

Page 46 - 4.11 Static Pattern Rules

4 GNU make2.2 A Simple MakefileHere is a straightforward makefile that describes the way an executable file called editdepends on eight object files which

Page 47

130 GNU makecc -c bar.c -o bar.oar r foo.a bar.orm -f bar.oHere make has envisioned the file bar.o as an intermediate file. See Section 10.4 [Chains ofI

Page 48 - 4.12 Double-Colon Rules

Chapter 11: Using make to Update Archive Files 131(see Section 11.2 [Archive Update], page 129). But they are retained for compatibility withother mak

Page 50

Chapter 12: Extending GNU make 13312 Extending GNU makeGNU make provides many advanced capabilities, including many useful functions. However,it does

Page 51 - 5 Writing Recipes in Rules

134 GNU makecharacterA printable character is converted to the same character.string A string containing only printable characters is converted to the

Page 52

Chapter 12: Extending GNU make 135define GUILEIO;; A simple Guile IO library for GNU make(define MKPORT #f)(define (mkopen name mode)(set! MKPORT (ope

Page 53 - 5.2 Recipe Echoing

136 GNU make Warning: The load directive and extension capability is considered a “technologypreview” in this release of GNU make. We encourage you

Page 54 - 5.3 Recipe Execution

Chapter 12: Extending GNU make 137Regardless of how many times an object file appears in a load directive, it will only beloaded (and its setup functio

Page 55 - 5.3.2 Choosing the Shell

138 GNU makeData Structuresgmk_floc This structure represents a filename/location pair. It is provided when definingitems, so GNU make can inform the us

Page 56

Chapter 12: Extending GNU make 139gmk_expandThis function takes a string and expands it using make expansion rules. Theresult of the expansion is retu

Page 57 - 5.4 Parallel Execution

Chapter 2: An Introduction to Makefiles 5A recipe may follow each line that contains a target and prerequisites. These recipes sayhow to update the tar

Page 58

140 GNU make#include <stdlib.h>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <unistd.h>#include <e

Page 59 - 5.5 Errors in Recipes

Chapter 12: Extending GNU make 141all:@echo Temporary file: $(mk-temp tmpfile.)load mk_temp.somk_temp.so: mk_temp.c$(CC) -shared -fPIC -o $ $<On MS

Page 61

Chapter 13: Features of GNU make 14313 Features of GNU makeHere is a summary of the features of GNU make, for comparison with and credit to otherversi

Page 62

144 GNU make• The automatic variable $^ containing a list of all prerequisites of the current target.We did not invent this, but we have no idea who d

Page 63

Chapter 13: Features of GNU make 145• Declare phony targets with the special target .PHONY.Andrew Hume of AT&T Bell Labs implemented a similar fea

Page 65

Chapter 14: Incompatibilities and Missing Features 14714 Incompatibilities and Missing FeaturesThe make programs in various other systems support a fe

Page 66 - 5.8 Defining Canned Recipes

148 GNU makeWe feel that it is cleaner for a rule without a recipe to always simply add to theprerequisite list for the target. The above example can

Page 67 - 5.9 Using Empty Recipes

Chapter 15: Makefile Conventions 14915 Makefile ConventionsThis chapter describes conventions for writing the Makefiles for GNU programs. Using Au-tomake

Page 68

6 GNU makeThus, if we change the file insert.c and run make, make will compile that file to updateinsert.o, and then link edit. If we change the file com

Page 69 - 6 How to Use Variables

150 GNU makeappear in the source directory, they should always appear in the source directory, not inthe build directory. So Makefile rules to update t

Page 70

Chapter 15: Makefile Conventions 15115.3 Variables for Specifying CommandsMakefiles should provide variables for overriding certain commands, options, a

Page 71

152 GNU make15.4 DESTDIR: Support for Staged InstallsDESTDIR is a variable prepended to each installed target file, like this:$(INSTALL_PROGRAM) foo $(

Page 72 - 6.3.1 Substitution References

Chapter 15: Makefile Conventions 153prefix A prefix used in constructing the default values of the variables listed below.The default value of prefix sh

Page 73 - 6.3.2 Computed Variable Names

154 GNU makeHere are the variables Makefiles should use to specify directories to put these variouskinds of files in:‘datarootdir’The root of the direct

Page 74

Chapter 15: Makefile Conventions 155the next reboot. PID files for system daemons are a typical use. In addition,this directory should not be cleaned ex

Page 75 - 6.5 Setting Variables

156 GNU make‘htmldir’‘dvidir’‘pdfdir’‘psdir’ Directories for installing documentation files in the particular format. Theyshould all be set to $(docdir

Page 76

Chapter 15: Makefile Conventions 157‘srcdir’ The directory for the sources being compiled. The value of this variable isnormally inserted by the config

Page 77

158 GNU makeIf possible, write the install target rule so that it does not modify anything inthe directory where the program was built, provided ‘make

Page 78 - 6.7 The override Directive

Chapter 15: Makefile Conventions 159When you have many documentation files to install, we recommend that youavoid collisions and clutter by arranging fo

Page 79 - 6.9 Undefining Variables

Chapter 2: An Introduction to Makefiles 7objects = main.o kbd.o command.o display.o \insert.o search.o files.o utils.oedit : $(objects)cc -o edit $(obj

Page 80

160 GNU make‘mostlyclean’Like ‘clean’, but may refrain from deleting a few files that people normallydon’t want to recompile. For example, the ‘mostlyc

Page 81

Chapter 15: Makefile Conventions 161generated. These targets should not be dependencies of the all target; theuser must manually invoke them.Here’s an

Page 82 - 6.13 Suppressing Inheritance

162 GNU makeinstalldirsIt’s useful to add a target named ‘installdirs’ to create the directorieswhere files are installed, and their parent directories

Page 83 - 6.14 Other Special Variables

Chapter 15: Makefile Conventions 163$(PRE_INSTALL) # Pre-install commands follow.$(POST_INSTALL) # Post-install commands follow.$(NORMAL_INSTALL) # Nor

Page 85

Appendix A: Quick Reference 165Appendix A Quick ReferenceThis appendix summarizes the directives, text manipulation functions, and special variableswh

Page 86

166 GNU makeexport variableexport variable-assignmentunexport variableTell make whether or not to export a particular variable to child processes.See

Page 87 - 7.1 Example of a Conditional

Appendix A: Quick Reference 167$(wordlist s,e,text)Returns the list of words in text from s to e.See Section 8.2 [Functions for String Substitution an

Page 88 - 7.2 Syntax of Conditionals

168 GNU make$(error text...)When this function is evaluated, make generates a fatal error with the messagetext.See Section 8.12 [Functions That Contro

Page 89

Appendix A: Quick Reference 169$(file op filename,text)Expand the arguments, then open the file filename using mode op and writetext to that file.See Sec

Page 90

8 GNU makeobjects = main.o kbd.o command.o display.o \insert.o search.o files.o utils.oedit : $(objects)cc -o edit $(objects)main.o : defs.hkbd.o : de

Page 91

170 GNU makeMAKEFILESMakefiles to be read on every invocation of make.See Section 3.4 [The Variable MAKEFILES], page 14.VPATHDirectory search path for

Page 92

Appendix A: Quick Reference 171MAKECMDGOALSThe targets given to make on the command line. Setting this variable has noeffect on the operation of make.S

Page 94

Appendix B: Errors Generated by Make 173Appendix B Errors Generated by MakeHere is a list of the more common errors you might see generated by make, a

Page 95

174 GNU make‘No rule to make target ‘xxx’.’‘No rule to make target ‘xxx’, needed by ‘yyy’.’This means that make decided it needed to build a target, b

Page 96

Appendix B: Errors Generated by Make 175‘missing target pattern. Stop.’‘multiple target patterns. Stop.’‘target pattern contains no ‘%’. Stop.’‘mixed

Page 98

Appendix C: Complex Makefile Example 177Appendix C Complex Makefile ExampleHere is the makefile for the GNU tar program. This is a moderately complex mak

Page 99

178 GNU make# Things you might add to DEFS:# -DSTDC_HEADERS If you have ANSI C headers and# libraries.# -DPOSIX If you have POSIX.1 headers and# libra

Page 100 - 8.5 The foreach Function

Appendix C: Complex Makefile Example 179# and want to disable the tar -k# option instead of emulating open.# -DXENIX If you have sys/inode.h# and need

Page 101 - 8.6 The file Function

Chapter 2: An Introduction to Makefiles 92.7 Rules for Cleaning the DirectoryCompiling a program is not the only thing you might want to write rules fo

Page 102 - 8.7 The call Function

180 GNU makeAUX = README COPYING ChangeLog Makefile.in \makefile.pc configure configure.in \tar.texinfo tar.info* texinfo.tex \tar.h port.h open3.h ge

Page 103 - 8.9 The eval Function

Appendix C: Complex Makefile Example 181.PHONY: realcleanrealclean: distcleanrm -f tar.info*.PHONY: sharshar: $(SRCS) $(AUX)shar $(SRCS) $(AUX) | compr

Page 104 - 8.10 The origin Function

182 GNU maketo copy and redistribute it, with or without modifying it, either commercially or non-commercially. Secondarily, this License preserves fo

Page 105 - 8.11 The flavor Function

Appendix C: Complex Makefile Example 183editor, and that is suitable for input to text formatters or for automatic translation toa variety of formats s

Page 106

184 GNU makeIf you publish printed copies (or copies in media that commonly have printed covers) ofthe Document, numbering more than 100, and the Docu

Page 107 - 8.13 The shell Function

Appendix C: Complex Makefile Example 185F. Include, immediately after the copyright notices, a license notice giving the publicpermission to use the Mo

Page 108

186 GNU makeyou may replace the old one, on explicit permission from the previous publisher thatadded the old one.The author(s) and publisher(s) of th

Page 109 - 9 How to Run make

Appendix C: Complex Makefile Example 1878. TRANSLATIONTranslation is considered a kind of modification, so you may distribute translationsof the Documen

Page 110

188 GNU makeversions of this License can be used, that proxy’s public statement of acceptance of aversion permanently authorizes you to choose that ve

Page 111

Appendix C: Complex Makefile Example 189ADDENDUM: How to use this License for your documentsTo use this License in a document you have written, include

Page 115

Index of Concepts 191Index of Concepts!!= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65!=, expansion. .

Page 116

192 GNU make-I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13, 106-j . . . . . . . . . . . . . . . . . . . . . . .

Page 117

Index of Concepts 193archive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129archive member targets . . . . . . . . .

Page 118

194 GNU makeexecution, of recipes . . . . . . . . . . . . . . . . . . . . . . . . . . . 44exit status (errors). . . . . . . . . . . . . . . . . . . .

Page 119

Index of Concepts 195Llast-resort default rules . . . . . . . . . . . . . . . . . . . . . . . 125ld. . . . . . . . . . . . . . . . . . . . . . . . . .

Page 120

196 GNU makeportability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143POSIX. . . . . . . . . . . . . . . . . . . . . . . .

Page 121 - 10 Using Implicit Rules

Index of Concepts 197rule, implicit, definition of . . . . . . . . . . . . . . . . . . . . . 11rule, implicit, how to use . . . . . . . . . . . . . . .

Page 122

198 GNU maketargets, phony . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29terminal rule . . . . . . . . . . . . . . . . . . . . .

Page 123

Index of Functions, Variables, & Directives 199Index of Functions, Variables, & Directives$$%. . . . . . . . . . . . . . . . . . . . . . . . .

Page 124

Chapter 3: Writing Makefiles 113 Writing MakefilesThe information that tells make how to recompile a system comes from reading a data basecalled the mak

Page 125

200 GNU make|| (automatic variable) . . . . . . . . . . . . . . . . . . . . . . . . 121Aabspath . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 126

Index of Functions, Variables, & Directives 201MAKECMDGOALS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100makefile . . . . .

Page 128

12 GNU make3.1.1 Splitting Long LinesMakefiles use a “line-based” syntax in which the newline character is special and marks theend of a statement. GNU

Page 129 - 10.5.2 Pattern Rule Examples

Chapter 3: Writing Makefiles 133.3 Including Other MakefilesThe include directive tells make to suspend reading the current makefile and read one ormore

Page 130 - 10.5.3 Automatic Variables

14 GNU makeOnly after it has tried to find a way to remake a makefile and failed, will make diagnose themissing makefile as a fatal error.If you want mak

Page 131

Chapter 3: Writing Makefiles 15you can write an explicit rule with the makefile as the target, and an empty recipe (seeSection 5.9 [Using Empty Recipes]

Page 132 - 10.5.4 How Patterns Match

16 GNU makethe information in the containing makefile, make should look in another makefile. SeeSection 10.5 [Pattern Rules], page 118, for more informa

Page 133

Chapter 3: Writing Makefiles 17immediate != immediatedefine immediatedeferredendefdefine immediate =deferredendefdefine immediate ?=deferredendefdefine

Page 134

18 GNU makeThat is, the target and prerequisite sections are expanded immediately, and the recipeused to construct the target is always deferred. This

Page 135 - 10.7 Old-Fashioned Suffix Rules

Chapter 3: Writing Makefiles 19$*, etc. during the second expansion and they will have their expected values, just as inthe recipe. All you have to do

Page 136

GNU MakeA Program for Directing RecompilationGNU make Version 4.1September 2014Richard M. Stallman, Roland McGrath, Paul D. Smith

Page 137

20 GNU maketively. In the third they will have values foo.1, foo.1 bar.1 foo.2 bar.2, and foo.1bar.1 foo.2 bar.2 foo.1 foo.1 bar.1 foo.1 bar.1 respect

Page 138

Chapter 4: Writing Rules 214 Writing RulesA rule appears in the makefile and says when and how to remake certain files, called therule’s targets (most o

Page 139

22 GNU makeThe criterion for being out of date is specified in terms of the prerequisites, whichconsist of file names separated by spaces. (Wildcards an

Page 140

Chapter 4: Writing Rules 23$(OBJS): | $(OBJDIR)$(OBJDIR):mkdir $(OBJDIR)Now the rule to create the objdir directory will be run, if needed, before any

Page 141

24 GNU makeyou use the value of objects in a recipe, the shell may perform wildcard expansion whenthe recipe runs. To set objects to the expansion, in

Page 142

Chapter 4: Writing Rules 25$(wildcard *.c)We can change the list of C source files into a list of object files by replacing the ‘.c’suffix with ‘.o’ in th

Page 143 - 12 Extending GNU make

26 GNU makefoo.o : src/foo.cassuming the file foo.c does not exist in the current directory but is found in the directorysrc.4.4.2 The vpath DirectiveS

Page 144

Chapter 4: Writing Rules 27vpath %.c foovpath % blishvpath %.c barwill look for a file ending in ‘.c’ in foo, then blish, then bar, whilevpath %.c foo:

Page 145 - 12.2 Loading Dynamic Objects

28 GNU makeThis is done with the automatic variables such as ‘$^’ (see Section 10.5.3 [AutomaticVariables], page 120). For instance, the value of ‘$^’

Page 146 - 12.2.1 The load Directive

Chapter 4: Writing Rules 29a pattern string. When a prerequisite like ‘-lname’ is seen, make will replace the percentin each pattern in the list with

Page 147 - Loaded Object Licensing

This file documents the GNU make utility, which determines automatically which pieces ofa large program need to be recompiled, and issues the commands

Page 148 - GNU make Facilities

30 GNU makeBy declaring the sub-directories as .PHONY targets (you must do this as the sub-directoryobviously always exists; otherwise it won’t be bui

Page 149 - 12.2.4 Example Loaded Object

Chapter 4: Writing Rules 31cleanall : cleanobj cleandiffrm programcleanobj :rm *.ocleandiff :rm *.diff4.6 Rules without Recipes or PrerequisitesIf a r

Page 150

32 GNU make4.8 Special Built-in Target NamesCertain names have special meanings if they appear as targets..PHONYThe prerequisites of the special targe

Page 151

Chapter 4: Writing Rules 33.DELETE_ON_ERRORIf .DELETE_ON_ERROR is mentioned as a target anywhere in the makefile, thenmake will delete the target of a

Page 152

34 GNU make.EXPORT_ALL_VARIABLESSimply by being mentioned as a target, this tells make to export all variablesto child processes by default. See Secti

Page 153 - 13 Features of GNU make

Chapter 4: Writing Rules 35bigoutput littleoutput : text.ggenerate text.g -$(subst output,,$@) > $@is equivalent tobigoutput : text.ggenerate text.

Page 154

36 GNU makeIf none of the explicit rules for a target has a recipe, then make searches for an applicableimplicit rule to find one see Chapter 10 [Using

Page 155

Chapter 4: Writing Rules 37objects = foo.o bar.oall: $(objects)$(objects): %.o: %.c$(CC) -c $(CFLAGS) $< -o $@Here ‘$<’ is the automatic variabl

Page 156

38 GNU make• If you cannot be sure of the precise contents of the directories you are using, you maynot be sure which other irrelevant files might lead

Page 157

Chapter 4: Writing Rules 39main.o : main.c defs.hThus you no longer have to write all those rules yourself. The compiler will do it for you.Note that

Page 158

iShort Contents1 Overview of make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 An Introduction to Makefiles . . . . . .

Page 159 - 15 Makefile Conventions

40 GNU makemakefiles like any others, make will remake them as necessary with no further work fromyou. See Section 3.5 [Remaking Makefiles], page 14.Not

Page 160 - 15.2 Utilities in Makefiles

Chapter 5: Writing Recipes in Rules 415 Writing Recipes in RulesThe recipe of a rule consists of one or more shell command lines to be executed, one a

Page 161 - ALL_CFLAGS = -I. $(CFLAGS)

42 GNU makecharacter of the next line after the backslash/newline is the recipe prefix character (a tabby default; see Section 6.14 [Special Variables]

Page 162

Chapter 5: Writing Recipes in Rules 43we will get output like this:hello worldIf you like, you can also use target-specific variables (see Section 6.11

Page 163

44 GNU makeThe ‘-s’ or ‘--silent’ flag to make prevents all echoing, as if all recipes started with‘@’. A rule in the makefile for the special target .S

Page 164

Chapter 5: Writing Recipes in Rules 45.ONESHELL:SHELL = /usr/bin/perl.SHELLFLAGS = -eshow :@f = qw(a b c);print "@f\n";However, either of th

Page 165

46 GNU makeUnlike most variables, the variable SHELL is never set from the environment. This isbecause the SHELL environment variable is used to speci

Page 166

Chapter 5: Writing Recipes in Rules 47The effect of the above DOS-specific processing is that a Makefile that contains ‘SHELL= /bin/sh’ (as many Unix mak

Page 167

48 GNU makecompleted. Additionally, if there are multiple recursive make invocations running in parallel,they will communicate so that only one of the

Page 168

Chapter 5: Writing Recipes in Rules 49modes). For example, many programs that can display colorized output will not do soif they determine they are no

Page 170

50 GNU makeeither directly or indirectly. No further recipes will be executed for these targets, since theirpreconditions have not been achieved.Norma

Page 171

Chapter 5: Writing Recipes in Rules 51system. For example, suppose you have a sub-directory subdir which has its own makefile,and you would like the co

Page 172

52 GNU makelines containing MAKE are executed normally despite the presence of a flag that causes mostrecipes not to be run. The usual MAKEFLAGS mechan

Page 173

Chapter 5: Writing Recipes in Rules 53variable := valueexport variableLikewise,export variable += valueis just like:variable += valueexport variableSe

Page 174

54 GNU make5.7.3 Communicating Options to a Sub-makeFlags such as ‘-s’ and ‘-k’ are passed automatically to the sub-make through the variableMAKEFLAGS

Page 175 - Appendix A Quick Reference

Chapter 5: Writing Recipes in Rules 55‘--warn-undefined-variables’). MFLAGS was traditionally used explicitly in the recursivemake command, like this:

Page 176

56 GNU makeNormally, you do not need to specify this option because ‘make’ does it for you: ‘-w’is turned on automatically when you use the ‘-C’ optio

Page 177

Chapter 5: Writing Recipes in Rules 57make will not echo the first line, the echo command. But it will echo the following tworecipe lines.On the other

Page 179

Chapter 6: How to Use Variables 596 How to Use VariablesA variable is a name defined in a makefile to represent a string of text, called the variable’sv

Page 180

iiiTable of Contents1 Overview of make . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1 How to Read This Manual . . . . . . . . .

Page 181

60 GNU makecould be used to compile a C program prog.c. Since spaces before the variable value areignored in variable assignments, the value of foo is

Page 182

Chapter 6: How to Use Variables 61Simply expanded variables are defined by lines using ‘:=’ or ‘::=’ (see Section 6.5 [SettingVariables], page 65). Bot

Page 183

62 GNU makeeffect (but be rather hard to read). If you put whitespace at the end of a variable value,it is a good idea to put a comment like that at th

Page 184

Chapter 6: How to Use Variables 63For example:foo := a.o b.o c.obar := $(foo:%.o=%.c)sets ‘bar’ to ‘a.c b.c c.c’.6.3.2 Computed Variable NamesComputed

Page 185

64 GNU makex = variable1variable2 := Helloy = $(subst 1,2,$(x))z = ya := $($($(z)))eventually defines a as ‘Hello’. It is doubtful that anyone would ev

Page 186

Chapter 6: How to Use Variables 65ifdef do_sortfunc := sortelsefunc := stripendifbar := a d b g q cfoo := $($(func) $(bar))attempts to give ‘foo’ the

Page 187

66 GNU makedefines a variable named objects. Whitespace around the variable name and immediatelyafter the ‘=’ is ignored.Variables defined with ‘=’ are

Page 188

Chapter 6: How to Use Variables 67This takes the value of the variable objects, and adds the text ‘another.o’ to it (precededby a single space). Thus:

Page 189

68 GNU makeThe first line defines the CFLAGS variable with a reference to another variable, includes.(CFLAGS is used by the rules for C compilation; see

Page 190

Chapter 6: How to Use Variables 696.8 Defining Multi-Line VariablesAnother way to set the value of a variable is to use the define directive. This dire

Page 191

iv GNU make4.9 Multiple Targets in a Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344.10 Multiple Rules for One Target

Page 192

70 GNU makenot. However, if you are using the flavor (see Section 8.11 [Flavor Function], page 95) andorigin (see Section 8.10 [Origin Function], page

Page 193

Chapter 6: How to Use Variables 716.11 Target-specific Variable ValuesVariable values in make are usually global; that is, they are the same regardless

Page 194

72 GNU makepattern ... : variable-assignmentwhere pattern is a %-pattern. As with target-specific variable values, multiple patternvalues create a patt

Page 195

Chapter 6: How to Use Variables 736.14 Other Special VariablesGNU make supports some variables that have special properties.MAKEFILE_LISTContains the

Page 196

74 GNU make# Query the default goal.ifeq ($(.DEFAULT_GOAL),)$(warning no default goal is set)endif.PHONY: foofoo: ; @echo $@$(warning default goal is

Page 197

Chapter 6: How to Use Variables 75.RECIPEPREFIXThe first character of the value of this variable is used as the character makeassumes is introducing a

Page 198

76 GNU make‘target-specific’Supports target-specific and pattern-specific variable assignments.See Section 6.11 [Target-specific Variable Values], page 7

Page 199

Chapter 7: Conditional Parts of Makefiles 777 Conditional Parts of MakefilesA conditional directive causes part of a makefile to be obeyed or ignored dep

Page 200

78 GNU makelibs_for_gcc = -lgnunormal_libs =ifeq ($(CC),gcc)libs=$(libs_for_gcc)elselibs=$(normal_libs)endiffoo: $(objects)$(CC) -o foo $(objects) $(l

Page 201 - Index of Concepts

Chapter 7: Conditional Parts of Makefiles 79ifeq (arg1, arg2)ifeq ’arg1’ ’arg2’ifeq "arg1" "arg2"ifeq "arg1" ’arg2’ifeq ’

Page 202 - 192 GNU make

v7 Conditional Parts of Makefiles . . . . . . . . . . . . . . . 777.1 Example of a Conditional . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Page 203 - Index of Concepts 193

80 GNU makereturn true for all definitions except those like foo =. To test for an emptyvalue, use ifeq ($(foo),). For example,bar =foo = $(bar)ifdef f

Page 204 - 194 GNU make

Chapter 7: Conditional Parts of Makefiles 81Substitution and Analysis], page 84). This is useful when touch is not enough to make afile appear up to dat

Page 206 - 196 GNU make

Chapter 8: Functions for Transforming Text 838 Functions for Transforming TextFunctions allow you to do text processing in the makefile to compute the

Page 207 - Index of Concepts 197

84 GNU make8.2 Functions for String Substitution and AnalysisHere are some functions that operate on strings:$(subst from,to,text)Performs a textual r

Page 208 - 198 GNU make

Chapter 8: Functions for Transforming Text 85$(objects:.o=.c)instead of using the general form:$(patsubst %.o,%.c,$(objects))$(strip string)Removes le

Page 209

86 GNU makeFor example, given:objects=main1.o foo.o main2.o bar.omains=main1.o main2.othe following generates a list which contains all the object file

Page 210 - 200 GNU make

Chapter 8: Functions for Transforming Text 87produces the result ‘bar’. Although $(lastword text) is the same as $(word$(words text),text), the lastwo

Page 211

88 GNU make$(suffix names...)Extracts the suffix of each file name in names. If the file name contains a period,the suffix is everything starting with the l

Page 212

Chapter 8: Functions for Transforming Text 89$(wildcard pattern)The argument pattern is a file name pattern, typically containing wildcardcharacters (a

Comments to this Manuals

No comments