10Sstevel@tonic-gate# 20Sstevel@tonic-gate# CDDL HEADER START 30Sstevel@tonic-gate# 40Sstevel@tonic-gate# The contents of this file are subject to the terms of the 52212Sartem# Common Development and Distribution License (the "License"). 62212Sartem# You may not use this file except in compliance with the License. 70Sstevel@tonic-gate# 80Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate# See the License for the specific language governing permissions 110Sstevel@tonic-gate# and limitations under the License. 120Sstevel@tonic-gate# 130Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate# 190Sstevel@tonic-gate# CDDL HEADER END 200Sstevel@tonic-gate# 21*12836Srich.burridge@oracle.com# Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. 220Sstevel@tonic-gate# 230Sstevel@tonic-gate 240Sstevel@tonic-gate# The filesystem independent utilities clri, fsdb, dcopy, labelit, and mkfs 250Sstevel@tonic-gate# are all built from the source file switchout.c. They are all then links 260Sstevel@tonic-gate# to the same object. This is accomplished by: 270Sstevel@tonic-gate# 1) building clri from switchout.c (had to choose one) 280Sstevel@tonic-gate# 2) installing it in the target directory 290Sstevel@tonic-gate# 3) linking the others to clri. 300Sstevel@tonic-gate# In a similar manner, ncheck is linked to ff. 310Sstevel@tonic-gate 320Sstevel@tonic-gateDFPROG= df 330Sstevel@tonic-gatePROG= $(DFPROG) fsck volcopy ff 340Sstevel@tonic-gateROOTFS_PROG= mount umount 350Sstevel@tonic-gateXPG4PROG= df 360Sstevel@tonic-gateSPPROG= clri 370Sstevel@tonic-gateMNTTAB= mnttab 3889SmeemDEFAULTFILES= fs.dfl 390Sstevel@tonic-gate 400Sstevel@tonic-gateinclude ../Makefile.cmd 410Sstevel@tonic-gate 422212SartemSUBDIR1= lofs zfs 433957Sth199096SUBDIR2= dev fd pcfs nfs hsfs proc ctfs udfs ufs tmpfs cachefs \ 4410793Sdai.ngo@sun.com autofs mntfs objfs sharefs smbclnt reparsed 453445SblakejSUBDIRS= $(SUBDIR1) $(SUBDIR2) 463445SblakejI18NDIRS= $(SUBDIR2) 470Sstevel@tonic-gate 480Sstevel@tonic-gateCLOBBERFILES += $(POFILES_XPG4) 490Sstevel@tonic-gate 500Sstevel@tonic-gateall:= TARGET= all 510Sstevel@tonic-gateinstall:= TARGET= install 520Sstevel@tonic-gateclean:= TARGET= clean 530Sstevel@tonic-gateclobber:= TARGET= clobber 540Sstevel@tonic-gatelint:= TARGET= lint 550Sstevel@tonic-gate_msg:= TARGET= catalog 560Sstevel@tonic-gate 570Sstevel@tonic-gateUSRSBINF= df clri fsck volcopy ff 580Sstevel@tonic-gateUSRSBINCLRI= dcopy fsdb fssnap labelit mkfs 590Sstevel@tonic-gateUSRSBINFF= ncheck 600Sstevel@tonic-gate 610Sstevel@tonic-gateETC2SBIN= mount umount 620Sstevel@tonic-gateETC2USRSBIN= clri fsdb mkfs fsck labelit dcopy volcopy ff ncheck 630Sstevel@tonic-gateUSRBIN2USRSBIN= df 640Sstevel@tonic-gate 650Sstevel@tonic-gateFSLIB= fslib.o 660Sstevel@tonic-gate 670Sstevel@tonic-gateROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%) 680Sstevel@tonic-gateROOTUSRSBINLINKS = $(ROOTFS_PROG:%=$(ROOTUSRSBIN)/%) 690Sstevel@tonic-gate 700Sstevel@tonic-gateROOTUSRSBINF= $(USRSBINF:%=$(ROOTUSRSBIN)/%) 710Sstevel@tonic-gateROOTUSRSBINCLRI= $(USRSBINCLRI:%=$(ROOTUSRSBIN)/%) 720Sstevel@tonic-gateROOTUSRSBINFF= $(USRSBINFF:%=$(ROOTUSRSBIN)/%) 730Sstevel@tonic-gateROOTETCMNTTAB= $(MNTTAB:%=$(ROOTETC)/%) 740Sstevel@tonic-gateSYMETC2SBIN = $(ETC2SBIN:%=$(ROOTETC)/%) 750Sstevel@tonic-gateSYMETC2USRSBIN = $(ETC2USRSBIN:%=$(ROOTETC)/%) 760Sstevel@tonic-gateSYMUSRBIN2USRSBIN= $(USRBIN2USRSBIN:%=$(ROOTBIN)/%) 770Sstevel@tonic-gateSYMDEVNM= $(ROOTUSRSBIN)/devnm 780Sstevel@tonic-gate 790Sstevel@tonic-gateCPPFLAGS += -D_LARGEFILE64_SOURCE 800Sstevel@tonic-gate%.xpg4.o := CPPFLAGS += -DXPG4 812923Sraf$(SPPROG) := LDLIBS += -lkstat 820Sstevel@tonic-gate 830Sstevel@tonic-gate$(ROOTETCMNTTAB) := FILEMODE = 444 840Sstevel@tonic-gate 850Sstevel@tonic-gate# for messaging catalog 860Sstevel@tonic-gate# 870Sstevel@tonic-gatePOFILE= fs.d.po 880Sstevel@tonic-gatePOFILES1= $(PROG:%=%.po) $(ROOTFS_PROG:%=%.po) switchout.po fssnapsup.po 890Sstevel@tonic-gatePOFILES2= $(I18NDIRS:%=%/%.po) 900Sstevel@tonic-gatePOFILES_XPG4 = df.po.xpg4 910Sstevel@tonic-gatePOFILES= $(POFILES1) $(POFILES2) $(POFILES_XPG4) 920Sstevel@tonic-gate$(POFILES_XPG4) := CFLAGS += -DXPG4 930Sstevel@tonic-gatevolcopy.po := XGETFLAGS += -a -x volcopy.xcl 940Sstevel@tonic-gate$(POFILES_XPG4) := XGETFLAGS += -a -x df.xcl 950Sstevel@tonic-gate$(DFPROG).po := XGETFLAGS += -a -x df.xcl 960Sstevel@tonic-gate 970Sstevel@tonic-gate%.po.xpg4: %.c 980Sstevel@tonic-gate $(COMPILE.cpp) $< > $<.i 990Sstevel@tonic-gate $(BUILD.po) 1000Sstevel@tonic-gate 1010Sstevel@tonic-gate# build rule for xpg4 objects 1020Sstevel@tonic-gate%.xpg4.o: %.c 1030Sstevel@tonic-gate $(COMPILE.c) -o $@ $< 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate.KEEP_STATE: 1060Sstevel@tonic-gate 1070Sstevel@tonic-gate# This is too intense when building the whole world. 1080Sstevel@tonic-gate# .PARALLEL: $(SUBDIRS) 1090Sstevel@tonic-gate 1100Sstevel@tonic-gateall: $(FSLIB) .WAIT $(SUBDIRS) .WAIT all_local 1110Sstevel@tonic-gate 1120Sstevel@tonic-gate_msg: $(I18NDIRS) $(POFILES1) $(POFILES_XPG4) 1130Sstevel@tonic-gate $(RM) $(POFILE) 1140Sstevel@tonic-gate cat $(POFILES) > $(POFILE) 1150Sstevel@tonic-gate $(RM) $(MSGDOMAIN)/$(POFILE) 1160Sstevel@tonic-gate cp $(POFILE) $(MSGDOMAIN) 1170Sstevel@tonic-gate 11889Smeemall_local: $(PROG) $(ROOTFS_PROG) $(XPG4PROG) $(SPPROG) $(MNTTAB) \ 11989Smeem $(DEFAULTFILES) 1200Sstevel@tonic-gate 1210Sstevel@tonic-gateff volcopy: deffs.o $$(@F).o 1220Sstevel@tonic-gate $(LINK.c) -o $@ $@.o deffs.o $(LDLIBS) 1230Sstevel@tonic-gate $(POST_PROCESS) 1240Sstevel@tonic-gate 1250Sstevel@tonic-gatedf df.xpg4: deffs.o $(FSLIB) $$(@F).o 1260Sstevel@tonic-gate $(LINK.c) -o $@ $@.o deffs.o $(FSLIB) $(LDLIBS) 1270Sstevel@tonic-gate $(POST_PROCESS) 1280Sstevel@tonic-gate 1290Sstevel@tonic-gatefsck: fsck.o deffs.o preenlib.o 1300Sstevel@tonic-gate $(LINK.c) -o $@ fsck.o deffs.o preenlib.o $(LDLIBS) 1310Sstevel@tonic-gate $(POST_PROCESS) 1320Sstevel@tonic-gate 1330Sstevel@tonic-gatemount: deffs.o mount.o $(FSLIB) 1340Sstevel@tonic-gate $(LINK.c) -o $@ mount.o deffs.o $(FSLIB) $(LDLIBS) 1350Sstevel@tonic-gate $(POST_PROCESS) 1360Sstevel@tonic-gate 1370Sstevel@tonic-gateumount: umount.o $(FSLIB) 1380Sstevel@tonic-gate $(LINK.c) -o $@ umount.o $(FSLIB) $(LDLIBS) 1390Sstevel@tonic-gate $(POST_PROCESS) 1400Sstevel@tonic-gate 1410Sstevel@tonic-gate$(SPPROG): switchout.o deffs.o fssnapsup.o 142767Ssjelinek $(LINK.c) -o $@ switchout.o deffs.o fssnapsup.o $(LDLIBS) -ldiskmgt 1430Sstevel@tonic-gate $(POST_PROCESS) 1440Sstevel@tonic-gate 1450Sstevel@tonic-gateinstall: $(FSLIB) .WAIT $(SUBDIRS) .WAIT install_local 1460Sstevel@tonic-gate 1470Sstevel@tonic-gateinstall_local: all_local $(ROOTSBINPROG) $(ROOTUSRSBINF) $(ROOTUSRSBINCLRI) \ 14889Smeem $(ROOTUSRSBINFF) $(ROOTETCMNTTAB) $(ROOTETCDEFAULTFILES) \ 1490Sstevel@tonic-gate $(ROOTXPG4PROG) $(SYMETC2SBIN) $(SYMETC2USRSBIN) \ 1500Sstevel@tonic-gate $(SYMUSRBIN2USRSBIN) $(SYMDEVNM) $(ROOTUSRSBINLINKS) 1510Sstevel@tonic-gate 1520Sstevel@tonic-gate# Links from /etc to /sbin such as /etc/mount -> ../sbin/mount 1530Sstevel@tonic-gate$(SYMETC2SBIN): 1540Sstevel@tonic-gate -$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@ 1550Sstevel@tonic-gate 1560Sstevel@tonic-gate# Links from /etc to /usr/sbin such as /etc/clri -> ../usr/sbin/clri 1570Sstevel@tonic-gate$(SYMETC2USRSBIN): 1580Sstevel@tonic-gate -$(RM) $@; $(SYMLINK) ../usr/sbin/$(@F) $@ 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate# Links from /usr/bin to /usr/sbin such as /usr/bin/df -> ../sbin/df 1610Sstevel@tonic-gate$(SYMUSRBIN2USRSBIN): 1620Sstevel@tonic-gate -$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@ 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate# Links from /usr/sbin to /sbin such as /usr/sbin/mount -> ../../sbin/mount 1650Sstevel@tonic-gate$(ROOTUSRSBINLINKS): 1660Sstevel@tonic-gate -$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@ 1670Sstevel@tonic-gate 1680Sstevel@tonic-gate# Symlink from devnm to df in /usr/sbin 1690Sstevel@tonic-gate$(SYMDEVNM): 1700Sstevel@tonic-gate -$(RM) $@; $(SYMLINK) ./df $@ 1710Sstevel@tonic-gate 1720Sstevel@tonic-gate# Multiple names for switchout (clri, dcopy, fsdb, labelit, mkfs) 1730Sstevel@tonic-gate$(ROOTUSRSBINCLRI): $(ROOTUSRSBIN)/clri 1740Sstevel@tonic-gate -$(RM) $@; $(SYMLINK) ./clri $@ 1750Sstevel@tonic-gate 1760Sstevel@tonic-gate$(MNTTAB): 1770Sstevel@tonic-gate touch $(MNTTAB) 1780Sstevel@tonic-gate 17989Smeemfs.dfl: 18089Smeem $(RM) $@; $(ECHO) "LOCAL=ufs" >$@ 1810Sstevel@tonic-gate 1820Sstevel@tonic-gate# Multiple names for ff (ncheck) 1830Sstevel@tonic-gate$(ROOTUSRSBINFF): $(ROOTUSRSBIN)/ff 1840Sstevel@tonic-gate -$(RM) $@; $(SYMLINK) ./ff $@ 1850Sstevel@tonic-gate 1863445Sblakejclean: $(SUBDIRS) .WAIT clean_local 1870Sstevel@tonic-gate 1880Sstevel@tonic-gateclean_local: 1890Sstevel@tonic-gate 1903445Sblakejclobber: $(SUBDIRS) .WAIT clobber_local 1910Sstevel@tonic-gate 1920Sstevel@tonic-gateclobber_local: clean_local 19389Smeem $(RM) $(PROG) $(ROOTFS_PROG) $(SPPROG) $(MNTTAB) $(DEFAULTFILES) \ 19489Smeem $(CLOBBERFILES) 1950Sstevel@tonic-gate 1960Sstevel@tonic-gatelint: 1970Sstevel@tonic-gate 1983445Sblakej$(SUBDIRS): FRC 1990Sstevel@tonic-gate @cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET) 2000Sstevel@tonic-gate 2010Sstevel@tonic-gateFRC: 202