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