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 34DFPROG= df 35PROG= $(DFPROG) fsck volcopy ff 36ROOTFS_PROG= mount umount 37SPPROG= clri 38MNTTAB= mnttab 39DEFAULTFILES= fs.dfl 40 41include ../Makefile.cmd 42 43SUBDIR1= bootfs lofs zfs 44SUBDIR2= dev fd pcfs nfs hsfs proc ctfs udfs ufs tmpfs \ 45 autofs mntfs objfs sharefs smbclnt reparsed 46SUBDIRS= $(SUBDIR1) $(SUBDIR2) 47I18NDIRS= $(SUBDIR2) 48 49CLEANFILES += deffs.o df.o ff.o fsck.o fssnapsup.o \ 50 mount.o preenlib.o switchout.o umount.o volcopy.o 51 52all:= TARGET= all 53install:= TARGET= install 54clean:= TARGET= clean 55clobber:= TARGET= clobber 56lint:= TARGET= lint 57_msg:= TARGET= catalog 58 59USRSBINF= df clri fsck volcopy ff 60USRSBINCLRI= dcopy fsdb fssnap labelit mkfs 61USRSBINFF= ncheck 62 63ETC2SBIN= mount umount 64ETC2USRSBIN= clri fsdb mkfs fsck labelit dcopy volcopy ff ncheck 65USRBIN2USRSBIN= df 66USRXPG4BIN2USRSBIN= df 67 68FSLIB= fslib.o 69 70ROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%) 71ROOTUSRSBINLINKS = $(ROOTFS_PROG:%=$(ROOTUSRSBIN)/%) 72 73ROOTUSRSBINF= $(USRSBINF:%=$(ROOTUSRSBIN)/%) 74ROOTUSRSBINCLRI= $(USRSBINCLRI:%=$(ROOTUSRSBIN)/%) 75ROOTUSRSBINFF= $(USRSBINFF:%=$(ROOTUSRSBIN)/%) 76ROOTETCMNTTAB= $(MNTTAB:%=$(ROOTETC)/%) 77SYMETC2SBIN = $(ETC2SBIN:%=$(ROOTETC)/%) 78SYMETC2USRSBIN = $(ETC2USRSBIN:%=$(ROOTETC)/%) 79SYMUSRBIN2USRSBIN= $(USRBIN2USRSBIN:%=$(ROOTBIN)/%) 80SYMUSRXPG4BIN2USRSBIN= $(USRXPG4BIN2USRSBIN:%=$(ROOTXPG4BIN)/%) 81SYMDEVNM= $(ROOTUSRSBIN)/devnm 82 83CPPFLAGS += -D_LARGEFILE64_SOURCE 84 85CERRWARN += -_gcc=-Wno-implicit-function-declaration 86CERRWARN += -_gcc=-Wno-parentheses 87CERRWARN += -_gcc=-Wno-unused-variable 88CERRWARN += $(CNOWARN_UNINIT) 89CERRWARN += -_gcc=-Wno-unused-function 90 91# not linted 92SMATCH=off 93 94$(DFPROG) := LDLIBS += -lcmdutils 95$(SPPROG) := LDLIBS += -lkstat 96 97$(ROOTETCMNTTAB) := FILEMODE = 444 98 99# for messaging catalog 100# 101POFILE= fs.d.po 102POFILES1= $(PROG:%=%.po) $(ROOTFS_PROG:%=%.po) switchout.po fssnapsup.po 103POFILES2= $(I18NDIRS:%=%/%.po) 104POFILES= $(POFILES1) $(POFILES2) 105volcopy.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 113all: $(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 121all_local: $(PROG) $(ROOTFS_PROG) $(SPPROG) $(MNTTAB) \ 122 $(DEFAULTFILES) 123 124ff volcopy: deffs.o $$(@F).o 125 $(LINK.c) -o $@ $@.o deffs.o $(LDLIBS) 126 $(POST_PROCESS) 127 128df: deffs.o $(FSLIB) $$(@F).o 129 $(LINK.c) -o $@ $@.o deffs.o $(FSLIB) $(LDLIBS) 130 $(POST_PROCESS) 131 132fsck: fsck.o deffs.o preenlib.o 133 $(LINK.c) -o $@ fsck.o deffs.o preenlib.o $(LDLIBS) 134 $(POST_PROCESS) 135 136mount: deffs.o mount.o $(FSLIB) 137 $(LINK.c) -o $@ mount.o deffs.o $(FSLIB) $(LDLIBS) 138 $(POST_PROCESS) 139 140umount: 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 148install: $(FSLIB) .WAIT $(SUBDIRS) .WAIT install_local 149 150install_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 187fs.dfl: 188 $(RM) $@; $(ECHO) "LOCAL=ufs" >$@ 189 190# Multiple names for ff (ncheck) 191$(ROOTUSRSBINFF): $(ROOTUSRSBIN)/ff 192 -$(RM) $@; $(SYMLINK) ./ff $@ 193 194clean: $(SUBDIRS) .WAIT clean_local 195clean_local: 196 $(RM) $(CLEANFILES) 197 198clobber: $(SUBDIRS) .WAIT clobber_local 199clobber_local: clean_local 200 $(RM) $(PROG) $(ROOTFS_PROG) $(SPPROG) $(MNTTAB) $(DEFAULTFILES) \ 201 $(CLOBBERFILES) 202 203lint: 204 205$(SUBDIRS): FRC 206 @cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET) 207 208FRC: 209