xref: /illumos-gate/usr/src/cmd/fs.d/Makefile (revision a5f20e89)
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
50e42dee6Sartem# Common Development and Distribution License (the "License").
60e42dee6Sartem# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
21cc22b130SRich Burridge# Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
225661bb76SJohn Levon# Copyright (c) 2018, Joyent, Inc.
23bd93c05dSAlexander Eremin# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gate# The filesystem independent utilities clri, fsdb, dcopy, labelit, and mkfs
277c478bd9Sstevel@tonic-gate# are all built from the source file switchout.c. They are all then links
287c478bd9Sstevel@tonic-gate# to the same object. This is accomplished by:
297c478bd9Sstevel@tonic-gate#	1) building clri from switchout.c (had to choose one)
307c478bd9Sstevel@tonic-gate#	2) installing it in the target directory
317c478bd9Sstevel@tonic-gate#	3) linking the others to clri.
327c478bd9Sstevel@tonic-gate# In a similar manner, ncheck is linked to ff.
337c478bd9Sstevel@tonic-gate
347c478bd9Sstevel@tonic-gateDFPROG=		df
357c478bd9Sstevel@tonic-gatePROG=		$(DFPROG) fsck volcopy ff
367c478bd9Sstevel@tonic-gateROOTFS_PROG=	mount umount
377c478bd9Sstevel@tonic-gateSPPROG=		clri
387c478bd9Sstevel@tonic-gateMNTTAB=		mnttab
39a7872406SmeemDEFAULTFILES=	fs.dfl
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gateinclude ../Makefile.cmd
427c478bd9Sstevel@tonic-gate
4376ca3cb0SRobert MustacchiSUBDIR1= bootfs lofs zfs
44bd93c05dSAlexander EreminSUBDIR2= dev fd pcfs nfs hsfs proc ctfs udfs ufs tmpfs \
457a286c47SDai Ngo		autofs mntfs objfs sharefs smbclnt reparsed
464fceebdfSblakejSUBDIRS= $(SUBDIR1) $(SUBDIR2)
474fceebdfSblakejI18NDIRS= $(SUBDIR2)
487c478bd9Sstevel@tonic-gate
49b6805bf7SGordon RossCLEANFILES +=	deffs.o df.o ff.o fsck.o fssnapsup.o \
50b6805bf7SGordon Ross		mount.o preenlib.o switchout.o umount.o volcopy.o
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gateall:=		TARGET= all
537c478bd9Sstevel@tonic-gateinstall:=	TARGET= install
547c478bd9Sstevel@tonic-gateclean:=		TARGET= clean
557c478bd9Sstevel@tonic-gateclobber:=	TARGET= clobber
567c478bd9Sstevel@tonic-gate_msg:=          TARGET= catalog
577c478bd9Sstevel@tonic-gate
587c478bd9Sstevel@tonic-gateUSRSBINF=	df clri fsck volcopy ff
597c478bd9Sstevel@tonic-gateUSRSBINCLRI=	dcopy fsdb fssnap labelit mkfs
607c478bd9Sstevel@tonic-gateUSRSBINFF=	ncheck
617c478bd9Sstevel@tonic-gate
627c478bd9Sstevel@tonic-gateETC2SBIN=	mount umount
637c478bd9Sstevel@tonic-gateETC2USRSBIN=	clri fsdb mkfs fsck labelit dcopy volcopy ff ncheck
647c478bd9Sstevel@tonic-gateUSRBIN2USRSBIN=	df
6590a1a135SPaul B. HensonUSRXPG4BIN2USRSBIN= df
667c478bd9Sstevel@tonic-gate
677c478bd9Sstevel@tonic-gateFSLIB=		fslib.o
68544783caSToomas SoomeCLEANFILES +=	$(FSLIB)
697c478bd9Sstevel@tonic-gate
707c478bd9Sstevel@tonic-gateROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
717c478bd9Sstevel@tonic-gateROOTUSRSBINLINKS = $(ROOTFS_PROG:%=$(ROOTUSRSBIN)/%)
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gateROOTUSRSBINF=		$(USRSBINF:%=$(ROOTUSRSBIN)/%)
747c478bd9Sstevel@tonic-gateROOTUSRSBINCLRI=	$(USRSBINCLRI:%=$(ROOTUSRSBIN)/%)
757c478bd9Sstevel@tonic-gateROOTUSRSBINFF=		$(USRSBINFF:%=$(ROOTUSRSBIN)/%)
767c478bd9Sstevel@tonic-gateROOTETCMNTTAB=		$(MNTTAB:%=$(ROOTETC)/%)
777c478bd9Sstevel@tonic-gateSYMETC2SBIN	=	$(ETC2SBIN:%=$(ROOTETC)/%)
787c478bd9Sstevel@tonic-gateSYMETC2USRSBIN	=	$(ETC2USRSBIN:%=$(ROOTETC)/%)
797c478bd9Sstevel@tonic-gateSYMUSRBIN2USRSBIN=	$(USRBIN2USRSBIN:%=$(ROOTBIN)/%)
8090a1a135SPaul B. HensonSYMUSRXPG4BIN2USRSBIN=	$(USRXPG4BIN2USRSBIN:%=$(ROOTXPG4BIN)/%)
817c478bd9Sstevel@tonic-gateSYMDEVNM=		$(ROOTUSRSBIN)/devnm
827c478bd9Sstevel@tonic-gate
83*a5f20e89SToomas SoomeCSTD=	$(CSTD_GNU99)
847c478bd9Sstevel@tonic-gateCPPFLAGS += -D_LARGEFILE64_SOURCE
857014882cSRichard Lowe
867014882cSRichard LoweCERRWARN += -_gcc=-Wno-implicit-function-declaration
877014882cSRichard LoweCERRWARN += -_gcc=-Wno-parentheses
887014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-variable
89d3b5f563SJohn LevonCERRWARN += $(CNOWARN_UNINIT)
907014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-function
917014882cSRichard Lowe
925661bb76SJohn Levon# not linted
935661bb76SJohn LevonSMATCH=off
945661bb76SJohn Levon
950a055120SJason King$(DFPROG) :=	LDLIBS += -lcmdutils
9606e1a714Sraf$(SPPROG) :=	LDLIBS += -lkstat
977c478bd9Sstevel@tonic-gate
987c478bd9Sstevel@tonic-gate$(ROOTETCMNTTAB) := FILEMODE = 444
997c478bd9Sstevel@tonic-gate
1007c478bd9Sstevel@tonic-gate# for messaging catalog
1017c478bd9Sstevel@tonic-gate#
1027c478bd9Sstevel@tonic-gatePOFILE= fs.d.po
1037c478bd9Sstevel@tonic-gatePOFILES1= $(PROG:%=%.po) $(ROOTFS_PROG:%=%.po) switchout.po fssnapsup.po
1047c478bd9Sstevel@tonic-gatePOFILES2= $(I18NDIRS:%=%/%.po)
10590a1a135SPaul B. HensonPOFILES=  $(POFILES1) $(POFILES2)
1067c478bd9Sstevel@tonic-gatevolcopy.po :=   XGETFLAGS += -a -x volcopy.xcl
1077c478bd9Sstevel@tonic-gate$(DFPROG).po := XGETFLAGS += -a -x df.xcl
1087c478bd9Sstevel@tonic-gate
1097c478bd9Sstevel@tonic-gate.KEEP_STATE:
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gate# This is too intense when building the whole world.
1127c478bd9Sstevel@tonic-gate# .PARALLEL:	$(SUBDIRS)
1137c478bd9Sstevel@tonic-gate
1147c478bd9Sstevel@tonic-gateall:		$(FSLIB) .WAIT $(SUBDIRS) .WAIT all_local
1157c478bd9Sstevel@tonic-gate
11690a1a135SPaul B. Henson_msg: $(I18NDIRS) $(POFILES1)
1177c478bd9Sstevel@tonic-gate	$(RM) $(POFILE)
1187c478bd9Sstevel@tonic-gate	cat $(POFILES) > $(POFILE)
1197c478bd9Sstevel@tonic-gate	$(RM) $(MSGDOMAIN)/$(POFILE)
1207c478bd9Sstevel@tonic-gate	cp $(POFILE) $(MSGDOMAIN)
1217c478bd9Sstevel@tonic-gate
12290a1a135SPaul B. Hensonall_local:	$(PROG) $(ROOTFS_PROG) $(SPPROG) $(MNTTAB) \
123a7872406Smeem		$(DEFAULTFILES)
1247c478bd9Sstevel@tonic-gate
1257c478bd9Sstevel@tonic-gateff volcopy: deffs.o $$(@F).o
1267c478bd9Sstevel@tonic-gate		$(LINK.c) -o $@ $@.o deffs.o $(LDLIBS)
1277c478bd9Sstevel@tonic-gate		$(POST_PROCESS)
1287c478bd9Sstevel@tonic-gate
12990a1a135SPaul B. Hensondf: deffs.o $(FSLIB) $$(@F).o
13090a1a135SPaul B. Henson	$(LINK.c) -o $@ $@.o deffs.o $(FSLIB) $(LDLIBS)
13190a1a135SPaul B. Henson	$(POST_PROCESS)
1327c478bd9Sstevel@tonic-gate
1337c478bd9Sstevel@tonic-gatefsck: fsck.o deffs.o preenlib.o
1347c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ fsck.o deffs.o preenlib.o $(LDLIBS)
1357c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1367c478bd9Sstevel@tonic-gate
1377c478bd9Sstevel@tonic-gatemount: deffs.o mount.o $(FSLIB)
1387c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ mount.o deffs.o $(FSLIB) $(LDLIBS)
1397c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1407c478bd9Sstevel@tonic-gate
1417c478bd9Sstevel@tonic-gateumount: umount.o $(FSLIB)
1427c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ umount.o $(FSLIB) $(LDLIBS)
1437c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1447c478bd9Sstevel@tonic-gate
1457c478bd9Sstevel@tonic-gate$(SPPROG):	switchout.o deffs.o fssnapsup.o
1463e1bd7a2Ssjelinek	$(LINK.c) -o $@ switchout.o deffs.o fssnapsup.o $(LDLIBS) -ldiskmgt
1477c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1487c478bd9Sstevel@tonic-gate
1497c478bd9Sstevel@tonic-gateinstall: $(FSLIB) .WAIT $(SUBDIRS) .WAIT install_local
1507c478bd9Sstevel@tonic-gate
1517c478bd9Sstevel@tonic-gateinstall_local:	all_local $(ROOTSBINPROG) $(ROOTUSRSBINF) $(ROOTUSRSBINCLRI) \
152a7872406Smeem		$(ROOTUSRSBINFF) $(ROOTETCMNTTAB) $(ROOTETCDEFAULTFILES) \
15390a1a135SPaul B. Henson		$(SYMETC2SBIN) $(SYMETC2USRSBIN) \
15490a1a135SPaul B. Henson		$(SYMUSRBIN2USRSBIN) $(SYMUSRXPG4BIN2USRSBIN) $(SYMDEVNM) \
15590a1a135SPaul B. Henson		$(ROOTUSRSBINLINKS)
1567c478bd9Sstevel@tonic-gate
1577c478bd9Sstevel@tonic-gate# Links from /etc to /sbin such as /etc/mount -> ../sbin/mount
1587c478bd9Sstevel@tonic-gate$(SYMETC2SBIN):
1597c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
1607c478bd9Sstevel@tonic-gate
1617c478bd9Sstevel@tonic-gate# Links from /etc to /usr/sbin such as /etc/clri -> ../usr/sbin/clri
1627c478bd9Sstevel@tonic-gate$(SYMETC2USRSBIN):
1637c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ../usr/sbin/$(@F) $@
1647c478bd9Sstevel@tonic-gate
1657c478bd9Sstevel@tonic-gate# Links from /usr/bin to /usr/sbin such as /usr/bin/df -> ../sbin/df
1667c478bd9Sstevel@tonic-gate$(SYMUSRBIN2USRSBIN):
1677c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
1687c478bd9Sstevel@tonic-gate
16990a1a135SPaul B. Henson# Links from /usr/xpg4/bin to /usr/sbin such as /usr/xpg4/bin/df -> ../sbin/df
17090a1a135SPaul B. Henson$(SYMUSRXPG4BIN2USRSBIN):
17190a1a135SPaul B. Henson	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
17290a1a135SPaul B. Henson
1737c478bd9Sstevel@tonic-gate# Links from /usr/sbin to /sbin such as /usr/sbin/mount -> ../../sbin/mount
1747c478bd9Sstevel@tonic-gate$(ROOTUSRSBINLINKS):
1757c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
1767c478bd9Sstevel@tonic-gate
1777c478bd9Sstevel@tonic-gate# Symlink from devnm to df in /usr/sbin
1787c478bd9Sstevel@tonic-gate$(SYMDEVNM):
1797c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ./df $@
1807c478bd9Sstevel@tonic-gate
1817c478bd9Sstevel@tonic-gate# Multiple names for switchout (clri, dcopy, fsdb, labelit, mkfs)
1827c478bd9Sstevel@tonic-gate$(ROOTUSRSBINCLRI):	$(ROOTUSRSBIN)/clri
1837c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ./clri $@
1847c478bd9Sstevel@tonic-gate
1857c478bd9Sstevel@tonic-gate$(MNTTAB):
1867c478bd9Sstevel@tonic-gate	touch $(MNTTAB)
1877c478bd9Sstevel@tonic-gate
188a7872406Smeemfs.dfl:
189a7872406Smeem	$(RM) $@; $(ECHO) "LOCAL=ufs" >$@
1907c478bd9Sstevel@tonic-gate
1917c478bd9Sstevel@tonic-gate# Multiple names for ff (ncheck)
1927c478bd9Sstevel@tonic-gate$(ROOTUSRSBINFF):	$(ROOTUSRSBIN)/ff
1937c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) ./ff $@
1947c478bd9Sstevel@tonic-gate
1954fceebdfSblakejclean: $(SUBDIRS) .WAIT clean_local
1967c478bd9Sstevel@tonic-gateclean_local:
197b6805bf7SGordon Ross	$(RM) $(CLEANFILES)
1987c478bd9Sstevel@tonic-gate
1994fceebdfSblakejclobber: $(SUBDIRS) .WAIT clobber_local
2007c478bd9Sstevel@tonic-gateclobber_local:	clean_local
201a7872406Smeem	$(RM) $(PROG) $(ROOTFS_PROG) $(SPPROG) $(MNTTAB) $(DEFAULTFILES) \
202a7872406Smeem	$(CLOBBERFILES)
2037c478bd9Sstevel@tonic-gate
2044fceebdfSblakej$(SUBDIRS): FRC
205f96a0cefSRichard Lowe	@cd $@; pwd; $(MAKE) $(TARGET)
2067c478bd9Sstevel@tonic-gate
2077c478bd9Sstevel@tonic-gateFRC:
208