Makefile revision fa9e4066f08beec538e775443c5be79dd423fcab
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# CDDL HEADER START
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# The contents of this file are subject to the terms of the
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Common Development and Distribution License, Version 1.0 only
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# (the "License"). You may not use this file except in compliance
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# with the License.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# or http://www.opensolaris.org/os/licensing.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# See the License for the specific language governing permissions
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# and limitations under the License.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# When distributing Covered Code, include this CDDL HEADER in each
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# If applicable, add the following below this CDDL HEADER, with the
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# fields enclosed by brackets "[]" replaced with your own identifying
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# information: Portions Copyright [yyyy] [name of copyright owner]
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# CDDL HEADER END
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Use is subject to license terms.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# ident "%Z%%M% %I% %E% SMI"
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# cmd/fs.d/Makefile
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# The filesystem independent utilities clri, fsdb, dcopy, labelit, and mkfs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# are all built from the source file switchout.c. They are all then links
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# to the same object. This is accomplished by:
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# 1) building clri from switchout.c (had to choose one)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# 2) installing it in the target directory
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# 3) linking the others to clri.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# In a similar manner, ncheck is linked to ff.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweDFPROG= df
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LowePROG= $(DFPROG) fsck volcopy ff
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweROOTFS_PROG= mount umount
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweXPG4PROG= df
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweSPPROG= clri
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweMNTTAB= mnttab
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweDEFAULTFILES= fs.dfl
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweinclude ../Makefile.cmd
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweSUBDIR1= lofs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweSUBDIR2= zfs fd pcfs nfs hsfs proc ctfs udfs ufs tmpfs cachefs autofs mntfs \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe objfs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowei386_SUBDIRS= xmemfs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowei386_I18NDIRS= xmemfs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweSUBDIRS= $(SUBDIR1) $(SUBDIR2) $($(MACH)_SUBDIRS)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweALL_SUBDIRS= $(SUBDIR1) $(SUBDIR2) $(i386_SUBDIRS)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweI18NDIRS= $(SUBDIR2) $(i386_I18NDIRS)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweCLOBBERFILES += $(POFILES_XPG4)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweall:= TARGET= all
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweinstall:= TARGET= install
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweclean:= TARGET= clean
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweclobber:= TARGET= clobber
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowelint:= TARGET= lint
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe_msg:= TARGET= catalog
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweUSRSBINF= df clri fsck volcopy ff
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweUSRSBINCLRI= dcopy fsdb fssnap labelit mkfs
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweUSRSBINFF= ncheck
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweETC2SBIN= mount umount
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweETC2USRSBIN= clri fsdb mkfs fsck labelit dcopy volcopy ff ncheck
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweUSRBIN2USRSBIN= df
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweFSLIB= fslib.o
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweROOTUSRSBINLINKS = $(ROOTFS_PROG:%=$(ROOTUSRSBIN)/%)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweROOTUSRSBINF= $(USRSBINF:%=$(ROOTUSRSBIN)/%)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweROOTUSRSBINCLRI= $(USRSBINCLRI:%=$(ROOTUSRSBIN)/%)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweROOTUSRSBINFF= $(USRSBINFF:%=$(ROOTUSRSBIN)/%)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweROOTETCMNTTAB= $(MNTTAB:%=$(ROOTETC)/%)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweSYMETC2SBIN = $(ETC2SBIN:%=$(ROOTETC)/%)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweSYMETC2USRSBIN = $(ETC2USRSBIN:%=$(ROOTETC)/%)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweSYMUSRBIN2USRSBIN= $(USRBIN2USRSBIN:%=$(ROOTBIN)/%)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweSYMDEVNM= $(ROOTUSRSBIN)/devnm
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# This flag is being added only for SCO (x86) compatibility
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowedf.o := CFLAGS += $(iBCS2FLAG)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweCPPFLAGS += -D_LARGEFILE64_SOURCE
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe%.xpg4.o := CPPFLAGS += -DXPG4
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe$(XPG4) df ff fsck mount volcopy := LDLIBS += -lcmd
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe$(SPPROG) := LDLIBS += -lcmd -lkstat
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe$(ROOTETCMNTTAB) := FILEMODE = 444
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe$(ROOTETCMNTTAB) := OWNER = root
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe$(ROOTETCMNTTAB) := GROUP = root
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# for messaging catalog
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LowePOFILE= fs.d.po
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LowePOFILES1= $(PROG:%=%.po) $(ROOTFS_PROG:%=%.po) switchout.po fssnapsup.po
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LowePOFILES2= $(I18NDIRS:%=%/%.po)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LowePOFILES_XPG4 = df.po.xpg4
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LowePOFILES= $(POFILES1) $(POFILES2) $(POFILES_XPG4)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe$(POFILES_XPG4) := CFLAGS += -DXPG4
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowevolcopy.po := XGETFLAGS += -a -x volcopy.xcl
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe$(POFILES_XPG4) := XGETFLAGS += -a -x df.xcl
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe$(DFPROG).po := XGETFLAGS += -a -x df.xcl
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe%.po.xpg4: %.c
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(COMPILE.cpp) $< > $<.i
$(BUILD.po)
# build rule for xpg4 objects
%.xpg4.o: %.c
$(COMPILE.c) -o $@ $<
.KEEP_STATE:
# This is too intense when building the whole world.
# .PARALLEL: $(SUBDIRS)
all: $(FSLIB) .WAIT $(SUBDIRS) .WAIT all_local
_msg: $(I18NDIRS) $(POFILES1) $(POFILES_XPG4)
$(RM) $(POFILE)
cat $(POFILES) > $(POFILE)
$(RM) $(MSGDOMAIN)/$(POFILE)
cp $(POFILE) $(MSGDOMAIN)
all_local: $(PROG) $(ROOTFS_PROG) $(XPG4PROG) $(SPPROG) $(MNTTAB) \
$(DEFAULTFILES)
ff volcopy: deffs.o $$(@F).o
$(LINK.c) -o $@ $@.o deffs.o $(LDLIBS)
$(POST_PROCESS)
df df.xpg4: deffs.o $(FSLIB) $$(@F).o
$(LINK.c) -o $@ $@.o deffs.o $(FSLIB) $(LDLIBS)
$(POST_PROCESS)
fsck: fsck.o deffs.o preenlib.o
$(LINK.c) -o $@ fsck.o deffs.o preenlib.o $(LDLIBS)
$(POST_PROCESS)
mount: deffs.o mount.o $(FSLIB)
$(LINK.c) -o $@ mount.o deffs.o $(FSLIB) $(LDLIBS)
$(POST_PROCESS)
umount: umount.o $(FSLIB)
$(LINK.c) -o $@ umount.o $(FSLIB) $(LDLIBS)
$(POST_PROCESS)
$(SPPROG): switchout.o deffs.o fssnapsup.o
$(LINK.c) -o $@ switchout.o deffs.o fssnapsup.o $(LDLIBS) -ldiskmgt
$(POST_PROCESS)
install: $(FSLIB) .WAIT $(SUBDIRS) .WAIT install_local
install_local: all_local $(ROOTSBINPROG) $(ROOTUSRSBINF) $(ROOTUSRSBINCLRI) \
$(ROOTUSRSBINFF) $(ROOTETCMNTTAB) $(ROOTETCDEFAULTFILES) \
$(ROOTXPG4PROG) $(SYMETC2SBIN) $(SYMETC2USRSBIN) \
$(SYMUSRBIN2USRSBIN) $(SYMDEVNM) $(ROOTUSRSBINLINKS)
# Links from /etc to /sbin such as /etc/mount -> ../sbin/mount
$(SYMETC2SBIN):
-$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
# Links from /etc to /usr/sbin such as /etc/clri -> ../usr/sbin/clri
$(SYMETC2USRSBIN):
-$(RM) $@; $(SYMLINK) ../usr/sbin/$(@F) $@
# Links from /usr/bin to /usr/sbin such as /usr/bin/df -> ../sbin/df
$(SYMUSRBIN2USRSBIN):
-$(RM) $@; $(SYMLINK) ../sbin/$(@F) $@
# Links from /usr/sbin to /sbin such as /usr/sbin/mount -> ../../sbin/mount
$(ROOTUSRSBINLINKS):
-$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@
# Symlink from devnm to df in /usr/sbin
$(SYMDEVNM):
-$(RM) $@; $(SYMLINK) ./df $@
# Multiple names for switchout (clri, dcopy, fsdb, labelit, mkfs)
$(ROOTUSRSBINCLRI): $(ROOTUSRSBIN)/clri
-$(RM) $@; $(SYMLINK) ./clri $@
$(MNTTAB):
touch $(MNTTAB)
fs.dfl:
$(RM) $@; $(ECHO) "LOCAL=ufs" >$@
# Multiple names for ff (ncheck)
$(ROOTUSRSBINFF): $(ROOTUSRSBIN)/ff
-$(RM) $@; $(SYMLINK) ./ff $@
clean: $(ALL_SUBDIRS) .WAIT clean_local
clean_local:
clobber: $(ALL_SUBDIRS) .WAIT clobber_local
clobber_local: clean_local
$(RM) $(PROG) $(ROOTFS_PROG) $(SPPROG) $(MNTTAB) $(DEFAULTFILES) \
$(CLOBBERFILES)
lint:
$(ALL_SUBDIRS): FRC
@cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET)
FRC: