1 # 2 # CDDL HEADER START 3 # 4 # The contents of this file are subject to the terms of the 5 # Common Development and Distribution License (the "License"). 6 # You may not use this file except in compliance with the License. 7 # 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 # or http://www.opensolaris.org/os/licensing. 10 # See the License for the specific language governing permissions 11 # and limitations under the License. 12 # 13 # When distributing Covered Code, include this CDDL HEADER in each 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 # If applicable, add the following below this CDDL HEADER, with the 16 # fields enclosed by brackets "[]" replaced with your own identifying 17 # information: Portions Copyright [yyyy] [name of copyright owner] 18 # 19 # CDDL HEADER END 20 # 21 # 22 # Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 # Use is subject to license terms. 24 # 25 # ident "%Z%%M% %I% %E% SMI" 26 # 27 # cmd/fs.d/Makefile 28 29 # The filesystem independent utilities clri, fsdb, dcopy, labelit, and mkfs 30 # are all built from the source file switchout.c. They are all then links 31 # to the same object. This is accomplished by: 32 # 1) building clri from switchout.c (had to choose one) 33 # 2) installing it in the target directory 34 # 3) linking the others to clri. 35 # In a similar manner, ncheck is linked to ff. 36 37 DFPROG= df 38 PROG= $(DFPROG) fsck volcopy ff 39 ROOTFS_PROG= mount umount 40 XPG4PROG= df 41 SPPROG= clri 42 MNTTAB= mnttab 43 DEFAULTFILES= fs.dfl 44 45 include ../Makefile.cmd 46 47 SUBDIR1= lofs zfs 48 SUBDIR2= dev fd pcfs nfs hsfs proc ctfs udfs ufs tmpfs cachefs \ 49 autofs mntfs objfs sharefs smbclnt 50 SUBDIRS= $(SUBDIR1) $(SUBDIR2) 51 I18NDIRS= $(SUBDIR2) 52 53 CLOBBERFILES += $(POFILES_XPG4) 54 55 all:= TARGET= all 56 install:= TARGET= install 57 clean:= TARGET= clean 58 clobber:= TARGET= clobber 59 lint:= TARGET= lint 60 _msg:= TARGET= catalog 61 62 USRSBINF= df clri fsck volcopy ff 63 USRSBINCLRI= dcopy fsdb fssnap labelit mkfs 64 USRSBINFF= ncheck 65 66 ETC2SBIN= mount umount 67 ETC2USRSBIN= clri fsdb mkfs fsck labelit dcopy volcopy ff ncheck 68 USRBIN2USRSBIN= df 69 70 FSLIB= fslib.o 71 72 ROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%) 73 ROOTUSRSBINLINKS = $(ROOTFS_PROG:%=$(ROOTUSRSBIN)/%) 74 75 ROOTUSRSBINF= $(USRSBINF:%=$(ROOTUSRSBIN)/%) 76 ROOTUSRSBINCLRI= $(USRSBINCLRI:%=$(ROOTUSRSBIN)/%) 77 ROOTUSRSBINFF= $(USRSBINFF:%=$(ROOTUSRSBIN)/%) 78 ROOTETCMNTTAB= $(MNTTAB:%=$(ROOTETC)/%) 79 SYMETC2SBIN = $(ETC2SBIN:%=$(ROOTETC)/%) 80 SYMETC2USRSBIN = $(ETC2USRSBIN:%=$(ROOTETC)/%) 81 SYMUSRBIN2USRSBIN= $(USRBIN2USRSBIN:%=$(ROOTBIN)/%) 82 SYMDEVNM= $(ROOTUSRSBIN)/devnm 83 84 # This flag is being added only for SCO (x86) compatibility 85 df.o := CFLAGS += $(iBCS2FLAG) 86 87 CPPFLAGS += -D_LARGEFILE64_SOURCE 88 %.xpg4.o := CPPFLAGS += -DXPG4 89 $(SPPROG) := LDLIBS += -lkstat 90 91 $(ROOTETCMNTTAB) := FILEMODE = 444 92 $(ROOTETCMNTTAB) := OWNER = root 93 $(ROOTETCMNTTAB) := GROUP = root 94 95 # for messaging catalog 96 # 97 POFILE= fs.d.po 98 POFILES1= $(PROG:%=%.po) $(ROOTFS_PROG:%=%.po) switchout.po fssnapsup.po 99 POFILES2= $(I18NDIRS:%=%/%.po) 100 POFILES_XPG4 = df.po.xpg4 101 POFILES= $(POFILES1) $(POFILES2) $(POFILES_XPG4) 102 $(POFILES_XPG4) := CFLAGS += -DXPG4 103 volcopy.po := XGETFLAGS += -a -x volcopy.xcl 104 $(POFILES_XPG4) := XGETFLAGS += -a -x df.xcl 105 $(DFPROG).po := XGETFLAGS += -a -x df.xcl 106 107 %.po.xpg4: %.c 108 $(COMPILE.cpp) $< > $<.i 109 $(BUILD.po) 110 111 # build rule for xpg4 objects 112 %.xpg4.o: %.c 113 $(COMPILE.c) -o $@ $< 114 115 .KEEP_STATE: 116 117 # This is too intense when building the whole world. 118 # .PARALLEL: $(SUBDIRS) 119 120 all: $(FSLIB) .WAIT $(SUBDIRS) .WAIT all_local 121 122 _msg: $(I18NDIRS) $(POFILES1) $(POFILES_XPG4) 123 $(RM) $(POFILE) 124 cat $(POFILES) > $(POFILE) 125 $(RM) $(MSGDOMAIN)/$(POFILE) 126 cp $(POFILE) $(MSGDOMAIN) 127 128 all_local: $(PROG) $(ROOTFS_PROG) $(XPG4PROG) $(SPPROG) $(MNTTAB) \ 129 $(DEFAULTFILES) 130 131 ff volcopy: deffs.o $$(@F).o 132 $(LINK.c) -o $@ $@.o deffs.o $(LDLIBS) 133 $(POST_PROCESS) 134 135 df df.xpg4: deffs.o $(FSLIB) $$(@F).o 136 $(LINK.c) -o $@ $@.o deffs.o $(FSLIB) $(LDLIBS) 137 $(POST_PROCESS) 138 139 fsck: fsck.o deffs.o preenlib.o 140 $(LINK.c) -o $@ fsck.o deffs.o preenlib.o $(LDLIBS) 141 $(POST_PROCESS) 142 143 mount: deffs.o mount.o $(FSLIB) 144 $(LINK.c) -o $@ mount.o deffs.o $(FSLIB) $(LDLIBS) 145 $(POST_PROCESS) 146 147 umount: umount.o $(FSLIB) 148 $(LINK.c) -o $@ umount.o $(FSLIB) $(LDLIBS) 149 $(POST_PROCESS) 150 151 $(SPPROG): switchout.o deffs.o fssnapsup.o 152 $(LINK.c) -o $@ switchout.o deffs.o fssnapsup.o $(LDLIBS) -ldiskmgt 153 $(POST_PROCESS) 154 155 install: $(FSLIB) .WAIT $(SUBDIRS) .WAIT install_local 156 157 install_local: all_local $(ROOTSBINPROG) $(ROOTUSRSBINF) $(ROOTUSRSBINCLRI) \ 158 $(ROOTUSRSBINFF) $(ROOTETCMNTTAB) $(ROOTETCDEFAULTFILES) \ 159 $(ROOTXPG4PROG) $(SYMETC2SBIN) $(SYMETC2USRSBIN) \ 160 $(SYMUSRBIN2USRSBIN) $(SYMDEVNM) $(ROOTUSRSBINLINKS) 161 162 # Links from /etc to /sbin such as /etc/mount -> ../sbin/mount 163 $(SYMETC2SBIN): 164 -$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@ 165 166 # Links from /etc to /usr/sbin such as /etc/clri -> ../usr/sbin/clri 167 $(SYMETC2USRSBIN): 168 -$(RM) $@; $(SYMLINK) ../usr/sbin/$(@F) $@ 169 170 # Links from /usr/bin to /usr/sbin such as /usr/bin/df -> ../sbin/df 171 $(SYMUSRBIN2USRSBIN): 172 -$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@ 173 174 # Links from /usr/sbin to /sbin such as /usr/sbin/mount -> ../../sbin/mount 175 $(ROOTUSRSBINLINKS): 176 -$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@ 177 178 # Symlink from devnm to df in /usr/sbin 179 $(SYMDEVNM): 180 -$(RM) $@; $(SYMLINK) ./df $@ 181 182 # Multiple names for switchout (clri, dcopy, fsdb, labelit, mkfs) 183 $(ROOTUSRSBINCLRI): $(ROOTUSRSBIN)/clri 184 -$(RM) $@; $(SYMLINK) ./clri $@ 185 186 $(MNTTAB): 187 touch $(MNTTAB) 188 189 fs.dfl: 190 $(RM) $@; $(ECHO) "LOCAL=ufs" >$@ 191 192 # Multiple names for ff (ncheck) 193 $(ROOTUSRSBINFF): $(ROOTUSRSBIN)/ff 194 -$(RM) $@; $(SYMLINK) ./ff $@ 195 196 clean: $(SUBDIRS) .WAIT clean_local 197 198 clean_local: 199 200 clobber: $(SUBDIRS) .WAIT clobber_local 201 202 clobber_local: clean_local 203 $(RM) $(PROG) $(ROOTFS_PROG) $(SPPROG) $(MNTTAB) $(DEFAULTFILES) \ 204 $(CLOBBERFILES) 205 206 lint: 207 208 $(SUBDIRS): FRC 209 @cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET) 210 211 FRC: 212