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