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