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