xref: /titanic_50/usr/src/cmd/fs.d/Makefile (revision 3906e0c22bea9bf690c20f62b0575c1b1d0ace2e)
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 2006 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 autofs mntfs objfs
49i386_SUBDIRS= xmemfs
50i386_I18NDIRS= xmemfs
51SUBDIRS= $(SUBDIR1) $(SUBDIR2) $($(MACH)_SUBDIRS)
52ALL_SUBDIRS= $(SUBDIR1) $(SUBDIR2) $(i386_SUBDIRS)
53I18NDIRS= $(SUBDIR2) $(i386_I18NDIRS)
54
55CLOBBERFILES += $(POFILES_XPG4)
56
57all:=		TARGET= all
58install:=	TARGET= install
59clean:=		TARGET= clean
60clobber:=	TARGET= clobber
61lint:=		TARGET= lint
62_msg:=          TARGET= catalog
63
64USRSBINF=	df clri fsck volcopy ff
65USRSBINCLRI=	dcopy fsdb fssnap labelit mkfs
66USRSBINFF=	ncheck
67
68ETC2SBIN=	mount umount
69ETC2USRSBIN=	clri fsdb mkfs fsck labelit dcopy volcopy ff ncheck
70USRBIN2USRSBIN=	df
71
72FSLIB=		fslib.o
73
74ROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
75ROOTUSRSBINLINKS = $(ROOTFS_PROG:%=$(ROOTUSRSBIN)/%)
76
77ROOTUSRSBINF=		$(USRSBINF:%=$(ROOTUSRSBIN)/%)
78ROOTUSRSBINCLRI=	$(USRSBINCLRI:%=$(ROOTUSRSBIN)/%)
79ROOTUSRSBINFF=		$(USRSBINFF:%=$(ROOTUSRSBIN)/%)
80ROOTETCMNTTAB=		$(MNTTAB:%=$(ROOTETC)/%)
81SYMETC2SBIN	=	$(ETC2SBIN:%=$(ROOTETC)/%)
82SYMETC2USRSBIN	=	$(ETC2USRSBIN:%=$(ROOTETC)/%)
83SYMUSRBIN2USRSBIN=	$(USRBIN2USRSBIN:%=$(ROOTBIN)/%)
84SYMDEVNM=		$(ROOTUSRSBIN)/devnm
85
86# This flag is being added only for SCO (x86) compatibility
87df.o := CFLAGS += $(iBCS2FLAG)
88
89CPPFLAGS += -D_LARGEFILE64_SOURCE
90%.xpg4.o := CPPFLAGS += -DXPG4
91$(SPPROG) :=	LDLIBS += -lkstat
92
93$(ROOTETCMNTTAB) := FILEMODE = 444
94$(ROOTETCMNTTAB) := OWNER = root
95$(ROOTETCMNTTAB) := GROUP = root
96
97# for messaging catalog
98#
99POFILE= fs.d.po
100POFILES1= $(PROG:%=%.po) $(ROOTFS_PROG:%=%.po) switchout.po fssnapsup.po
101POFILES2= $(I18NDIRS:%=%/%.po)
102POFILES_XPG4 = df.po.xpg4
103POFILES=  $(POFILES1) $(POFILES2) $(POFILES_XPG4)
104$(POFILES_XPG4) := CFLAGS += -DXPG4
105volcopy.po :=   XGETFLAGS += -a -x volcopy.xcl
106$(POFILES_XPG4) :=	XGETFLAGS += -a -x df.xcl
107$(DFPROG).po := XGETFLAGS += -a -x df.xcl
108
109%.po.xpg4:	%.c
110	$(COMPILE.cpp) $< > $<.i
111	$(BUILD.po)
112
113# build rule for xpg4 objects
114%.xpg4.o: %.c
115	$(COMPILE.c) -o $@ $<
116
117.KEEP_STATE:
118
119# This is too intense when building the whole world.
120# .PARALLEL:	$(SUBDIRS)
121
122all:		$(FSLIB) .WAIT $(SUBDIRS) .WAIT all_local
123
124_msg: $(I18NDIRS) $(POFILES1) $(POFILES_XPG4)
125	$(RM) $(POFILE)
126	cat $(POFILES) > $(POFILE)
127	$(RM) $(MSGDOMAIN)/$(POFILE)
128	cp $(POFILE) $(MSGDOMAIN)
129
130all_local:	$(PROG) $(ROOTFS_PROG) $(XPG4PROG) $(SPPROG) $(MNTTAB) \
131		$(DEFAULTFILES)
132
133ff volcopy: deffs.o $$(@F).o
134		$(LINK.c) -o $@ $@.o deffs.o $(LDLIBS)
135		$(POST_PROCESS)
136
137df df.xpg4: deffs.o $(FSLIB) $$(@F).o
138		$(LINK.c) -o $@ $@.o deffs.o $(FSLIB) $(LDLIBS)
139		$(POST_PROCESS)
140
141fsck: fsck.o deffs.o preenlib.o
142	$(LINK.c) -o $@ fsck.o deffs.o preenlib.o $(LDLIBS)
143	$(POST_PROCESS)
144
145mount: deffs.o mount.o $(FSLIB)
146	$(LINK.c) -o $@ mount.o deffs.o $(FSLIB) $(LDLIBS)
147	$(POST_PROCESS)
148
149umount: umount.o $(FSLIB)
150	$(LINK.c) -o $@ umount.o $(FSLIB) $(LDLIBS)
151	$(POST_PROCESS)
152
153$(SPPROG):	switchout.o deffs.o fssnapsup.o
154	$(LINK.c) -o $@ switchout.o deffs.o fssnapsup.o $(LDLIBS) -ldiskmgt
155	$(POST_PROCESS)
156
157install: $(FSLIB) .WAIT $(SUBDIRS) .WAIT install_local
158
159install_local:	all_local $(ROOTSBINPROG) $(ROOTUSRSBINF) $(ROOTUSRSBINCLRI) \
160		$(ROOTUSRSBINFF) $(ROOTETCMNTTAB) $(ROOTETCDEFAULTFILES) \
161		$(ROOTXPG4PROG) $(SYMETC2SBIN) $(SYMETC2USRSBIN) \
162		$(SYMUSRBIN2USRSBIN) $(SYMDEVNM) $(ROOTUSRSBINLINKS)
163
164# Links from /etc to /sbin such as /etc/mount -> ../sbin/mount
165$(SYMETC2SBIN):
166	-$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
167
168# Links from /etc to /usr/sbin such as /etc/clri -> ../usr/sbin/clri
169$(SYMETC2USRSBIN):
170	-$(RM) $@; $(SYMLINK) ../usr/sbin/$(@F) $@
171
172# Links from /usr/bin to /usr/sbin such as /usr/bin/df -> ../sbin/df
173$(SYMUSRBIN2USRSBIN):
174	-$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
175
176# Links from /usr/sbin to /sbin such as /usr/sbin/mount -> ../../sbin/mount
177$(ROOTUSRSBINLINKS):
178	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
179
180# Symlink from devnm to df in /usr/sbin
181$(SYMDEVNM):
182	-$(RM) $@; $(SYMLINK) ./df $@
183
184# Multiple names for switchout (clri, dcopy, fsdb, labelit, mkfs)
185$(ROOTUSRSBINCLRI):	$(ROOTUSRSBIN)/clri
186	-$(RM) $@; $(SYMLINK) ./clri $@
187
188$(MNTTAB):
189	touch $(MNTTAB)
190
191fs.dfl:
192	$(RM) $@; $(ECHO) "LOCAL=ufs" >$@
193
194# Multiple names for ff (ncheck)
195$(ROOTUSRSBINFF):	$(ROOTUSRSBIN)/ff
196	-$(RM) $@; $(SYMLINK) ./ff $@
197
198clean: $(ALL_SUBDIRS) .WAIT clean_local
199
200clean_local:
201
202clobber: $(ALL_SUBDIRS) .WAIT clobber_local
203
204clobber_local:	clean_local
205	$(RM) $(PROG) $(ROOTFS_PROG) $(SPPROG) $(MNTTAB) $(DEFAULTFILES) \
206	$(CLOBBERFILES)
207
208lint:
209
210$(ALL_SUBDIRS): FRC
211	@cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET)
212
213FRC:
214