xref: /titanic_41/usr/src/cmd/fs.d/Makefile (revision e0724c534a46ca4754330bc022bf1e2a68f5bb93)
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
35XPG4PROG=	df
36SPPROG=		clri
37MNTTAB=		mnttab
38DEFAULTFILES=	fs.dfl
39
40include ../Makefile.cmd
41
42SUBDIR1= lofs zfs
43SUBDIR2= dev fd pcfs nfs hsfs proc ctfs udfs ufs tmpfs cachefs \
44		autofs mntfs objfs sharefs smbclnt reparsed
45SUBDIRS= $(SUBDIR1) $(SUBDIR2)
46I18NDIRS= $(SUBDIR2)
47
48CLOBBERFILES += $(POFILES_XPG4)
49
50all:=		TARGET= all
51install:=	TARGET= install
52clean:=		TARGET= clean
53clobber:=	TARGET= clobber
54lint:=		TARGET= lint
55_msg:=          TARGET= catalog
56
57USRSBINF=	df clri fsck volcopy ff
58USRSBINCLRI=	dcopy fsdb fssnap labelit mkfs
59USRSBINFF=	ncheck
60
61ETC2SBIN=	mount umount
62ETC2USRSBIN=	clri fsdb mkfs fsck labelit dcopy volcopy ff ncheck
63USRBIN2USRSBIN=	df
64
65FSLIB=		fslib.o
66
67ROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
68ROOTUSRSBINLINKS = $(ROOTFS_PROG:%=$(ROOTUSRSBIN)/%)
69
70ROOTUSRSBINF=		$(USRSBINF:%=$(ROOTUSRSBIN)/%)
71ROOTUSRSBINCLRI=	$(USRSBINCLRI:%=$(ROOTUSRSBIN)/%)
72ROOTUSRSBINFF=		$(USRSBINFF:%=$(ROOTUSRSBIN)/%)
73ROOTETCMNTTAB=		$(MNTTAB:%=$(ROOTETC)/%)
74SYMETC2SBIN	=	$(ETC2SBIN:%=$(ROOTETC)/%)
75SYMETC2USRSBIN	=	$(ETC2USRSBIN:%=$(ROOTETC)/%)
76SYMUSRBIN2USRSBIN=	$(USRBIN2USRSBIN:%=$(ROOTBIN)/%)
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%.xpg4.o := CPPFLAGS += -DXPG4
88$(SPPROG) :=	LDLIBS += -lkstat
89
90$(ROOTETCMNTTAB) := FILEMODE = 444
91
92# for messaging catalog
93#
94POFILE= fs.d.po
95POFILES1= $(PROG:%=%.po) $(ROOTFS_PROG:%=%.po) switchout.po fssnapsup.po
96POFILES2= $(I18NDIRS:%=%/%.po)
97POFILES_XPG4 = df.po.xpg4
98POFILES=  $(POFILES1) $(POFILES2) $(POFILES_XPG4)
99$(POFILES_XPG4) := CFLAGS += -DXPG4
100volcopy.po :=   XGETFLAGS += -a -x volcopy.xcl
101$(POFILES_XPG4) :=	XGETFLAGS += -a -x df.xcl
102$(DFPROG).po := XGETFLAGS += -a -x df.xcl
103
104%.po.xpg4:	%.c
105	$(COMPILE.cpp) $< > $<.i
106	$(BUILD.po)
107
108# build rule for xpg4 objects
109%.xpg4.o: %.c
110	$(COMPILE.c) -o $@ $<
111
112.KEEP_STATE:
113
114# This is too intense when building the whole world.
115# .PARALLEL:	$(SUBDIRS)
116
117all:		$(FSLIB) .WAIT $(SUBDIRS) .WAIT all_local
118
119_msg: $(I18NDIRS) $(POFILES1) $(POFILES_XPG4)
120	$(RM) $(POFILE)
121	cat $(POFILES) > $(POFILE)
122	$(RM) $(MSGDOMAIN)/$(POFILE)
123	cp $(POFILE) $(MSGDOMAIN)
124
125all_local:	$(PROG) $(ROOTFS_PROG) $(XPG4PROG) $(SPPROG) $(MNTTAB) \
126		$(DEFAULTFILES)
127
128ff volcopy: deffs.o $$(@F).o
129		$(LINK.c) -o $@ $@.o deffs.o $(LDLIBS)
130		$(POST_PROCESS)
131
132df df.xpg4: deffs.o $(FSLIB) $$(@F).o
133		$(LINK.c) -o $@ $@.o deffs.o $(FSLIB) $(LDLIBS)
134		$(POST_PROCESS)
135
136fsck: fsck.o deffs.o preenlib.o
137	$(LINK.c) -o $@ fsck.o deffs.o preenlib.o $(LDLIBS)
138	$(POST_PROCESS)
139
140mount: deffs.o mount.o $(FSLIB)
141	$(LINK.c) -o $@ mount.o deffs.o $(FSLIB) $(LDLIBS)
142	$(POST_PROCESS)
143
144umount: umount.o $(FSLIB)
145	$(LINK.c) -o $@ umount.o $(FSLIB) $(LDLIBS)
146	$(POST_PROCESS)
147
148$(SPPROG):	switchout.o deffs.o fssnapsup.o
149	$(LINK.c) -o $@ switchout.o deffs.o fssnapsup.o $(LDLIBS) -ldiskmgt
150	$(POST_PROCESS)
151
152install: $(FSLIB) .WAIT $(SUBDIRS) .WAIT install_local
153
154install_local:	all_local $(ROOTSBINPROG) $(ROOTUSRSBINF) $(ROOTUSRSBINCLRI) \
155		$(ROOTUSRSBINFF) $(ROOTETCMNTTAB) $(ROOTETCDEFAULTFILES) \
156		$(ROOTXPG4PROG) $(SYMETC2SBIN) $(SYMETC2USRSBIN) \
157		$(SYMUSRBIN2USRSBIN) $(SYMDEVNM) $(ROOTUSRSBINLINKS)
158
159# Links from /etc to /sbin such as /etc/mount -> ../sbin/mount
160$(SYMETC2SBIN):
161	-$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
162
163# Links from /etc to /usr/sbin such as /etc/clri -> ../usr/sbin/clri
164$(SYMETC2USRSBIN):
165	-$(RM) $@; $(SYMLINK) ../usr/sbin/$(@F) $@
166
167# Links from /usr/bin to /usr/sbin such as /usr/bin/df -> ../sbin/df
168$(SYMUSRBIN2USRSBIN):
169	-$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
170
171# Links from /usr/sbin to /sbin such as /usr/sbin/mount -> ../../sbin/mount
172$(ROOTUSRSBINLINKS):
173	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
174
175# Symlink from devnm to df in /usr/sbin
176$(SYMDEVNM):
177	-$(RM) $@; $(SYMLINK) ./df $@
178
179# Multiple names for switchout (clri, dcopy, fsdb, labelit, mkfs)
180$(ROOTUSRSBINCLRI):	$(ROOTUSRSBIN)/clri
181	-$(RM) $@; $(SYMLINK) ./clri $@
182
183$(MNTTAB):
184	touch $(MNTTAB)
185
186fs.dfl:
187	$(RM) $@; $(ECHO) "LOCAL=ufs" >$@
188
189# Multiple names for ff (ncheck)
190$(ROOTUSRSBINFF):	$(ROOTUSRSBIN)/ff
191	-$(RM) $@; $(SYMLINK) ./ff $@
192
193clean: $(SUBDIRS) .WAIT clean_local
194
195clean_local:
196
197clobber: $(SUBDIRS) .WAIT clobber_local
198
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