asp.net mvc create pdf from view : Change font size in pdf file SDK control service wpf azure windows dnn make4-part1269

Chapter4:WritingRules
31
cleanall : cleanobj cleandiff
rm program
cleanobj :
rm *.o
cleandiff :
rm *.diff
4.6 RuleswithoutRecipesorPrerequisites
Ifarulehasnoprerequisitesorrecipe,andthetargetoftheruleisanonexistentfile,then
makeimaginesthistargettohavebeenupdatedwheneveritsruleisrun. Thisimpliesthat
alltargetsdependingonthisonewillalwayshavetheirreciperun.
Anexamplewillillustratethis:
clean: FORCE
rm $(objects)
FORCE:
Herethetarget‘FORCE’satisfiesthespecialconditions,sothetargetcleanthatdepends
onitisforcedtorunitsrecipe. Thereisnothingspecialaboutthename‘FORCE’,butthat
isonenamecommonlyusedthisway.
Asyoucansee,using‘FORCE’thiswayhasthesameresultsasusing‘.PHONY:clean’.
Using‘.PHONY’is moreexplicitandmoreefficient. . However,otherversionsofmakedo
not support t ‘.PHONY’; ; thus s ‘FORCE’ appears inmany makefiles. . See Section 4.5 [Phony
Targets],page29.
4.7 EmptyTargetFilestoRecordEvents
Theemptytargetisavariantofthephonytarget;itisusedtoholdrecipesforanaction
thatyourequestexplicitly fromtimetotime. . Unlikeaphony y target,this targetfile can
reallyexist;butthefile’scontentsdonotmatter,andusuallyareempty.
Thepurposeoftheemptytargetfileistorecord,withitslast-modificationtime,when
therule’srecipewaslastexecuted. Itdoessobecauseoneofthecommandsintherecipe
isatouchcommandtoupdatethetargetfile.
Theemptytargetfileshouldhavesomeprerequisites(otherwiseitdoesn’tmakesense).
Whenyouasktoremaketheemptytarget,therecipeisexecutedifanyprerequisiteismore
recentthanthetarget;inotherwords,ifaprerequisitehaschangedsincethelasttimeyou
remadethetarget.Hereisanexample:
print: foo.c c bar.c
lpr -p $?
touch print
Withthisrule,‘makeprint’willexecutethelprcommandifeithersourcefilehaschanged
since the last ‘makeprint’. . Theautomaticvariable e ‘$?’is usedtoprintonlythosefiles
thathavechanged(seeSection10.5.3[AutomaticVariables],page120).
Change font size in pdf file - Compress reduce PDF size in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
C# Code & .NET API to Compress & Decompress PDF Document
pdf change font size in textbox; adjusting page size in pdf
Change font size in pdf file - VB.NET PDF File Compress Library: Compress reduce PDF size in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Compression and Decompression Control SDK
change font size in pdf file; 300 dpi pdf file size
32
GNUmake
4.8 SpecialBuilt-inTargetNames
Certainnameshavespecialmeaningsiftheyappearastargets.
.PHONY
Theprerequisitesofthespecialtarget.PHONYareconsideredtobephonytar-
gets. Whenit t is time to considersucha target,make willrunitsrecipe un-
conditionally, regardless s of whether a file with h that t name exists s or r what its
last-modificationtimeis.SeeSection4.5[PhonyTargets],page29.
.SUFFIXES
Theprerequisitesofthespecialtarget.SUFFIXESarethelistofsuffixestobe
usedincheckingforsuffixrules.SeeSection10.7[Old-FashionedSuffixRules],
page125.
.DEFAULT
Therecipespecifiedfor.DEFAULTisusedforanytargetforwhichnorulesare
found(either explicit rules or implicitrules). . See Section10.6 [LastResort],
page125.Ifa.DEFAULTrecipeisspecified,everyfilementionedasaprerequi-
site,butnotasatargetinarule,willhavethatrecipeexecutedonitsbehalf.
SeeSection10.8[ImplicitRuleSearchAlgorithm],page127.
.PRECIOUS
Thetargetswhich.PRECIOUSdependsonaregiventhefollowingspecialtreat-
ment:ifmakeiskilledorinterruptedduringtheexecutionoftheirrecipes,the
targetis not deleted. . See Section5.6[InterruptingorKillingmake],page50.
Also,ifthetargetis anintermediate file,itwillnotbedeletedafter itis no
longerneeded,asisnormallydone.SeeSection10.4[ChainsofImplicitRules],
page117. Inthislatterrespectitoverlapswiththe.SECONDARYspecialtarget.
You can also list t the target t pattern of f animplicit t rule e (such as ‘%.o’) as s a
prerequisitefileofthespecialtarget .PRECIOUStopreserveintermediatefiles
createdbyruleswhosetargetpatternsmatchthatfile’sname.
.INTERMEDIATE
Thetargetswhich.INTERMEDIATEdependsonaretreatedasintermediatefiles.
SeeSection10.4[ChainsofImplicitRules],page117. .INTERMEDIATEwithno
prerequisiteshasnoeffect.
.SECONDARY
The targets s which .SECONDARY Y depends onare treated d as s intermediate files,
exceptthattheyareneverautomaticallydeleted. SeeSection10.4[Chainsof
ImplicitRules],page117.
.SECONDARYwithnoprerequisitescausesalltargetstobetreatedassecondary
(i.e.,notargetisremovedbecauseitisconsideredintermediate).
.SECONDEXPANSION
If.SECONDEXPANSIONismentionedasatargetanywhereinthemakefile,then
allprerequisitelists definedafter r it t appears willbe expandedasecond d time
afterallmakefileshavebeenreadin. SeeSection3.8[Secondary Expansion],
page18.
C# PDF Sticky Note Library: add, delete, update PDF note in C#.net
Allow users to add comments online in ASPX webpage. Able to change font size in PDF comment box. Able to save and print sticky notes in PDF file.
change page size pdf; change font size pdf comment box
C# PDF insert text Library: insert text into PDF content in C#.net
existing scanned PDF text. Ability to change text font, color, size and location and output a new PDF document. XDoc.PDF for .NET
pdf markup text size; best online pdf compressor
Chapter4:WritingRules
33
.DELETE_ON_ERROR
If.DELETE_ON_ERRORismentionedasatargetanywhereinthemakefile,then
makewilldeletethetargetofaruleifithaschangedanditsrecipeexitswith
anonzeroexitstatus,justasitdoeswhenitreceivesasignal. SeeSection5.5
[ErrorsinRecipes],page49.
.IGNORE
Ifyouspecifyprerequisitesfor.IGNORE,thenmakewillignoreerrorsinexecution
oftherecipeforthoseparticularfiles.Therecipefor.IGNORE(ifany)isignored.
Ifmentionedasatargetwithnoprerequisites,.IGNOREsaystoignoreerrorsin
executionofrecipesforallfiles. Thisusageof‘.IGNORE’issupportedonlyfor
historicalcompatibility. Sincethisaffectseveryrecipeinthemakefile,itisnot
veryuseful;werecommendyouusethemoreselectivewaystoignoreerrorsin
specificrecipes.SeeSection5.5[ErrorsinRecipes],page49.
.LOW_RESOLUTION_TIME
If you u specify prerequisites for r .LOW_RESOLUTION_TIME, , make e assumes s that
thesefilesarecreatedbycommandsthatgeneratelowresolutiontimestamps.
Therecipeforthe.LOW_RESOLUTION_TIMEtargetareignored.
The high resolutionfile timestamps of many modernfile systems lessenthe
chanceofmakeincorrectlyconcludingthatafileisuptodate. Unfortunately,
somehosts donot provide awaytoset ahighresolutionfiletime stamp, , so
commands like‘cp-p’thatexplicitly setafile’s time stampmustdiscardits
sub-secondpart. If f a file is s created by such a a command, , you u should list t it
asaprerequisiteof.LOW_RESOLUTION_TIMEsothatmakedoesnotmistakenly
concludethatthefileisoutofdate.Forexample:
.LOW_RESOLUTION_TIME: dst
dst: src
cp -p src c dst
Since‘cp-p’discardsthesub-secondpartofsrc’stimestamp,dstistypically
slightlyolderthansrcevenwhenitisuptodate.The.LOW_RESOLUTION_TIME
linecauses maketoconsider dst to beuptodate ifitstimestampis at the
startofthesamesecondthatsrc’stimestampisin.
Due to alimitation of the archive format, archive member time stamps are
alwayslow resolution. . Youneednot t list archive membersasprerequisites of
.LOW_RESOLUTION_TIME,asmakedoesthisautomatically.
.SILENT
Ifyouspecifyprerequisitesfor.SILENT,thenmakewillnotprinttherecipeused
toremakethoseparticularfilesbeforeexecutingthem.Therecipefor.SILENT
isignored.
Ifmentionedas atargetwithnoprerequisites,.SILENTsaysnottoprintany
recipes beforeexecutingthem. . This s usageof ‘.SILENT’is supportedonlyfor
historical compatibility. . We e recommend you use the more selective ways s to
silencespecificrecipes. SeeSection5.2[RecipeEchoing],page43. Ifyouwant
to silenceallrecipes fora particular runof make, usethe‘-s’or ‘--silent’
option(seeSection9.7[OptionsSummary],page104).
C# PDF Field Edit Library: insert, delete, update pdf form field
Able to add text field to specified PDF file position in C#.NET class. Support to change font size in PDF form. Able to delete form fields from adobe PDF file.
batch pdf compression; change paper size pdf
C# PDF Text Box Edit Library: add, delete, update PDF text box in
Support to change font color in PDF text box. Ability to change text size in PDF text box. Adding text box is another way to add text to PDF page.
pdf font size change; change font size pdf
34
GNUmake
.EXPORT_ALL_VARIABLES
Simplybybeingmentionedasatarget,this tellsmaketoexport allvariables
tochildprocessesbydefault. SeeSection5.7.2[CommunicatingVariablestoa
Sub-make],page52.
.NOTPARALLEL
If .NOTPARALLEL is mentionedas a target,thenthis invocation of make will
berunserially,evenifthe‘-j’optionisgiven. Any y recursively invokedmake
commandwillstillrunrecipesinparallel(unlessitsmakefilealsocontainsthis
target). Anyprerequisitesonthistargetareignored.
.ONESHELL
If.ONESHELLismentionedasatarget,thenwhenatargetisbuiltalllinesof
therecipewillbegiventoasingleinvocationoftheshellratherthaneachline
beinginvokedseparately(seeSection5.3[RecipeExecution],page44).
.POSIX
If.POSIX ismentionedas atarget,thenthemakefilewillbeparsedandrun
inPOSIX-conformingmode.ThisdoesnotmeanthatonlyPOSIX-conforming
makefileswillbeaccepted: alladvancedGNUmakefeaturesarestillavailable.
Rather,thistargetcausesmaketobehaveasrequiredbyPOSIXinthoseareas
wheremake’sdefaultbehaviordiffers.
Inparticular,ifthistargetismentionedthenrecipeswillbeinvokedasifthe
shellhadbeenpassedthe-e flag: : the e first failingcommandinarecipewill
causetherecipetofailimmediately.
Anydefinedimplicitrulesuffixalsocountsasaspecialtargetifitappearsasatarget,
andsodoestheconcatenationoftwosuffixes,suchas‘.c.o’.Thesetargetsaresuffixrules,
anobsolete wayofdefiningimplicitrules (but away stillwidelyused). . Inprinciple,any
targetnamecouldbespecialinthiswayifyoubreakitintwoandaddbothpiecestothe
suffixlist. Inpractice,suffixesnormallybeginwith‘.’,sothesespecialtargetnamesalso
beginwith‘.’. SeeSection10.7[Old-FashionedSuffixRules],page125.
4.9 MultipleTargetsinaRule
Arulewithmultipletargetsisequivalenttowritingmanyrules,eachwithonetarget,and
allidenticalasidefromthat. Thesamerecipeappliestoallthetargets,butitseffectmay
varybecauseyoucansubstitutetheactualtargetnameintotherecipeusing‘$@’.Therule
contributesthesameprerequisitestoallthetargetsalso.
Thisisusefulintwocases.
 Youwantjustprerequisites,norecipe. . Forexample:
kbd.o command.o files.o: command.h
givesanadditionalprerequisitetoeachofthethreeobjectfilesmentioned.
 Similar r recipes work for all the e targets. . The e recipes s do o not t need to o be absolutely
identical, since the automatic variable ‘$@’ can be used tosubstitute theparticular
target to be remade into the commands (see Section 10.5.3 [Automatic Variables],
page120). Forexample:
C# PDF Annotate Library: Draw, edit PDF annotation, markups in C#.
Able to edit and change PDF annotation properties such as font size or color. Abilities to draw markups on PDF document or stamp on PDF file.
apple compress pdf; pdf paper size
C# PDF Convert to Word SDK: Convert PDF to Word library in C#.net
PDF document, keeps the elements (like images, tables and chats) of original PDF file and maintains the original text style (including font, size, color, links
reader pdf reduce file size; change page size of pdf document
Chapter4:WritingRules
35
bigoutput littleoutput t : text.g
generate text.g -$(subst output,,$@) > $@
isequivalentto
bigoutput : : text.g
generate text.g -big g > > bigoutput
littleoutput : : text.g
generate text.g -little e > > littleoutput
Hereweassumethehypotheticalprogramgeneratemakestwotypesofoutput,oneif
given‘-big’andoneifgiven‘-little’. SeeSection8.2[FunctionsforStringSubsti-
tutionandAnalysis],page84,foranexplanationofthesubstfunction.
Supposeyouwouldliketovarytheprerequisitesaccordingtothetarget,muchasthe
variable‘$@’allowsyoutovarytherecipe. Youcannotdothiswithmultipletargetsinan
ordinaryrule,butyoucandoitwithastaticpatternrule.SeeSection4.11[StaticPattern
Rules],page36.
4.10 MultipleRulesforOneTarget
Onefilecanbethetargetofseveralrules. Alltheprerequisitesmentionedinalltherules
are merged into one list t of f prerequisites s for the target. . If f the target is s older r than n any
prerequisitefromanyrule,therecipeisexecuted.
Therecanonly be onerecipe to be executedfor afile. . Ifmore e thanonerule givesa
recipeforthesame file,make usesthelast onegivenandprints anerrormessage. . (Asa
special case,if the file’s s namebegins withadot, , noerror r messageis printed. . This s odd
behaviorisonlyforcompatibilitywithotherimplementationsofmake...youshouldavoid
usingit).Occasionallyitisusefultohavethesametargetinvokemultiplerecipeswhichare
definedindifferentpartsofyourmakefile;youcanusedouble-colonrules(seeSection4.12
[Double-Colon],page38)forthis.
Anextrarulewithjustprerequisitescanbeusedtogiveafewextraprerequisitestomany
filesatonce. Forexample,makefilesoftenhaveavariable,suchasobjects,containinga
listofallthecompileroutputfilesinthesystembeingmade. Aneasywaytosaythatall
ofthemmustberecompiledifconfig.hchangesistowritethefollowing:
objects = = foo.o bar.o
foo.o : defs.h
bar.o : defs.h test.h
$(objects) : : config.h
Thiscouldbeinsertedortakenoutwithoutchangingtherulesthatreallyspecifyhowto
maketheobjectfiles,makingitaconvenientformtouseifyouwishtoaddtheadditional
prerequisiteintermittently.
Another wrinkleis that theadditionalprerequisites couldbespecifiedwithavariable
thatyousetwithacommandlineargumenttomake(seeSection9.5[OverridingVariables],
page103). Forexample,
extradeps=
$(objects) : : $(extradeps)
meansthatthecommand‘makeextradeps=foo.h’willconsiderfoo.hasaprerequisiteof
eachobjectfile,butplain‘make’willnot.
C# PDF File Split Library: Split, seperate PDF into multiple files
RasterEdge.Imaging.Drawing.dll. RasterEdge.Imaging.Font.dll. This C# sample codes explain how to split a PDF file into multiple ones by output PDF file size.
best pdf compressor; pdf optimized format
VB.NET PDF File Split Library: Split, seperate PDF into multiple
RasterEdge.Imaging.Drawing.dll. RasterEdge.Imaging.Font.dll. This VB.NET sample codes explain how to split a PDF file into multiple ones by output PDF file size.
adjust pdf page size; change font size in fillable pdf form
36
GNUmake
Ifnoneoftheexplicitrulesforatargethasarecipe,thenmakesearchesforanapplicable
implicitruletofindoneseeChapter10[UsingImplicitRules],page111).
4.11 StaticPatternRules
Staticpatternrulesareruleswhichspecifymultipletargetsandconstructtheprerequisite
namesforeachtargetbasedonthetargetname.Theyaremoregeneralthanordinaryrules
withmultipletargetsbecausethetargetsdonothavetohaveidenticalprerequisites. Their
prerequisitesmustbeanalogous,butnotnecessarilyidentical.
4.11.1 SyntaxofStaticPatternRules
Hereisthesyntaxofastaticpatternrule:
targets ...: : target-pattern: : prereq-patterns ...
recipe
...
The targets s list specifies the e targets s that t the rule e applies to. . The e targets s can n contain
wildcardcharacters,justlikethetargetsofordinaryrules(seeSection4.3[UsingWildcard
CharactersinFileNames],page23).
The target-patternand prereq-patterns s say y how to compute theprerequisites of each
target. Eachtargetis s matchedagainstthetarget-patterntoextractapartofthetarget
name,calledthestem. Thisstemissubstitutedintoeachoftheprereq-patternstomake
theprerequisitenames(onefromeachprereq-pattern).
Eachpatternnormallycontains the character ‘%’just once. . Whenthetarget-pattern
matchesa target,the‘%’canmatch anypart of thetarget name; thispart is calledthe
stem.Therestofthepatternmustmatchexactly.Forexample,thetargetfoo.omatches
thepattern‘%.o’,with‘foo’asthestem. Thetargetsfoo.candfoo.outdonot t match
thatpattern.
Theprerequisitenamesforeachtargetaremadebysubstitutingthestemforthe‘%’in
eachprerequisitepattern.Forexample,ifoneprerequisitepatternis%.c,thensubstitution
ofthestem‘foo’givestheprerequisitenamefoo.c. Itislegitimatetowriteaprerequisite
patternthatdoesnotcontain‘%’;thenthisprerequisiteisthesameforalltargets.
‘%’characters in n pattern rules s canbe quotedwithpreceding backslashes (‘\’). . Back-
slashes that t would otherwise e quote‘%’ characters s can be e quoted with more backslashes.
Backslashesthat quote‘%’charactersorother backslashes areremovedfrom m the pattern
before it t is s compared d to file names or r has s astem substituted into o it. . Backslashes s that
are not in danger of quoting ‘%’ characters s go o unmolested. . For r example, , the pattern
the\%weird\\%pattern\\ has s ‘the%weird\’ preceding the operative ‘%’ ’ character, and
‘pattern\\’ following it. . The e final two backslashes are e left t alone because they y cannot
affectany‘%’character.
Hereisanexample,whichcompileseachoffoo.oandbar.ofromthecorresponding.c
file:
Chapter4:WritingRules
37
objects = = foo.o bar.o
all: $(objects)
$(objects): %.o: %.c
$(CC) -c $(CFLAGS) ) $< < -o $@
Here ‘$<’ is the automatic variable that t holds the e name e of f the prerequisite and ‘$@’ is
theautomaticvariablethat holds the name of the target; ; see Section10.5.3[Automatic
Variables],page120.
Eachtargetspecifiedmustmatchthetargetpattern;awarningisissuedforeachtarget
thatdoesnot.Ifyouhavealistoffiles,onlysomeofwhichwillmatchthepattern,youcan
usethefilterfunctiontoremovenon-matchingfilenames(seeSection8.2[Functionsfor
StringSubstitutionandAnalysis],page84):
files = foo.elc c bar.o o lose.o
$(filter %.o,$(files)): : %.o: : %.c
$(CC) -c $(CFLAGS) ) $< < -o $@
$(filter %.elc,$(files)): %.elc: %.el
emacs -f batch-byte-compile $<
Inthisexampletheresultof‘$(filter%.o,$(files))’isbar.olose.o,andthefirststatic
patternrulecauseseachoftheseobjectfilestobeupdatedbycompilingthecorresponding
Csourcefile. Theresultof‘$(filter%.elc,$(files))’isfoo.elc,sothatfileismade
fromfoo.el.
Anotherexampleshowshowtouse$*instaticpatternrules:
bigoutput littleoutput t : %output : : text.g
generate text.g g -$* * > $@
Whenthegeneratecommandisrun,$*willexpandtothestem,either‘big’or‘little’.
4.11.2 StaticPatternRulesversusImplicitRules
Astaticpatternrulehas muchincommonwithanimplicitruledefinedasapatternrule
(seeSection10.5[DefiningandRedefiningPatternRules],page118). Bothhaveapattern
forthetargetandpatternsforconstructingthenamesofprerequisites. Thedifferenceisin
howmakedecideswhentheruleapplies.
Animplicit rulecan apply to any target that matches its pattern,butit t does s apply
onlywhenthetargethasnorecipeotherwisespecified,andonlywhentheprerequisitescan
be found. . Ifmorethanone e implicit ruleappearsapplicable,only oneapplies;thechoice
dependsontheorderofrules.
Bycontrast,astaticpatternruleappliestothepreciselistoftargetsthatyouspecify
intherule. Itcannotapplytoanyothertargetanditinvariablydoesapplytoeachofthe
targetsspecified. Iftwoconflictingrulesapply,andbothhaverecipes,that’sanerror.
Thestaticpatternrulecanbebetterthananimplicitruleforthesereasons:
 Youmaywishtooverridetheusualimplicitruleforafewfileswhosenamescannotbe
categorizedsyntacticallybutcanbegiveninanexplicitlist.
38
GNUmake
 Ifyoucannotbesureoftheprecisecontentsofthedirectoriesyouareusing,youmay
notbesurewhichotherirrelevantfilesmightleadmaketousethewrongimplicitrule.
Thechoicemightdependontheorderinwhichtheimplicitrulesearchisdone. With
staticpatternrules,thereisnouncertainty: eachruleappliestopreciselythetargets
specified.
4.12 Double-ColonRules
Double-colonrulesareexplicitruleswrittenwith‘::’insteadof‘:’afterthetargetnames.
They arehandled d differently y fromordinary rules whenthe sametarget appears inmore
than one rule. . Patternrules s withdouble-colons s have anentirely different meaning (see
Section10.5.5[Match-AnythingRules],page123).
Whenatargetappearsinmultiplerules,alltherulesmustbethesametype:allordinary,
or alldouble-colon. . If f they aredouble-colon,eachofthemis independent ofthe others.
Eachdouble-colonrule’s recipeisexecutedifthetargetisolderthanany prerequisites of
thatrule. Iftherearenoprerequisitesforthatrule,its s recipeisalwaysexecuted(evenif
thetargetalreadyexists).Thiscanresultinexecutingnone,any,orallofthedouble-colon
rules.
Double-colonruleswiththesametargetareinfactcompletelyseparatefromoneanother.
Each double-colon rule e is s processed d individually, just t as s rules s withdifferent t targets s are
processed.
Thedouble-colonrulesforatargetareexecutedintheordertheyappearinthemakefile.
However,thecaseswheredouble-colonrulesreallymakesensearethosewheretheorderof
executingtherecipeswouldnotmatter.
Double-colon rules are e somewhat obscure and d not often very y useful; ; they y provide a
mechanismfor cases in n whichthe methodused toupdate atarget t differs depending on
whichprerequisitefilescausedtheupdate,andsuchcasesarerare.
Eachdouble-colonruleshouldspecify arecipe; ; ifit t does not,animplicit rulewillbe
usedifoneapplies.SeeChapter10[UsingImplicitRules],page111.
4.13 GeneratingPrerequisitesAutomatically
In the makefile for r a program, , many y of the rules youneed d to write often say y only that
someobjectfiledepends onsomeheaderfile. . Forexample,ifmain.cusesdefs.hviaan
#include,youwouldwrite:
main.o: defs.h
You need d this s rule so o that t make knows that it must remake main.o whenever defs.h
changes.Youcanseethatforalargeprogramyouwouldhavetowritedozensofsuchrules
inyourmakefile. And,youmustalwaysbeverycarefultoupdatethemakefileeverytime
youaddorremovean#include.
Toavoidthishassle,mostmodernCcompilerscanwritetheserulesforyou,bylooking
atthe#includelines inthesourcefiles. . Usuallythisisdonewiththe‘-M’optiontothe
compiler. Forexample,thecommand:
cc -M main.c
generatestheoutput:
Chapter4:WritingRules
39
main.o : main.c c defs.h
Thusyounolongerhavetowriteallthoserulesyourself.Thecompilerwilldoitforyou.
Notethatsucharuleconstitutesmentioningmain.oinamakefile,soit cannever be
consideredanintermediatefileby implicitrulesearch. . This s meansthat makewon’tever
removethefileafterusingit;seeSection10.4[ChainsofImplicitRules],page117.
With old make programs, it t was traditional l practice e to use this s compiler r feature to
generate prerequisites ondemand with a command like ‘makedepend’. . That t command
would create afile depend d containing allthe automatically-generatedprerequisites;then
themakefilecoulduseincludetoreadthemin(seeSection3.3[Include],page13).
InGNUmake,thefeatureofremakingmakefilesmakesthispracticeobsolete—youneed
nevertellmakeexplicitlytoregeneratetheprerequisites,becauseitalwaysregeneratesany
makefilethatisoutofdate. SeeSection3.5[RemakingMakefiles],page14.
Thepracticewerecommendforautomaticprerequisitegenerationistohaveonemakefile
correspondingtoeachsourcefile. For r eachsourcefilename.cthereis amakefilename.d
whichlistswhatfilestheobjectfilename.odependson. Thatwayonlythesourcefilesthat
havechangedneedtoberescannedtoproducethenewprerequisites.
Hereisthepatternruletogenerateafileofprerequisites(i.e.,amakefile)calledname.d
fromaCsourcefilecalledname.c:
%.d: %.c
@set -e; ; rm m -f $@; \
$(CC) -M M $(CPPFLAGS) ) $< > > $@.$$$$; ; \
sed ’s,\($*\)\.o[ :]*,\1.o o $@ : : ,g’ < < $@.$$$$ $ > > $@; \
rm -f $@.$$$$
SeeSection10.5[PatternRules],page118,forinformationondefiningpatternrules. The
‘-e’ flag to theshellcauses s it toexit immediately if the e $(CC) ) command d (or r any other
command)fails(exitswithanonzerostatus).
WiththeGNUCcompiler,youmaywishtousethe‘-MM’flaginsteadof‘-M’.Thisomits
prerequisitesonsystemheaderfiles. SeeSection“OptionsControllingthePreprocessor”in
UsingGNUCC,fordetails.
Thepurposeofthesedcommandistotranslate(forexample):
main.o : main.c c defs.h
into:
main.o main.d : : main.c c defs.h
Thismakeseach‘.d’filedependonallthesourceandheaderfilesthatthecorresponding
‘.o’filedependson. makethenknowsitmustregeneratetheprerequisiteswheneveranyof
thesourceorheaderfileschanges.
Onceyou’vedefinedtheruletoremakethe‘.d’files,youthenusetheincludedirective
toreadthemallin.SeeSection3.3[Include],page13. Forexample:
sources = = foo.c bar.c
include $(sources:.c=.d)
(Thisexampleusesasubstitutionvariablereferencetotranslatethelistofsourcefiles‘foo.c
bar.c’intoalistofprerequisitemakefiles,‘foo.dbar.d’. SeeSection6.3.1[Substitution
Refs], page 62, for r full l information on substitution references.) ) Since e the e ‘.d’ ’ files are
40
GNUmake
makefileslike any others,makewillremakethemas necessarywithnofurther workfrom
you.SeeSection3.5[RemakingMakefiles],page14.
Notethatthe‘.d’filescontaintargetdefinitions;youshouldbesuretoplacetheinclude
directiveafter thefirst,defaultgoalinyourmakefiles s orruntheriskofhavingarandom
objectfilebecomethedefaultgoal. SeeSection2.3[HowMakeWorks],page5.
Documents you may be interested
Documents you may be interested