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