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