Merge illumos-gate
[unleashed.git] / usr / src / cmd / fs.d / Makefile
blob188b6b86053c5ce2af0bb4171de08fd2bca8b0d9
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
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.
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.
34 DFPROG= df
35 PROG= $(DFPROG) fsck volcopy ff
36 ROOTFS_PROG= mount umount
37 SPPROG= clri
38 MNTTAB= mnttab
39 DEFAULTFILES= fs.dfl
41 include ../Makefile.cmd
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)
49 CLEANFILES += deffs.o df.o ff.o fsck.o fssnapsup.o \
50 mount.o preenlib.o switchout.o umount.o volcopy.o
52 all:= TARGET= all
53 install:= TARGET= install
54 clean:= TARGET= clean
55 clobber:= TARGET= clobber
56 _msg:= TARGET= catalog
58 USRSBINF= df clri fsck volcopy ff
59 USRSBINCLRI= dcopy fsdb fssnap labelit mkfs
60 USRSBINFF= ncheck
62 USRBIN2USRSBIN= df
64 FSLIB= fslib.o
66 ROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
67 ROOTUSRSBINLINKS = $(ROOTFS_PROG:%=$(ROOTUSRSBIN)/%)
69 ROOTUSRSBINF= $(USRSBINF:%=$(ROOTUSRSBIN)/%)
70 ROOTUSRSBINCLRI= $(USRSBINCLRI:%=$(ROOTUSRSBIN)/%)
71 ROOTUSRSBINFF= $(USRSBINFF:%=$(ROOTUSRSBIN)/%)
72 ROOTETCMNTTAB= $(MNTTAB:%=$(ROOTETC)/%)
73 SYMUSRBIN2USRSBIN= $(USRBIN2USRSBIN:%=$(ROOTBIN)/%)
74 SYMDEVNM= $(ROOTUSRSBIN)/devnm
77 CERRWARN += -Wno-implicit-function-declaration
78 CERRWARN += -Wno-parentheses
79 CERRWARN += -Wno-unused-variable
80 CERRWARN += -Wno-uninitialized
81 CERRWARN += -Wno-unused-function
83 # not linted
84 SMATCH=off
86 $(DFPROG) := LDLIBS += -lcmdutils
87 $(SPPROG) := LDLIBS += -lkstat
89 $(ROOTETCMNTTAB) := FILEMODE = 444
91 # for messaging catalog
93 POFILE= fs.d.po
94 POFILES1= $(PROG:%=%.po) $(ROOTFS_PROG:%=%.po) switchout.po fssnapsup.po
95 POFILES2= $(I18NDIRS:%=%/%.po)
96 POFILES= $(POFILES1) $(POFILES2)
97 volcopy.po := XGETFLAGS += -a -x volcopy.xcl
98 $(DFPROG).po := XGETFLAGS += -a -x df.xcl
100 .KEEP_STATE:
102 # This is too intense when building the whole world.
103 # .PARALLEL: $(SUBDIRS)
105 all: $(FSLIB) .WAIT $(SUBDIRS) .WAIT all_local
107 _msg: $(I18NDIRS) $(POFILES1)
108 $(RM) $(POFILE)
109 cat $(POFILES) > $(POFILE)
110 $(RM) $(MSGDOMAIN)/$(POFILE)
111 cp $(POFILE) $(MSGDOMAIN)
113 all_local: $(PROG) $(ROOTFS_PROG) $(SPPROG) $(MNTTAB) \
114 $(DEFAULTFILES)
116 ff volcopy: deffs.o $$(@F).o
117 $(LINK.c) -o $@ $@.o deffs.o $(LDLIBS)
118 $(POST_PROCESS)
120 df: deffs.o $(FSLIB) $$(@F).o
121 $(LINK.c) -o $@ $@.o deffs.o $(FSLIB) $(LDLIBS)
122 $(POST_PROCESS)
124 fsck: fsck.o deffs.o preenlib.o
125 $(LINK.c) -o $@ fsck.o deffs.o preenlib.o $(LDLIBS)
126 $(POST_PROCESS)
128 mount: deffs.o mount.o $(FSLIB)
129 $(LINK.c) -o $@ mount.o deffs.o $(FSLIB) $(LDLIBS)
130 $(POST_PROCESS)
132 umount: umount.o $(FSLIB)
133 $(LINK.c) -o $@ umount.o $(FSLIB) $(LDLIBS)
134 $(POST_PROCESS)
136 $(SPPROG): switchout.o deffs.o fssnapsup.o
137 $(LINK.c) -o $@ switchout.o deffs.o fssnapsup.o $(LDLIBS) -ldiskmgt
138 $(POST_PROCESS)
140 install: $(FSLIB) .WAIT $(SUBDIRS) .WAIT install_local
142 install_local: all_local $(ROOTSBINPROG) $(ROOTUSRSBINF) $(ROOTUSRSBINCLRI) \
143 $(ROOTUSRSBINFF) $(ROOTETCMNTTAB) $(ROOTETCDEFAULTFILES) \
144 $(SYMUSRBIN2USRSBIN) $(SYMDEVNM) \
145 $(ROOTUSRSBINLINKS)
147 # Links from /usr/bin to /usr/sbin such as /usr/bin/df -> ../sbin/df
148 $(SYMUSRBIN2USRSBIN):
149 -$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
151 # Links from /usr/sbin to /sbin such as /usr/sbin/mount -> ../../sbin/mount
152 $(ROOTUSRSBINLINKS):
153 -$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
155 # Symlink from devnm to df in /usr/sbin
156 $(SYMDEVNM):
157 -$(RM) $@; $(SYMLINK) ./df $@
159 # Multiple names for switchout (clri, dcopy, fsdb, labelit, mkfs)
160 $(ROOTUSRSBINCLRI): $(ROOTUSRSBIN)/clri
161 -$(RM) $@; $(SYMLINK) ./clri $@
163 $(MNTTAB):
164 touch $(MNTTAB)
166 fs.dfl:
167 $(RM) $@; $(ECHO) "LOCAL=ufs" >$@
169 # Multiple names for ff (ncheck)
170 $(ROOTUSRSBINFF): $(ROOTUSRSBIN)/ff
171 -$(RM) $@; $(SYMLINK) ./ff $@
173 clean: $(SUBDIRS) .WAIT clean_local
174 clean_local:
175 $(RM) $(CLEANFILES)
177 clobber: $(SUBDIRS) .WAIT clobber_local
178 clobber_local: clean_local
179 $(RM) $(PROG) $(ROOTFS_PROG) $(SPPROG) $(MNTTAB) $(DEFAULTFILES) \
180 $(CLOBBERFILES)
183 $(SUBDIRS): FRC
184 @cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET)
186 FRC: