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