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