xref: /onnv-gate/usr/src/cmd/backup/dump/Makefile (revision 10207:87c40ea3fc4b)
10Sstevel@tonic-gate#
2*10207SJames.McPherson@Sun.COM# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
30Sstevel@tonic-gate# Use is subject to license terms.
40Sstevel@tonic-gate#
50Sstevel@tonic-gate# cmd/backup/dump/Makefile
60Sstevel@tonic-gate#
70Sstevel@tonic-gate# Copyright (c) 1980 Regents of the University of California.
80Sstevel@tonic-gate# All rights reserved.  The Berkeley software License Agreement
90Sstevel@tonic-gate# specifies the terms and conditions for redistribution.
100Sstevel@tonic-gate#
110Sstevel@tonic-gate#	dump.h			header file
120Sstevel@tonic-gate#	dumpfstab.c		reads fstab/vfstab, mtab/mnttab
130Sstevel@tonic-gate#	dumpitime.c		reads /etc/dumpdates
140Sstevel@tonic-gate#	dumpmain.c		driver
150Sstevel@tonic-gate#	dumponline.c		online dump support
160Sstevel@tonic-gate#	dumpoptr.c		operator interface
170Sstevel@tonic-gate#	dumptape.c		handles the mag tape and opening/closing
180Sstevel@tonic-gate#	dumptraverse.c		traverses the file system
190Sstevel@tonic-gate#	lftw.c			fixed version of ftw(3)
200Sstevel@tonic-gate#	partial.c		partial filesystem dump support
210Sstevel@tonic-gate#	unctime.c		undo ctime
220Sstevel@tonic-gate#
230Sstevel@tonic-gate# CPPFLAGS:
240Sstevel@tonic-gate#	DEBUG			use local directory to find ddate and dumpdates
250Sstevel@tonic-gate#	PARTIAL			enable partial filesystem dump support
260Sstevel@tonic-gate#	TDEBUG			trace out the process forking
270Sstevel@tonic-gate#
280Sstevel@tonic-gate#	CAUTION: FSTYPE must be defined before including ../Makefile.backup,
290Sstevel@tonic-gate#		 otherwise UFSROOTPKGUSRLIBFSTYPE doesn't get expanded
300Sstevel@tonic-gate#		 properly and the magic doesn't happen.
310Sstevel@tonic-gate
320Sstevel@tonic-gateFSTYPE=		ufs
330Sstevel@tonic-gate
340Sstevel@tonic-gateinclude ../Makefile.backup
350Sstevel@tonic-gate
360Sstevel@tonic-gate#CFLAGS +=	-DTDEBUG
370Sstevel@tonic-gateUFSDUMP=	ufsdump
380Sstevel@tonic-gate
390Sstevel@tonic-gatePROG=		$(UFSDUMP)
400Sstevel@tonic-gatePRODUCT=	$(PROG)
410Sstevel@tonic-gateROLLDIR=	../../fs.d/ufs/roll_log
420Sstevel@tonic-gateROLLOBJS=	$(ROLLDIR)/$(MACH)/roll_log.o
430Sstevel@tonic-gateROLLSRCS=	$(ROLLDIR)/roll_log.c
440Sstevel@tonic-gate
450Sstevel@tonic-gateLOBJECTS=	dumponline.o dumpfstab.o dumpitime.o dumpmain.o \
460Sstevel@tonic-gate		dumpoptr.o dumptape.o dumptraverse.o unctime.o \
470Sstevel@tonic-gate		partial.o lftw.o
480Sstevel@tonic-gateOBJECTS=	$(LOBJECTS) roll_log.o
490Sstevel@tonic-gateSRCS=		$(LOBJECTS:.o=.c)
500Sstevel@tonic-gate
510Sstevel@tonic-gatePOFILES=	$(OBJECTS:.o=.po) ../lib/libdump.po
520Sstevel@tonic-gatePOFILE=		ufsdump.po
530Sstevel@tonic-gateROLLPOFILES=	roll_log.po
540Sstevel@tonic-gate
550Sstevel@tonic-gate# XXX This is only needed for the check: target.  It would be nice to
560Sstevel@tonic-gate# XXX automatically generate the list when needed.
570Sstevel@tonic-gateHEADERS=	../../../head/protocols/dumprestore.h \
580Sstevel@tonic-gate	../../fs.d/ufs/roll_log/roll_log.h ../include/byteorder.h \
590Sstevel@tonic-gate	../include/memutils.h \
600Sstevel@tonic-gate	../include/rmt.h dump.h dumpusg.h
610Sstevel@tonic-gate
620Sstevel@tonic-gateCLOBBERFILES=	$(PRODUCT) $(DEBUGPRODUCTS) dumpdates *.ln $(POFILES)
630Sstevel@tonic-gate
640Sstevel@tonic-gateLOCAL=		.
650Sstevel@tonic-gateGENERAL=	../include
660Sstevel@tonic-gateGLOBAL=		../../../head
670Sstevel@tonic-gateCPPFLAGS=	-I$(LOCAL) -I$(GENERAL) -I$(GLOBAL) -DPARTIAL \
680Sstevel@tonic-gate		-I$(ROLLDIR) $(CPPFLAGS.master) \
690Sstevel@tonic-gate		-D_LARGEFILE64_SOURCE=1
700Sstevel@tonic-gateLIBDUMP=	../lib/libdump.a
710Sstevel@tonic-gateLINTLIBDUMP=	../lib/llib-ldump.ln -lkstat
720Sstevel@tonic-gateLDLIBS +=	$(BSTATIC) -L../lib -ldump $(BDYNAMIC) \
730Sstevel@tonic-gate		-lsocket -lnsl -ladm -lm -lkstat
740Sstevel@tonic-gate
750Sstevel@tonic-gateUFSROOTDUMPDATES=	$(UFSROOTETC)/dumpdates
760Sstevel@tonic-gateUFSROOTLINK=		$(UFSROOTUSRSBIN)/$(PROG)
770Sstevel@tonic-gateLINKVALUE=		../lib/fs/$(FSTYPE)/$(PROG)
780Sstevel@tonic-gateLIBDIR=			$(UFSROOTUSRLIBFS)/$(FSTYPE)
790Sstevel@tonic-gate$(UFSROOTDUMPDATES):=	FILEMODE=	0664
800Sstevel@tonic-gate$(LIBDIR):=		DIRMODE=	0755
810Sstevel@tonic-gate
820Sstevel@tonic-gateFILEMODE=	04555
830Sstevel@tonic-gate
840Sstevel@tonic-gate.KEEP_STATE:
850Sstevel@tonic-gate
860Sstevel@tonic-gateall:		$(PRODUCT)
870Sstevel@tonic-gate
880Sstevel@tonic-gate$(PROG):	$(OBJECTS) $$(LIBDUMP)
890Sstevel@tonic-gate	$(LINK.c) -o $@ $(OBJECTS) $(LDLIBS)
900Sstevel@tonic-gate	$(POST_PROCESS)
910Sstevel@tonic-gate
920Sstevel@tonic-gate$(LIBDUMP): FRC
930Sstevel@tonic-gate	$(DO_LIBDIR)
940Sstevel@tonic-gate
950Sstevel@tonic-gate$(POFILE):	$(POFILES)
960Sstevel@tonic-gate	$(RM) $@; cat $(POFILES) > $@
970Sstevel@tonic-gate
980Sstevel@tonic-gateFRC:
990Sstevel@tonic-gate
1000Sstevel@tonic-gateinstall:	all $(LIBDIR) $(UFSROOTPKGUSRLIBFSTYPE) dumpdates \
1010Sstevel@tonic-gate		$(UFSROOTDUMPDATES) $(UFSROOTLINK)
1020Sstevel@tonic-gate
1030Sstevel@tonic-gatedumpdates:
1040Sstevel@tonic-gate	cp /dev/null dumpdates
1050Sstevel@tonic-gate
1060Sstevel@tonic-gate#XXX Should actually note return value from close(2), particularly regarding
1070Sstevel@tonic-gate#XXX tape descriptors.  Some drives don't actually force anything to media
1080Sstevel@tonic-gate#XXX except when they are writing a file mark....
1090Sstevel@tonic-gate
1100Sstevel@tonic-gate# grep is looking for non-space/tab
1110Sstevel@tonic-gatelint:	$(SRCS) $(ROLLSRCS) $$(LINTLIBDUMP)
1120Sstevel@tonic-gate	$(LINT.c) $(SRCS) $(ROLLSRCS) $(LINTLIBDUMP) 2>&1 \
1130Sstevel@tonic-gate	| sed -f lint.sed | grep '^[^ 	]'
1140Sstevel@tonic-gate
1150Sstevel@tonic-gate$(LINTLIBDUMP):	FRC
1160Sstevel@tonic-gate	cd ../lib; pwd; $(MAKE) lint
1170Sstevel@tonic-gate	pwd
1180Sstevel@tonic-gate
1190Sstevel@tonic-gatecheck:	FRC
1200Sstevel@tonic-gate	$(CSTYLE) $(CSTYLEFLAGS) $(SRCS) $(ROLLSRCS) $(HEADERS)
1210Sstevel@tonic-gate	$(HDRCHK) $(HDRCHKFLAGS) $(HEADERS)
1220Sstevel@tonic-gate
1230Sstevel@tonic-gateclean:
1240Sstevel@tonic-gate	$(RM) $(OBJECTS) $(ROLLOBJS) $(DEBUGOBJS) *.ln
1250Sstevel@tonic-gate
1260Sstevel@tonic-gate$(LIBDIR):
1270Sstevel@tonic-gate	$(INS.dir)
1280Sstevel@tonic-gate
1290Sstevel@tonic-gate$(UFSROOTLINK):
1300Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) $(LINKVALUE) $(UFSROOTLINK)
1310Sstevel@tonic-gate
1320Sstevel@tonic-gateroll_log.o:
1330Sstevel@tonic-gate	cd $(ROLLDIR) ; pwd ; $(MAKE)
1340Sstevel@tonic-gate	cp $(ROLLOBJS) .
1350Sstevel@tonic-gate	pwd
1360Sstevel@tonic-gate
1370Sstevel@tonic-gate.debug/roll_log.o:
1380Sstevel@tonic-gate	cd $(ROLLDIR) ; pwd ; $(MAKE) CFLAGS=-g
1390Sstevel@tonic-gate	cp $(ROLLOBJS) .debug
1400Sstevel@tonic-gate	pwd
1410Sstevel@tonic-gate
1420Sstevel@tonic-gate$(ROLLPOFILES): $(ROLLSRCS)
1430Sstevel@tonic-gate	cd $(ROLLDIR) ; pwd ; $(MAKE) `echo $(ROLLPOFILES) | sed -e 's@$(ROLLDIR)/@@g'`
1440Sstevel@tonic-gate	cp $(ROLLDIR)/*.po .
1450Sstevel@tonic-gate	pwd
1460Sstevel@tonic-gate
1470Sstevel@tonic-gate../lib/libdump.po:
1480Sstevel@tonic-gate	cd ../lib ; pwd ; $(MAKE)  libdump.po
1490Sstevel@tonic-gate
1500Sstevel@tonic-gateinclude ../Makefile.targ
151