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