xref: /titanic_41/usr/src/cmd/backup/dump/Makefile (revision 0b42f15ac52b077791d4ba079e8c163c592c3fda)
17c478bd9Sstevel@tonic-gate#
224fe0b3bSjmcp# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
37c478bd9Sstevel@tonic-gate# Use is subject to license terms.
47c478bd9Sstevel@tonic-gate#
57c478bd9Sstevel@tonic-gate# cmd/backup/dump/Makefile
67c478bd9Sstevel@tonic-gate#
77c478bd9Sstevel@tonic-gate# Copyright (c) 1980 Regents of the University of California.
87c478bd9Sstevel@tonic-gate# All rights reserved.  The Berkeley software License Agreement
97c478bd9Sstevel@tonic-gate# specifies the terms and conditions for redistribution.
107c478bd9Sstevel@tonic-gate#
117c478bd9Sstevel@tonic-gate#	dump.h			header file
127c478bd9Sstevel@tonic-gate#	dumpfstab.c		reads fstab/vfstab, mtab/mnttab
137c478bd9Sstevel@tonic-gate#	dumpitime.c		reads /etc/dumpdates
147c478bd9Sstevel@tonic-gate#	dumpmain.c		driver
157c478bd9Sstevel@tonic-gate#	dumponline.c		online dump support
167c478bd9Sstevel@tonic-gate#	dumpoptr.c		operator interface
177c478bd9Sstevel@tonic-gate#	dumptape.c		handles the mag tape and opening/closing
187c478bd9Sstevel@tonic-gate#	dumptraverse.c		traverses the file system
197c478bd9Sstevel@tonic-gate#	lftw.c			fixed version of ftw(3)
207c478bd9Sstevel@tonic-gate#	partial.c		partial filesystem dump support
217c478bd9Sstevel@tonic-gate#	unctime.c		undo ctime
227c478bd9Sstevel@tonic-gate#
237c478bd9Sstevel@tonic-gate# CPPFLAGS:
247c478bd9Sstevel@tonic-gate#	DEBUG			use local directory to find ddate and dumpdates
257c478bd9Sstevel@tonic-gate#	PARTIAL			enable partial filesystem dump support
267c478bd9Sstevel@tonic-gate#	TDEBUG			trace out the process forking
277c478bd9Sstevel@tonic-gate#
287c478bd9Sstevel@tonic-gate#	CAUTION: FSTYPE must be defined before including ../Makefile.backup,
297c478bd9Sstevel@tonic-gate#		 otherwise UFSROOTPKGUSRLIBFSTYPE doesn't get expanded
307c478bd9Sstevel@tonic-gate#		 properly and the magic doesn't happen.
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gateFSTYPE=		ufs
337c478bd9Sstevel@tonic-gate
347c478bd9Sstevel@tonic-gateinclude ../Makefile.backup
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gate#CFLAGS +=	-DTDEBUG
377c478bd9Sstevel@tonic-gateUFSDUMP=	ufsdump
387c478bd9Sstevel@tonic-gate
397c478bd9Sstevel@tonic-gatePROG=		$(UFSDUMP)
407c478bd9Sstevel@tonic-gatePRODUCT=	$(PROG)
417c478bd9Sstevel@tonic-gateROLLDIR=	../../fs.d/ufs/roll_log
427c478bd9Sstevel@tonic-gateROLLOBJS=	$(ROLLDIR)/$(MACH)/roll_log.o
437c478bd9Sstevel@tonic-gateROLLSRCS=	$(ROLLDIR)/roll_log.c
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gateLOBJECTS=	dumponline.o dumpfstab.o dumpitime.o dumpmain.o \
467c478bd9Sstevel@tonic-gate		dumpoptr.o dumptape.o dumptraverse.o unctime.o \
477c478bd9Sstevel@tonic-gate		partial.o lftw.o
487c478bd9Sstevel@tonic-gateOBJECTS=	$(LOBJECTS) roll_log.o
497c478bd9Sstevel@tonic-gateSRCS=		$(LOBJECTS:.o=.c)
507c478bd9Sstevel@tonic-gate
517c478bd9Sstevel@tonic-gatePOFILES=	$(OBJECTS:.o=.po) ../lib/libdump.po
527c478bd9Sstevel@tonic-gatePOFILE=		ufsdump.po
537c478bd9Sstevel@tonic-gateROLLPOFILES=	roll_log.po
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gate# XXX This is only needed for the check: target.  It would be nice to
567c478bd9Sstevel@tonic-gate# XXX automatically generate the list when needed.
577c478bd9Sstevel@tonic-gateHEADERS=	../../../head/protocols/dumprestore.h \
587c478bd9Sstevel@tonic-gate	../../fs.d/ufs/roll_log/roll_log.h ../include/byteorder.h \
597c478bd9Sstevel@tonic-gate	../include/memutils.h \
607c478bd9Sstevel@tonic-gate	../include/rmt.h dump.h dumpusg.h
617c478bd9Sstevel@tonic-gate
62*b6805bf7SGordon RossCLOBBERFILES +=	$(PRODUCT) $(DEBUGPRODUCTS) dumpdates
637c478bd9Sstevel@tonic-gate
647c478bd9Sstevel@tonic-gateLOCAL=		.
657c478bd9Sstevel@tonic-gateGENERAL=	../include
667c478bd9Sstevel@tonic-gateGLOBAL=		../../../head
677c478bd9Sstevel@tonic-gateCPPFLAGS=	-I$(LOCAL) -I$(GENERAL) -I$(GLOBAL) -DPARTIAL \
687c478bd9Sstevel@tonic-gate		-I$(ROLLDIR) $(CPPFLAGS.master) \
697c478bd9Sstevel@tonic-gate		-D_LARGEFILE64_SOURCE=1
707014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-implicit-function-declaration
717014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-parentheses
727014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-uninitialized
737014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-clobbered
747014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-extra
757c478bd9Sstevel@tonic-gateLIBDUMP=	../lib/libdump.a
767c478bd9Sstevel@tonic-gateLINTLIBDUMP=	../lib/llib-ldump.ln -lkstat
777c478bd9Sstevel@tonic-gateLDLIBS +=	$(BSTATIC) -L../lib -ldump $(BDYNAMIC) \
787c478bd9Sstevel@tonic-gate		-lsocket -lnsl -ladm -lm -lkstat
797c478bd9Sstevel@tonic-gate
807c478bd9Sstevel@tonic-gateUFSROOTDUMPDATES=	$(UFSROOTETC)/dumpdates
817c478bd9Sstevel@tonic-gateUFSROOTLINK=		$(UFSROOTUSRSBIN)/$(PROG)
827c478bd9Sstevel@tonic-gateLINKVALUE=		../lib/fs/$(FSTYPE)/$(PROG)
837c478bd9Sstevel@tonic-gateLIBDIR=			$(UFSROOTUSRLIBFS)/$(FSTYPE)
847c478bd9Sstevel@tonic-gate$(UFSROOTDUMPDATES):=	FILEMODE=	0664
857c478bd9Sstevel@tonic-gate$(LIBDIR):=		DIRMODE=	0755
867c478bd9Sstevel@tonic-gate
877c478bd9Sstevel@tonic-gateFILEMODE=	04555
887c478bd9Sstevel@tonic-gate
897c478bd9Sstevel@tonic-gate.KEEP_STATE:
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gateall:		$(PRODUCT)
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gate$(PROG):	$(OBJECTS) $$(LIBDUMP)
947c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ $(OBJECTS) $(LDLIBS)
957c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
967c478bd9Sstevel@tonic-gate
977c478bd9Sstevel@tonic-gate$(LIBDUMP): FRC
987c478bd9Sstevel@tonic-gate	$(DO_LIBDIR)
997c478bd9Sstevel@tonic-gate
1007c478bd9Sstevel@tonic-gate$(POFILE):	$(POFILES)
1017c478bd9Sstevel@tonic-gate	$(RM) $@; cat $(POFILES) > $@
1027c478bd9Sstevel@tonic-gate
1037c478bd9Sstevel@tonic-gateFRC:
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gateinstall:	all $(LIBDIR) $(UFSROOTPKGUSRLIBFSTYPE) dumpdates \
1067c478bd9Sstevel@tonic-gate		$(UFSROOTDUMPDATES) $(UFSROOTLINK)
1077c478bd9Sstevel@tonic-gate
1087c478bd9Sstevel@tonic-gatedumpdates:
1097c478bd9Sstevel@tonic-gate	cp /dev/null dumpdates
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gate#XXX Should actually note return value from close(2), particularly regarding
1127c478bd9Sstevel@tonic-gate#XXX tape descriptors.  Some drives don't actually force anything to media
1137c478bd9Sstevel@tonic-gate#XXX except when they are writing a file mark....
1147c478bd9Sstevel@tonic-gate
1157c478bd9Sstevel@tonic-gate# grep is looking for non-space/tab
1167c478bd9Sstevel@tonic-gatelint:	$(SRCS) $(ROLLSRCS) $$(LINTLIBDUMP)
1177c478bd9Sstevel@tonic-gate	$(LINT.c) $(SRCS) $(ROLLSRCS) $(LINTLIBDUMP) 2>&1 \
1187c478bd9Sstevel@tonic-gate	| sed -f lint.sed | grep '^[^ 	]'
1197c478bd9Sstevel@tonic-gate
1207c478bd9Sstevel@tonic-gate$(LINTLIBDUMP):	FRC
1217c478bd9Sstevel@tonic-gate	cd ../lib; pwd; $(MAKE) lint
1227c478bd9Sstevel@tonic-gate	pwd
1237c478bd9Sstevel@tonic-gate
1247c478bd9Sstevel@tonic-gatecheck:	FRC
1257c478bd9Sstevel@tonic-gate	$(CSTYLE) $(CSTYLEFLAGS) $(SRCS) $(ROLLSRCS) $(HEADERS)
1267c478bd9Sstevel@tonic-gate	$(HDRCHK) $(HDRCHKFLAGS) $(HEADERS)
1277c478bd9Sstevel@tonic-gate
1287c478bd9Sstevel@tonic-gateclean:
1297c478bd9Sstevel@tonic-gate	$(RM) $(OBJECTS) $(ROLLOBJS) $(DEBUGOBJS) *.ln
1307c478bd9Sstevel@tonic-gate
1317c478bd9Sstevel@tonic-gate$(LIBDIR):
1327c478bd9Sstevel@tonic-gate	$(INS.dir)
1337c478bd9Sstevel@tonic-gate
1347c478bd9Sstevel@tonic-gate$(UFSROOTLINK):
1357c478bd9Sstevel@tonic-gate	-$(RM) $@; $(SYMLINK) $(LINKVALUE) $(UFSROOTLINK)
1367c478bd9Sstevel@tonic-gate
1377c478bd9Sstevel@tonic-gateroll_log.o:
1387c478bd9Sstevel@tonic-gate	cd $(ROLLDIR) ; pwd ; $(MAKE)
1397c478bd9Sstevel@tonic-gate	cp $(ROLLOBJS) .
1407c478bd9Sstevel@tonic-gate	pwd
1417c478bd9Sstevel@tonic-gate
1427c478bd9Sstevel@tonic-gate.debug/roll_log.o:
1437c478bd9Sstevel@tonic-gate	cd $(ROLLDIR) ; pwd ; $(MAKE) CFLAGS=-g
1447c478bd9Sstevel@tonic-gate	cp $(ROLLOBJS) .debug
1457c478bd9Sstevel@tonic-gate	pwd
1467c478bd9Sstevel@tonic-gate
1477c478bd9Sstevel@tonic-gate$(ROLLPOFILES): $(ROLLSRCS)
1487c478bd9Sstevel@tonic-gate	cd $(ROLLDIR) ; pwd ; $(MAKE) `echo $(ROLLPOFILES) | sed -e 's@$(ROLLDIR)/@@g'`
1497c478bd9Sstevel@tonic-gate	cp $(ROLLDIR)/*.po .
1507c478bd9Sstevel@tonic-gate	pwd
1517c478bd9Sstevel@tonic-gate
1527c478bd9Sstevel@tonic-gate../lib/libdump.po:
1537c478bd9Sstevel@tonic-gate	cd ../lib ; pwd ; $(MAKE)  libdump.po
1547c478bd9Sstevel@tonic-gate
1557c478bd9Sstevel@tonic-gateinclude ../Makefile.targ
156