# # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2018, Joyent, Inc. # Copyright 2015 Nexenta Systems, Inc. All rights reserved. # # The filesystem independent utilities clri, fsdb, dcopy, labelit, and mkfs # are all built from the source file switchout.c. They are all then links # to the same object. This is accomplished by: # 1) building clri from switchout.c (had to choose one) # 2) installing it in the target directory # 3) linking the others to clri. # In a similar manner, ncheck is linked to ff. DFPROG= df PROG= $(DFPROG) volcopy ff ROOTFS_PROG= fsck mount umount SPPROG= clri MNTTAB= mnttab DEFAULTFILES= fs.dfl include ../Makefile.cmd SUBDIR1= bootfs lofs zfs SUBDIR2= dev fd pcfs nfs hsfs proc ctfs udfs ufs tmpfs \ autofs mntfs objfs sharefs smbclnt reparsed SUBDIRS= $(SUBDIR1) $(SUBDIR2) I18NDIRS= $(SUBDIR2) CLEANFILES += deffs.o df.o ff.o fsck.o fssnapsup.o \ mount.o preenlib.o switchout.o umount.o volcopy.o all: TARGET= all install: TARGET= install clean: TARGET= clean clobber: TARGET= clobber _msg: TARGET= catalog # Hammerhead: df moved to /bin (see ROOTESSBINDF below) USRSBINF= clri volcopy ff USRSBINCLRI= dcopy fsdb fssnap labelit mkfs USRSBINFF= ncheck ETC2SBIN= fsck mount umount ETC2USRSBIN= clri fsdb mkfs labelit dcopy volcopy ff ncheck FSLIB= fslib.o CLEANFILES += $(FSLIB) ROOTSBINPROG = $(ROOTFS_PROG:%=$(ROOTSBIN)/%) ROOTUSRSBINLINKS = $(ROOTFS_PROG:%=$(ROOTUSRSBIN)/%) ROOTUSRSBINF= $(USRSBINF:%=$(ROOTUSRSBIN)/%) ROOTUSRSBINCLRI= $(USRSBINCLRI:%=$(ROOTUSRSBIN)/%) ROOTUSRSBINFF= $(USRSBINFF:%=$(ROOTUSRSBIN)/%) ROOTETCMNTTAB= $(MNTTAB:%=$(ROOTETC)/%) SYMETC2SBIN = $(ETC2SBIN:%=$(ROOTETC)/%) SYMETC2USRSBIN = $(ETC2USRSBIN:%=$(ROOTETC)/%) SYMDEVNM= $(ROOTUSRSBIN)/devnm # Hammerhead: df installs to /bin with compat symlinks ROOTESSBINDF= $(DFPROG:%=$(ROOTESSBIN)/%) DFUSRSBINLINK= $(DFPROG:%=$(ROOTUSRSBIN)/%) DFXPG4LINK= $(DFPROG:%=$(ROOTXPG4BIN)/%) CSTD= $(CSTD_GNU99) CPPFLAGS += -D_LARGEFILE64_SOURCE CERRWARN += -Wno-implicit-function-declaration CERRWARN += -Wno-parentheses CERRWARN += -Wno-unused-variable CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -Wno-unused-function # Hammerhead: Suppress pointer/int cast warnings in legacy preenlib code CERRWARN += -Wno-pointer-to-int-cast CERRWARN += -Wno-int-to-pointer-cast # not linted SMATCH=off # Hammerhead: -ldl for dlopen/dlsym $(DFPROG) : LDLIBS += -lcmdutils -ldl $(SPPROG) : LDLIBS += -lkstat fsck : LDLIBS += -ldl $(ROOTETCMNTTAB) : FILEMODE = 444 # for messaging catalog # POFILE= fs.d.po POFILES1= $(PROG:%=%.po) $(ROOTFS_PROG:%=%.po) switchout.po fssnapsup.po # Hammerhead: GNU Make % substitution only replaces first %; use foreach. POFILES2= $(foreach d,$(I18NDIRS),$(d)/$(d).po) POFILES= $(POFILES1) $(POFILES2) volcopy.po : XGETFLAGS += -a -x volcopy.xcl $(DFPROG).po : XGETFLAGS += -a -x df.xcl .KEEP_STATE: # This is too intense when building the whole world. # .PARALLEL: $(SUBDIRS) all: $(FSLIB) .WAIT $(SUBDIRS) .WAIT all_local _msg: $(I18NDIRS) $(POFILES1) $(RM) $(POFILE) cat $(POFILES) > $(POFILE) $(RM) $(MSGDOMAIN)/$(POFILE) cp $(POFILE) $(MSGDOMAIN) all_local: $(PROG) $(ROOTFS_PROG) $(SPPROG) $(MNTTAB) \ $(DEFAULTFILES) ff volcopy: deffs.o $$(@F).o $(LINK.c) -o $@ $@.o deffs.o $(LDLIBS) $(POST_PROCESS) df: 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 # Hammerhead: DFUSRBINLINK removed — /bin is usr/bin (path flattening), # so ../../bin/df from /usr/bin would be circular. install_local: all_local $(ROOTSBINPROG) $(ROOTESSBINDF) $(ROOTUSRSBINF) \ $(ROOTUSRSBINCLRI) \ $(ROOTUSRSBINFF) $(ROOTETCMNTTAB) $(ROOTETCDEFAULTFILES) \ $(SYMETC2SBIN) $(SYMETC2USRSBIN) \ $(DFUSRSBINLINK) $(DFXPG4LINK) $(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) $@ # Hammerhead: /usr/sbin/df → ../../bin/df (compat) $(DFUSRSBINLINK): -$(RM) $@; $(SYMLINK) ../../bin/$(@F) $@ # Hammerhead: /usr/bin/df symlink removed — /bin is usr/bin (path flattening) # Hammerhead: /usr/xpg4/bin/df → ../../../bin/df (compat) $(DFXPG4LINK): -$(RM) $@; $(SYMLINK) ../../../bin/$(@F) $@ # Links from /usr/sbin to /sbin such as /sbin/mount -> ../../sbin/mount $(ROOTUSRSBINLINKS): -$(RM) $@; $(SYMLINK) ../../sbin/$(@F) $@ # Hammerhead: /usr/sbin/devnm → ../../bin/df (df moved to /bin) $(SYMDEVNM): -$(RM) $@; $(SYMLINK) ../../bin/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: $(SUBDIRS) .WAIT clean_local clean_local: $(RM) $(CLEANFILES) clobber: $(SUBDIRS) .WAIT clobber_local clobber_local: clean_local $(RM) $(PROG) $(ROOTFS_PROG) $(SPPROG) $(MNTTAB) $(DEFAULTFILES) \ $(CLOBBERFILES) $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) FRC: