xref: /illumos-gate/usr/src/cmd/fs.d/Makefile (revision a787240632bcb1404b9fd4583516b875d3f02c8b)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate# with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
227c478bd9Sstevel@tonic-gate#
23*a7872406Smeem# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate#
287c478bd9Sstevel@tonic-gate# cmd/fs.d/Makefile
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate# The filesystem independent utilities clri, fsdb, dcopy, labelit, and mkfs
317c478bd9Sstevel@tonic-gate# are all built from the source file switchout.c. They are all then links
327c478bd9Sstevel@tonic-gate# to the same object. This is accomplished by:
337c478bd9Sstevel@tonic-gate#	1) building clri from switchout.c (had to choose one)
347c478bd9Sstevel@tonic-gate#	2) installing it in the target directory
357c478bd9Sstevel@tonic-gate#	3) linking the others to clri.
367c478bd9Sstevel@tonic-gate# In a similar manner, ncheck is linked to ff.
377c478bd9Sstevel@tonic-gate
387c478bd9Sstevel@tonic-gateDFPROG=		df
397c478bd9Sstevel@tonic-gatePROG=		$(DFPROG) fsck volcopy ff
407c478bd9Sstevel@tonic-gateROOTFS_PROG=	mount umount
417c478bd9Sstevel@tonic-gateXPG4PROG=	df
427c478bd9Sstevel@tonic-gateSPPROG=		clri
437c478bd9Sstevel@tonic-gateMNTTAB=		mnttab
44*a7872406SmeemDEFAULTFILES=	fs.dfl
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gateinclude ../Makefile.cmd
477c478bd9Sstevel@tonic-gate
487c478bd9Sstevel@tonic-gateSUBDIR1= lofs
497c478bd9Sstevel@tonic-gateSUBDIR2= fd pcfs nfs hsfs proc ctfs udfs ufs tmpfs cachefs autofs mntfs objfs
507c478bd9Sstevel@tonic-gatei386_SUBDIRS= xmemfs
517c478bd9Sstevel@tonic-gatei386_I18NDIRS= xmemfs
527c478bd9Sstevel@tonic-gateSUBDIRS= $(SUBDIR1) $(SUBDIR2) $($(MACH)_SUBDIRS)
537c478bd9Sstevel@tonic-gateALL_SUBDIRS= $(SUBDIR1) $(SUBDIR2) $(i386_SUBDIRS)
547c478bd9Sstevel@tonic-gateI18NDIRS= $(SUBDIR2) $(i386_I18NDIRS)
557c478bd9Sstevel@tonic-gate
567c478bd9Sstevel@tonic-gateCLOBBERFILES += $(POFILES_XPG4)
577c478bd9Sstevel@tonic-gate
587c478bd9Sstevel@tonic-gateall:=		TARGET= all
597c478bd9Sstevel@tonic-gateinstall:=	TARGET= install
607c478bd9Sstevel@tonic-gateclean:=		TARGET= clean
617c478bd9Sstevel@tonic-gateclobber:=	TARGET= clobber
627c478bd9Sstevel@tonic-gatelint:=		TARGET= lint
637c478bd9Sstevel@tonic-gate_msg:=          TARGET= catalog
647c478bd9Sstevel@tonic-gate
657c478bd9Sstevel@tonic-gateUSRSBINF=	df clri fsck volcopy ff
667c478bd9Sstevel@tonic-gateUSRSBINCLRI=	dcopy fsdb fssnap labelit mkfs
677c478bd9Sstevel@tonic-gateUSRSBINFF=	ncheck
687c478bd9Sstevel@tonic-gate
697c478bd9Sstevel@tonic-gateETC2SBIN=	mount umount
707c478bd9Sstevel@tonic-gateETC2USRSBIN=	clri fsdb mkfs fsck labelit dcopy volcopy ff ncheck
717c478bd9Sstevel@tonic-gateUSRBIN2USRSBIN=	df
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gateFSLIB=		fslib.o
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gateROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
767c478bd9Sstevel@tonic-gateROOTUSRSBINLINKS = $(ROOTFS_PROG:%=$(ROOTUSRSBIN)/%)
777c478bd9Sstevel@tonic-gate
787c478bd9Sstevel@tonic-gateROOTUSRSBINF=		$(USRSBINF:%=$(ROOTUSRSBIN)/%)
797c478bd9Sstevel@tonic-gateROOTUSRSBINCLRI=	$(USRSBINCLRI:%=$(ROOTUSRSBIN)/%)
807c478bd9Sstevel@tonic-gateROOTUSRSBINFF=		$(USRSBINFF:%=$(ROOTUSRSBIN)/%)
817c478bd9Sstevel@tonic-gateROOTETCMNTTAB=		$(MNTTAB:%=$(ROOTETC)/%)
827c478bd9Sstevel@tonic-gateSYMETC2SBIN	=	$(ETC2SBIN:%=$(ROOTETC)/%)
837c478bd9Sstevel@tonic-gateSYMETC2USRSBIN	=	$(ETC2USRSBIN:%=$(ROOTETC)/%)
847c478bd9Sstevel@tonic-gateSYMUSRBIN2USRSBIN=	$(USRBIN2USRSBIN:%=$(ROOTBIN)/%)
857c478bd9Sstevel@tonic-gateSYMDEVNM=		$(ROOTUSRSBIN)/devnm
867c478bd9Sstevel@tonic-gate
877c478bd9Sstevel@tonic-gate# This flag is being added only for SCO (x86) compatibility
887c478bd9Sstevel@tonic-gatedf.o := CFLAGS += $(iBCS2FLAG)
897c478bd9Sstevel@tonic-gate
907c478bd9Sstevel@tonic-gateCPPFLAGS += -D_LARGEFILE64_SOURCE
917c478bd9Sstevel@tonic-gate%.xpg4.o := CPPFLAGS += -DXPG4
927c478bd9Sstevel@tonic-gate$(XPG4) df ff fsck mount volcopy := LDLIBS += -lcmd
937c478bd9Sstevel@tonic-gate$(SPPROG) :=	LDLIBS += -lcmd -lkstat
947c478bd9Sstevel@tonic-gate
957c478bd9Sstevel@tonic-gate$(ROOTETCMNTTAB) := FILEMODE = 444
967c478bd9Sstevel@tonic-gate$(ROOTETCMNTTAB) := OWNER = root
977c478bd9Sstevel@tonic-gate$(ROOTETCMNTTAB) := GROUP = root
987c478bd9Sstevel@tonic-gate
997c478bd9Sstevel@tonic-gate# for messaging catalog
1007c478bd9Sstevel@tonic-gate#
1017c478bd9Sstevel@tonic-gatePOFILE= fs.d.po
1027c478bd9Sstevel@tonic-gatePOFILES1= $(PROG:%=%.po) $(ROOTFS_PROG:%=%.po) switchout.po fssnapsup.po
1037c478bd9Sstevel@tonic-gatePOFILES2= $(I18NDIRS:%=%/%.po)
1047c478bd9Sstevel@tonic-gatePOFILES_XPG4 = df.po.xpg4
1057c478bd9Sstevel@tonic-gatePOFILES=  $(POFILES1) $(POFILES2) $(POFILES_XPG4)
1067c478bd9Sstevel@tonic-gate$(POFILES_XPG4) := CFLAGS += -DXPG4
1077c478bd9Sstevel@tonic-gatevolcopy.po :=   XGETFLAGS += -a -x volcopy.xcl
1087c478bd9Sstevel@tonic-gate$(POFILES_XPG4) :=	XGETFLAGS += -a -x df.xcl
1097c478bd9Sstevel@tonic-gate$(DFPROG).po := XGETFLAGS += -a -x df.xcl
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gate%.po.xpg4:	%.c
1127c478bd9Sstevel@tonic-gate	$(COMPILE.cpp) $< > $<.i
1137c478bd9Sstevel@tonic-gate	$(BUILD.po)
1147c478bd9Sstevel@tonic-gate
1157c478bd9Sstevel@tonic-gate# build rule for xpg4 objects
1167c478bd9Sstevel@tonic-gate%.xpg4.o: %.c
1177c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1187c478bd9Sstevel@tonic-gate
1197c478bd9Sstevel@tonic-gate.KEEP_STATE:
1207c478bd9Sstevel@tonic-gate
1217c478bd9Sstevel@tonic-gate# This is too intense when building the whole world.
1227c478bd9Sstevel@tonic-gate# .PARALLEL:	$(SUBDIRS)
1237c478bd9Sstevel@tonic-gate
1247c478bd9Sstevel@tonic-gateall:		$(FSLIB) .WAIT $(SUBDIRS) .WAIT all_local
1257c478bd9Sstevel@tonic-gate
1267c478bd9Sstevel@tonic-gate_msg: $(I18NDIRS) $(POFILES1) $(POFILES_XPG4)
1277c478bd9Sstevel@tonic-gate	$(RM) $(POFILE)
1287c478bd9Sstevel@tonic-gate	cat $(POFILES) > $(POFILE)
1297c478bd9Sstevel@tonic-gate	$(RM) $(MSGDOMAIN)/$(POFILE)
1307c478bd9Sstevel@tonic-gate	cp $(POFILE) $(MSGDOMAIN)
1317c478bd9Sstevel@tonic-gate
132*a7872406Smeemall_local:	$(PROG) $(ROOTFS_PROG) $(XPG4PROG) $(SPPROG) $(MNTTAB) \
133*a7872406Smeem		$(DEFAULTFILES)
1347c478bd9Sstevel@tonic-gate
1357c478bd9Sstevel@tonic-gateff volcopy: deffs.o $$(@F).o
1367c478bd9Sstevel@tonic-gate		$(LINK.c) -o $@ $@.o deffs.o $(LDLIBS)
1377c478bd9Sstevel@tonic-gate		$(POST_PROCESS)
1387c478bd9Sstevel@tonic-gate
1397c478bd9Sstevel@tonic-gatedf df.xpg4: deffs.o $(FSLIB) $$(@F).o
1407c478bd9Sstevel@tonic-gate		$(LINK.c) -o $@ $@.o deffs.o $(FSLIB) $(LDLIBS)
1417c478bd9Sstevel@tonic-gate		$(POST_PROCESS)
1427c478bd9Sstevel@tonic-gate
1437c478bd9Sstevel@tonic-gatefsck: fsck.o deffs.o preenlib.o
1447c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ fsck.o deffs.o preenlib.o $(LDLIBS)
1457c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1467c478bd9Sstevel@tonic-gate
1477c478bd9Sstevel@tonic-gatemount: deffs.o mount.o $(FSLIB)
1487c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ mount.o deffs.o $(FSLIB) $(LDLIBS)
1497c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1507c478bd9Sstevel@tonic-gate
1517c478bd9Sstevel@tonic-gateumount: umount.o $(FSLIB)
1527c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ umount.o $(FSLIB) $(LDLIBS)
1537c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1547c478bd9Sstevel@tonic-gate
1557c478bd9Sstevel@tonic-gate$(SPPROG):	switchout.o deffs.o fssnapsup.o
1567c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ switchout.o deffs.o fssnapsup.o $(LDLIBS)
1577c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1587c478bd9Sstevel@tonic-gate
1597c478bd9Sstevel@tonic-gateinstall: $(FSLIB) .WAIT $(SUBDIRS) .WAIT install_local
1607c478bd9Sstevel@tonic-gate
1617c478bd9Sstevel@tonic-gateinstall_local:	all_local $(ROOTSBINPROG) $(ROOTUSRSBINF) $(ROOTUSRSBINCLRI) \
162*a7872406Smeem		$(ROOTUSRSBINFF) $(ROOTETCMNTTAB) $(ROOTETCDEFAULTFILES) \
1637c478bd9Sstevel@tonic-gate		$(ROOTXPG4PROG) $(SYMETC2SBIN) $(SYMETC2USRSBIN) \
1647c478bd9Sstevel@tonic-gate		$(SYMUSRBIN2USRSBIN) $(SYMDEVNM) $(ROOTUSRSBINLINKS)
1657c478bd9Sstevel@tonic-gate
1667c478bd9Sstevel@tonic-gate# Links from /etc to /sbin such as /etc/mount -> ../sbin/mount
1677c478bd9Sstevel@tonic-gate$(SYMETC2SBIN):
1687c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
1697c478bd9Sstevel@tonic-gate
1707c478bd9Sstevel@tonic-gate# Links from /etc to /usr/sbin such as /etc/clri -> ../usr/sbin/clri
1717c478bd9Sstevel@tonic-gate$(SYMETC2USRSBIN):
1727c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ../usr/sbin/$(@F) $@
1737c478bd9Sstevel@tonic-gate
1747c478bd9Sstevel@tonic-gate# Links from /usr/bin to /usr/sbin such as /usr/bin/df -> ../sbin/df
1757c478bd9Sstevel@tonic-gate$(SYMUSRBIN2USRSBIN):
1767c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
1777c478bd9Sstevel@tonic-gate
1787c478bd9Sstevel@tonic-gate# Links from /usr/sbin to /sbin such as /usr/sbin/mount -> ../../sbin/mount
1797c478bd9Sstevel@tonic-gate$(ROOTUSRSBINLINKS):
1807c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
1817c478bd9Sstevel@tonic-gate
1827c478bd9Sstevel@tonic-gate# Symlink from devnm to df in /usr/sbin
1837c478bd9Sstevel@tonic-gate$(SYMDEVNM):
1847c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ./df $@
1857c478bd9Sstevel@tonic-gate
1867c478bd9Sstevel@tonic-gate# Multiple names for switchout (clri, dcopy, fsdb, labelit, mkfs)
1877c478bd9Sstevel@tonic-gate$(ROOTUSRSBINCLRI):	$(ROOTUSRSBIN)/clri
1887c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ./clri $@
1897c478bd9Sstevel@tonic-gate
1907c478bd9Sstevel@tonic-gate$(MNTTAB):
1917c478bd9Sstevel@tonic-gate	touch $(MNTTAB)
1927c478bd9Sstevel@tonic-gate
193*a7872406Smeemfs.dfl:
194*a7872406Smeem	$(RM) $@; $(ECHO) "LOCAL=ufs" >$@
1957c478bd9Sstevel@tonic-gate
1967c478bd9Sstevel@tonic-gate# Multiple names for ff (ncheck)
1977c478bd9Sstevel@tonic-gate$(ROOTUSRSBINFF):	$(ROOTUSRSBIN)/ff
1987c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ./ff $@
1997c478bd9Sstevel@tonic-gate
2007c478bd9Sstevel@tonic-gateclean: $(ALL_SUBDIRS) .WAIT clean_local
2017c478bd9Sstevel@tonic-gate
2027c478bd9Sstevel@tonic-gateclean_local:
2037c478bd9Sstevel@tonic-gate
2047c478bd9Sstevel@tonic-gateclobber: $(ALL_SUBDIRS) .WAIT clobber_local
2057c478bd9Sstevel@tonic-gate
2067c478bd9Sstevel@tonic-gateclobber_local:	clean_local
207*a7872406Smeem	$(RM) $(PROG) $(ROOTFS_PROG) $(SPPROG) $(MNTTAB) $(DEFAULTFILES) \
208*a7872406Smeem	$(CLOBBERFILES)
2097c478bd9Sstevel@tonic-gate
2107c478bd9Sstevel@tonic-gatelint:
2117c478bd9Sstevel@tonic-gate
2127c478bd9Sstevel@tonic-gate$(ALL_SUBDIRS): FRC
2137c478bd9Sstevel@tonic-gate	@cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET)
2147c478bd9Sstevel@tonic-gate
2157c478bd9Sstevel@tonic-gateFRC:
216