⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makerules.4

📁 创建一个符合iso-9660标准的iso文件系统
💻 4
📖 第 1 页 / 共 2 页
字号:
. \" @(#)makerules.4	1.2 97/02/14 Copyr 1996 J. Schilling. \" System Manual page for makefile system. \".if t .ds a \v'-0.55m'\h'0.00n'\z.\h'0.40n'\z.\v'0.55m'\h'-0.40n'a.if t .ds o \v'-0.55m'\h'0.00n'\z.\h'0.45n'\z.\v'0.55m'\h'-0.45n'o.if t .ds u \v'-0.55m'\h'0.00n'\z.\h'0.40n'\z.\v'0.55m'\h'-0.40n'u.if t .ds A \v'-0.77m'\h'0.25n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.70n'A.if t .ds O \v'-0.77m'\h'0.25n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.70n'O.if t .ds U \v'-0.77m'\h'0.30n'\z.\h'0.45n'\z.\v'0.77m'\h'-.75n'U.if t .ds s \(*b.if t .ds S SS.if n .ds a ae.if n .ds o oe.if n .ds u ue.if n .ds s sz.TH makefiles 4L "14. February 1997" "J\*org Schilling" "Schily\'s FILE FORMATS".\".TH makerules 4L "14. February 1997" "J\*org Schilling" "GMD FOKUS FILE FORMATS".SH NAMEmakerules \- system programmers guide for compiling projects on different platforms.SH SYNOPSIS.B "SRCROOT=	.\|..br.B "RULESDIR=	RULES.br.B "include		$(SRCROOT)/$(RULESDIR)/rules.top.br.I "local defines are here.br.B "include		$(SRCROOT)/$(RULESDIR)/rules.*.PPSee chapter CURRENTLY SUPPORTED TARGET TYPES for possible values of.BR "rules.*" ..SH DESCRIPTIONMakerules is a set of rules that allows compiling of structuredprojects with small and uniformly structured makefiles.All rules are located in a central directory.Compiling the projects on different platforms can be done withoutthe need to modify any of the makefiles that are locatedin the projects directories..PPThree make programs are currently supported:.IR "Sunpro make" , .I "GNU make"and.IR smake .If you want to add support for other make programs, read the sections about the minimum requirements for a make programand about the structure of the .B "make rule system..PPThis manual will help programmers who need to make modificationson the make rule system itself. If you want to know something on how to use the .B "makefile systemhave a look at .BR makefiles (4)..PPThe main design goal was to have no definition on more than placein the make rules. This implies that system programmers whowant to add or modify rules must follow this goal in order not todestroy functionality in other places..PPThe visible result for the user is a set of small and easy to readmakefiles, each located in the project's leaf directory and therefore called.IR leaf -makefile..PPEach of these .IR leaf -makefiles,in fact contains no rule at all. It simply defines some macrosfor the .IR make -programand includes two files from a central make rule depository.These included files define the rules that are needed to compilethe project..PPEach .IR leaf -makefileis formed in a really simple way:.TP\(buIt first defines two macros that define the relative locationof the project's root directory and the name of the directorythat contains the complete set of of rules and then includesthe rule file .I rules.topfrom the directory that forms the central rule depository.You only have to edit the macro.I SRCROOTto reflect the relative location of the project's root directory..TP\(buThe next part of a .IR leaf -makefiledefines macros that describe the target and the source.You can only have one target per .IR leaf -makefile.Of course, there may be many source files, that are needed to createthat target.If you want to make more than one target in a specific directory,you have to put more than one makefile into that directory.This is the part of a makefile that describes a unique target.Edit this part to contain all source files, all local include filesand all non global compile time flags that are needed for your target.For a typical target this is as simple as filling in a form..TP\(buEach.IR leaf -makefilefinally includes a file from the rules directory that containsrules for the appropriate type of target that is to be madefrom this .IR leaf -makefile..PPThe makefile in each directory has to be called.IR Makefile .If you want to have more than one makefile in a specific directory,you have to choose different names for the other makefiles..SH "Currently Supported Target Types.PPThere are rules for the following type of targets:.TP 20commandsThe make rules for user level commands like.IR cat ", " ls etc. are located in the file .I rules.cmd.TPdriversThe make rules for device driversare located in the file .I rules.drv.TPlibrariesThe make rules for non shared librariesare located in the file .I rules.lib.TPshared librariesThe make rules for shared librariesare located in the file .I rules.shl.TPlocalized filesThe make rules for localized filesare located in the file .I rules.loc.TPnonlocalized filesThe make rules for non localized filesare located in the file .I rules.aux.TPshell scriptsThe make rules for shell scripts (a variant of localized files)are located in the file .I rules.scr.TPmanual pagesThe make rules for manual pages (a variant of localized files)are located in the file .I rules.man.TPdiverted makefilesThe make rules for projects that need to have more thanone makefile in a specific directoryare located in the file .I rules.mksIt contains a rule that diverts to the listed sub makefiles.Each sub makefile may be of any type..TPdirectoriesThe make rules for sub directoriesare located in the file .I rules.dir.SH "Minimum Requirements For A Make ProgramThe make rules currently have support for.IR "Sunpro make" , .I "GNU make"and.IR smake .If you like to add support for other make programs, they need to have some minimal features that gobeyond the capabilities of the standard .SM "UNIX.B makeprogram..I BSDmakecould be supported if it supports pattern matching rules correctly..TP 20includeThe make program must be able to recursively include other filesfrom within a .I makefile.The name if the file to include must be allowed to be a macro.The make program must be able to do this in a way thatif the file that should be included may be a result of make rule.e.g if the file to be included does not exist or is outdated,it should be built before an attempt is made to actually include it..TPappending to a macroA macro reference of the form:.sp.B "macro += addval.spshould append.B addvalto the string that is currently in.BR macro ..TPsuffix macro replacementA macro reference of the form:.sp.B "out= $(macro\|:\|string1\|=\|string2).spshould replace a suffix.I string1to.I string2in all words that are in.BR macro ,where string1 is either a suffix, or a word to be replacedin the macro definition, and string2 is the replacement suffix or word..I String1and.I string2must be replaced correctly even if they are macros themselves.Words in a macro value are separated by SPACE, TAB, and escaped NEWLINE characters..TPpattern macro replacementA macro reference of the form:.sp.B "out= $(macro\|:\|op%os\|=\|np%ns).spshould replace a central pattern in .BR macro ,where .B op is the existing (old) prefix and .B osis the existing(old) suffix,.B np and .B ns are the new prefix and new suffix,respectively, and the pattern matched by % (a string of zeroor more characters), is carried forward from the value beingreplaced.For example:.sp.B "PROGRAM=fabricate.br.B "DEBUG= $(PROGRAM:%=tmp/%\-g).spsets the value of DEBUG to tmp/fabricate\-g..IR Op ", " os ", " .IR np " and " nsmust be replaced correctly even if they are macros themselves..SH "Understanding Basic AlgorithmsOne of the basic algorithms used in the make rule systemis needed to set an undefined macro to a guaranteed default value.Because not all make programs have support for.I "if then elsestructures, a different method has to be used..PPThe method used in.B "make rulesis implemented by using.B "suffix macro replacementand.BR "pattern macro replacement" ..PP.ne 5First, a macro that contains a unique suffix is defined:.sp.B " # Define magic unique cookie.br.B " _UNIQ= 		.XxZzy\-.spThis macro is used for all places where it is necessary to havea macro with a guaranteed default value.The following example shows the basic algorithm that is used toimplement the phrase:.B If .I $(MAKE_NAME)contains a value, .B then.I $(XMAKEPROG)will be set to.I $(MAKE_NAME).B else.I $(XMAKEPROG)will be set to.IR $(MAKEPROG) ..sp.B " _MAKEPROG=	$(_UNIQ)$(MAKE_NAME).br.B " __MAKEPROG=	$(_MAKEPROG:$(_UNIQ)=$(MAKEPROG)).br.B " XMAKEPROG=	$(__MAKEPROG:$(_UNIQ)%=%).spThe first line in this example, sets the macro.I _MAKEPROGto the concatenation of the value of.I MAKE_NAMEand.BR .XxZzy\- .If the macro.I MAKE_NAMEis empty at this time, .I _MAKEPROGwill contain only .BR .XxZzy\- ..PPIn the second line, .I __MAKEPROGis set to the value of.IR _MAKEPROG .If .I _MAKEPROGcontains only .B .XxZzy\-this implies, that.B .XxZzy\-is the suffix. This suffix is then replacedby the value of.IR MAKEPROG ,in this case.I __MAKEPROGwill contain the unmodified value of.IR MAKEPROG .If .I _MAKEPROGcontains a concatenation of.B .XxZzy\-and something else, .B .XxZzy\-will not be a suffix, but a prefix of .I _MAKEPROGand for this reason.I __MAKEPROGwill contain the unmodified value of.IR _MAKEPROG ,which is a concatenation of.B .XxZzy\-and the value of.IR MAKE_NAME ..PPIn the third line, .I XMAKEPROGis set to the value of.IR __MAKEPROG .If .I __MAKEPROGhas the prefix.B .XxZzy\- at this time, .B .XxZzy\-is stripped of..SH "The Structure in Make Macro names.PPThe names used for .B "make macrosare structured in a way that allows to use .BR grep (1)to look for the names in the .B make rules.To allow this, no name must be a substring of another name..PPIf a command needs options that have to be specifiedin macros, there is a .B "make macrothat is named.I XXXFLAGS.This is compliant to usual make file rules.The are internal .B "make macroscalled.I XXXOPTSand.I XXXOPTXthat will be combined for .IR XXXFLAGS :.sp.B "LDFLAGS= $(LDOPTS) $(LDOPTX).spWhere .I XXXOPTSis the name of the macro that is used internallyand .I XXXOPTXis the name of the macro that may be used from thecommand line of the make program..I XXXOPTXtherefore is used to append to the content of .I XXXFLAGSIf the value of.I XXXFLAGSneed to be overwritten, .I XXXOPTSmay be used within the command line flags of the make program..SH "The Structure Of The Make Rule System.SH "The Structure Of The Basic Rules in rules.topThe file .B RULES/rules.topfirst includes a rule file that depends on the make program that is used.The name of this file is.BI RULES/mk\- makeprog .idwhere.I makeproghas to be replaced by the real name ofthe makeprogram e.g..BR make ", " gmake ", " smake .The purpose of this file is to set up a list of macrosthat identify the system where the project is currently built.These macros have values that contain only lower case letters and define:.TP 28the processor architectureIf two systems run the same operating system, thisis a unique value if a simple user level program willnot need to be recompiled in order to run on the other system.Possible values are .BR sparc ", " mc68020 ", " pentium .This is the output of.BR "uname \-p" .The value is stored in.BR P_ARCH ..TPthe kernel architectureIf two systems may use the same value for .B P_ARCHbut a heavily system dependent user level programneed to be recompiled in order to run on the othersystem, These two systems have different kernel architectures.This is the output of.BR "uname \-m" .Possible values are .BR sun3 ", " sun4c ", " sun4m .The value is stored in.BR K_ARCH ..TPthe machine architectureAn outdated macro that is useful only on sun systems.Do not use this, use .B P_ARCH instead.This is the output of.BR arch .Possible values are .BR sun3 ", " sun4 .The value is stored in.BR M_ARCH ..TPthe hostnameThe name of the machine where the compilation takes place.This is the output of.BR "uname \-n" .The value is stored in.BR HOSTNAME ..TPthe name of the operating systemThis is the output of.BR "uname \-s" .Possible values are .BR sunos ", " dgux ", " hp\-ux ", " irix .The value is stored in.BR OSNAME ..TPthe release of the operating systemThis is the output of.BR "uname \-r" .Possible values are .BR 5.5 ", " 4.1.4 .The value is stored in.BR OSREL ..PPThe next file to be included from.B RULES/rules.topis.BI RULES/os\- "operating system" .id .It defines the macros.B O_ARCHand.B \-O_ARCH and may modify one of the macros that are definedin.BI RULES/mk\- makeprog .id .The macros.B O_ARCHand.B \-O_ARCH are used to distinguish between different operating systems.The names of the compiler configuration files have

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -