xref: /titanic_52/usr/src/cmd/fs.d/Makefile (revision 6a1af1a67532df169a657cce07140be64bdea084)
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%.xpg4.o := CPPFLAGS += -DXPG4
81$(SPPROG) :=	LDLIBS += -lkstat
82
83$(ROOTETCMNTTAB) := FILEMODE = 444
84
85# for messaging catalog
86#
87POFILE= fs.d.po
88POFILES1= $(PROG:%=%.po) $(ROOTFS_PROG:%=%.po) switchout.po fssnapsup.po
89POFILES2= $(I18NDIRS:%=%/%.po)
90POFILES_XPG4 = df.po.xpg4
91POFILES=  $(POFILES1) $(POFILES2) $(POFILES_XPG4)
92$(POFILES_XPG4) := CFLAGS += -DXPG4
93volcopy.po :=   XGETFLAGS += -a -x volcopy.xcl
94$(POFILES_XPG4) :=	XGETFLAGS += -a -x df.xcl
95$(DFPROG).po := XGETFLAGS += -a -x df.xcl
96
97%.po.xpg4:	%.c
98	$(COMPILE.cpp) $< > $<.i
99	$(BUILD.po)
100
101# build rule for xpg4 objects
102%.xpg4.o: %.c
103	$(COMPILE.c) -o $@ $<
104
105.KEEP_STATE:
106
107# This is too intense when building the whole world.
108# .PARALLEL:	$(SUBDIRS)
109
110all:		$(FSLIB) .WAIT $(SUBDIRS) .WAIT all_local
111
112_msg: $(I18NDIRS) $(POFILES1) $(POFILES_XPG4)
113	$(RM) $(POFILE)
114	cat $(POFILES) > $(POFILE)
115	$(RM) $(MSGDOMAIN)/$(POFILE)
116	cp $(POFILE) $(MSGDOMAIN)
117
118all_local:	$(PROG) $(ROOTFS_PROG) $(XPG4PROG) $(SPPROG) $(MNTTAB) \
119		$(DEFAULTFILES)
120
121ff volcopy: deffs.o $$(@F).o
122		$(LINK.c) -o $@ $@.o deffs.o $(LDLIBS)
123		$(POST_PROCESS)
124
125df df.xpg4: deffs.o $(FSLIB) $$(@F).o
126		$(LINK.c) -o $@ $@.o deffs.o $(FSLIB) $(LDLIBS)
127		$(POST_PROCESS)
128
129fsck: fsck.o deffs.o preenlib.o
130	$(LINK.c) -o $@ fsck.o deffs.o preenlib.o $(LDLIBS)
131	$(POST_PROCESS)
132
133mount: deffs.o mount.o $(FSLIB)
134	$(LINK.c) -o $@ mount.o deffs.o $(FSLIB) $(LDLIBS)
135	$(POST_PROCESS)
136
137umount: umount.o $(FSLIB)
138	$(LINK.c) -o $@ umount.o $(FSLIB) $(LDLIBS)
139	$(POST_PROCESS)
140
141$(SPPROG):	switchout.o deffs.o fssnapsup.o
142	$(LINK.c) -o $@ switchout.o deffs.o fssnapsup.o $(LDLIBS) -ldiskmgt
143	$(POST_PROCESS)
144
145install: $(FSLIB) .WAIT $(SUBDIRS) .WAIT install_local
146
147install_local:	all_local $(ROOTSBINPROG) $(ROOTUSRSBINF) $(ROOTUSRSBINCLRI) \
148		$(ROOTUSRSBINFF) $(ROOTETCMNTTAB) $(ROOTETCDEFAULTFILES) \
149		$(ROOTXPG4PROG) $(SYMETC2SBIN) $(SYMETC2USRSBIN) \
150		$(SYMUSRBIN2USRSBIN) $(SYMDEVNM) $(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/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