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