Configuring the Sections of Makefile
The first section of the Makefile file contains the following macro definitions:
INETDIR=/etc/inet
RBACDIR=/etc/security
PWDIR =/etc
DOM = 'domainname'
ALIASES = /etc/mail/aliases
YPDIR=/usr/lib/netsvc/yp
SBINDIR=/usr/sbin
YPDBDIR=/var/yp
YPPUSH=$(YPDIR)/yppush
MAKEDBM=$(SBINDIR)/makedbm
MULTI=$(YPDIR)/multi
REVNETGROUP=$(SBINDIR)/revnetgroup
STDETHERS=$(YPDIR)/stdethers
STDHOSTS=$(YPDIR)/stdhosts
MKNETID=$(SBINDIR)/mknetid
MKALIAS=$(YPDIR)/mkalias
The second section of the Makefile file contains the first target, all.
all: passwd group hosts ipnodes ethers networks rpc services protocols \ netgroup bootparams aliases publickey netid netmasks c2secure \ timezone auto.master auto.home \
auth.attr exec.attr prof.attr user.attr audit.user
The all target has several dependencies, each of which represents one of the NIS maps to be built. This feature enables the entire set of NIS maps to be built by typing:
The all target is not considered to be built until each of its targets is first built. Each of the targets for all depends on another target.
When adding custom maps to NIS, the name of the new map to be built should be added to the all target list (auto.direct in the following example).
all: passwd group hosts ipnodes ethers networks rpc services protocols \ netgroup bootparams aliases publickey netid netmasks c2secure \ timezone auto.master auto.home auto.direct\ auth.attr exec.attr prof.attr user.attr audit.user
Note - The fourth section is covered before the third section, because the fourth section continues the dependency thread introduced by the all target.
The entry in the fourth section of the Makefile file for each of the dependencies in the all target is:
passwd: passwd.time group: group.time project: project.time hosts: hosts.time ipnodes: ipnodes.time ethers: ethers.time networks: networks.time rpc: rpc.time services: services.time protocols: protocols.time netgroup: netgroup.time bootparams: bootparams.time aliases: aliases.time publickey: publickey.time netid: netid.time passwd.adjunct: passwd.adjunct.time group.adjunct: group.adjunct.time netmasks: netmasks.time timezone: timezone.time auto.master: auto.master.time auto.home: auto.home.time auth.attr:auth.attr.time exec.attr:exec.attr.time prof.attr:prof.attr.time user.attr:user.attr.time audit.user:audit.user.time
Using the previous example of an auto.direct map, add a new map to the NIS domain by appending the appropriate entries to the end of this "second level" target and dependency pair.
auto.direct: auto.direct.time $(DIR)/auto_direct:
After you modify the auto.direct map, the final lines from the fourth section of the Makefile file would look like:
auto.master: auto.master.time auto.home: auto.home.time auto.direct: auto.direct.time auth.attr:auth.attr.time exec.attr:exec.attr.time prof.attr:prof.attr.time user.attr:user.attr.time audit.user:audit.user.time
The target is the auto.direct map, which depends on the auto.direct.time target.
The third section of the Makefile file defines the final target and dependencies, as well as instructions on how to build each map in the domain.
Edit the Makefile file by adding the following lines to build a new auto_direct map:
auto.direct.time: $(DIR)/auto_direct
sed -e "/A#/d" -e s/#.*$$// $(DIR)/auto_direct \ | $(MAKEDBM) - $(YPDBDIR)/$(DOM)/auto.direct; \ touch auto.direct.time; \ echo "updated auto.direct"; \
$(YPPUSH) auto.direct; \ echo "pushed auto.direct"; \
echo "couldn't find $(DIR)/auto_direct"; \
Caution - You can copy and paste lines from a section to another map; however, the proper use of tabs and spaces in the Makefile file is critical. Look up the make command in the online manual pages for the correct usage of tabs and spaces.
Some points to consider are:
• You must indent subsequent lines of make instructions by using tabs.
• You can use make macros in the instructions.
• Instructions that begin with the at (@) sign are not echoed to the terminal screen. Removing the @ sign is useful for debugging new instructions.
• Instructions that begin with a leading dash (-) before the @ sign do not echo error messages to the terminal screen.
Post a comment