xref: /titanic_44/usr/src/cmd/backup/dump/Makefile (revision ac88567a7a5bb7f01cf22cf366bc9d6203e24d7a)
1#
2# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3# Use is subject to license terms.
4#
5# cmd/backup/dump/Makefile
6#
7# Copyright (c) 1980 Regents of the University of California.
8# All rights reserved.  The Berkeley software License Agreement
9# specifies the terms and conditions for redistribution.
10#
11#	dump.h			header file
12#	dumpfstab.c		reads fstab/vfstab, mtab/mnttab
13#	dumpitime.c		reads /etc/dumpdates
14#	dumpmain.c		driver
15#	dumponline.c		online dump support
16#	dumpoptr.c		operator interface
17#	dumptape.c		handles the mag tape and opening/closing
18#	dumptraverse.c		traverses the file system
19#	lftw.c			fixed version of ftw(3)
20#	partial.c		partial filesystem dump support
21#	unctime.c		undo ctime
22#
23# CPPFLAGS:
24#	DEBUG			use local directory to find ddate and dumpdates
25#	PARTIAL			enable partial filesystem dump support
26#	TDEBUG			trace out the process forking
27#
28#	CAUTION: FSTYPE must be defined before including ../Makefile.backup,
29#		 otherwise UFSROOTPKGUSRLIBFSTYPE doesn't get expanded
30#		 properly and the magic doesn't happen.
31
32FSTYPE=		ufs
33
34include ../Makefile.backup
35
36#CFLAGS +=	-DTDEBUG
37UFSDUMP=	ufsdump
38
39PROG=		$(UFSDUMP)
40PRODUCT=	$(PROG)
41ROLLDIR=	../../fs.d/ufs/roll_log
42ROLLOBJS=	$(ROLLDIR)/$(MACH)/roll_log.o
43ROLLSRCS=	$(ROLLDIR)/roll_log.c
44
45LOBJECTS=	dumponline.o dumpfstab.o dumpitime.o dumpmain.o \
46		dumpoptr.o dumptape.o dumptraverse.o unctime.o \
47		partial.o lftw.o
48OBJECTS=	$(LOBJECTS) roll_log.o
49SRCS=		$(LOBJECTS:.o=.c)
50
51POFILES=	$(OBJECTS:.o=.po) ../lib/libdump.po
52POFILE=		ufsdump.po
53ROLLPOFILES=	roll_log.po
54
55# XXX This is only needed for the check: target.  It would be nice to
56# XXX automatically generate the list when needed.
57HEADERS=	../../../head/protocols/dumprestore.h \
58	../../fs.d/ufs/roll_log/roll_log.h ../include/byteorder.h \
59	../include/memutils.h \
60	../include/rmt.h dump.h dumpusg.h
61
62CLOBBERFILES=	$(PRODUCT) $(DEBUGPRODUCTS) dumpdates *.ln $(POFILES)
63
64LOCAL=		.
65GENERAL=	../include
66GLOBAL=		../../../head
67CPPFLAGS=	-I$(LOCAL) -I$(GENERAL) -I$(GLOBAL) -DPARTIAL \
68		-I$(ROLLDIR) $(CPPFLAGS.master) \
69		-D_LARGEFILE64_SOURCE=1
70LIBDUMP=	../lib/libdump.a
71LINTLIBDUMP=	../lib/llib-ldump.ln -lkstat
72LDLIBS +=	$(BSTATIC) -L../lib -ldump $(BDYNAMIC) \
73		-lsocket -lnsl -ladm -lm -lkstat
74
75UFSROOTDUMPDATES=	$(UFSROOTETC)/dumpdates
76UFSROOTLINK=		$(UFSROOTUSRSBIN)/$(PROG)
77LINKVALUE=		../lib/fs/$(FSTYPE)/$(PROG)
78LIBDIR=			$(UFSROOTUSRLIBFS)/$(FSTYPE)
79$(UFSROOTDUMPDATES):=	FILEMODE=	0664
80$(LIBDIR):=		DIRMODE=	0755
81
82FILEMODE=	04555
83
84.KEEP_STATE:
85
86all:		$(PRODUCT)
87
88$(PROG):	$(OBJECTS) $$(LIBDUMP)
89	$(LINK.c) -o $@ $(OBJECTS) $(LDLIBS)
90	$(POST_PROCESS)
91
92$(LIBDUMP): FRC
93	$(DO_LIBDIR)
94
95$(POFILE):	$(POFILES)
96	$(RM) $@; cat $(POFILES) > $@
97
98FRC:
99
100install:	all $(LIBDIR) $(UFSROOTPKGUSRLIBFSTYPE) dumpdates \
101		$(UFSROOTDUMPDATES) $(UFSROOTLINK)
102
103dumpdates:
104	cp /dev/null dumpdates
105
106#XXX Should actually note return value from close(2), particularly regarding
107#XXX tape descriptors.  Some drives don't actually force anything to media
108#XXX except when they are writing a file mark....
109
110# grep is looking for non-space/tab
111lint:	$(SRCS) $(ROLLSRCS) $$(LINTLIBDUMP)
112	$(LINT.c) $(SRCS) $(ROLLSRCS) $(LINTLIBDUMP) 2>&1 \
113	| sed -f lint.sed | grep '^[^ 	]'
114
115$(LINTLIBDUMP):	FRC
116	cd ../lib; pwd; $(MAKE) lint
117	pwd
118
119check:	FRC
120	$(CSTYLE) $(CSTYLEFLAGS) $(SRCS) $(ROLLSRCS) $(HEADERS)
121	$(HDRCHK) $(HDRCHKFLAGS) $(HEADERS)
122
123clean:
124	$(RM) $(OBJECTS) $(ROLLOBJS) $(DEBUGOBJS) *.ln
125
126$(LIBDIR):
127	$(INS.dir)
128
129$(UFSROOTLINK):
130	-$(RM) $@; $(SYMLINK) $(LINKVALUE) $(UFSROOTLINK)
131
132roll_log.o:
133	cd $(ROLLDIR) ; pwd ; $(MAKE)
134	cp $(ROLLOBJS) .
135	pwd
136
137.debug/roll_log.o:
138	cd $(ROLLDIR) ; pwd ; $(MAKE) CFLAGS=-g
139	cp $(ROLLOBJS) .debug
140	pwd
141
142$(ROLLPOFILES): $(ROLLSRCS)
143	cd $(ROLLDIR) ; pwd ; $(MAKE) `echo $(ROLLPOFILES) | sed -e 's@$(ROLLDIR)/@@g'`
144	cp $(ROLLDIR)/*.po .
145	pwd
146
147../lib/libdump.po:
148	cd ../lib ; pwd ; $(MAKE)  libdump.po
149
150include ../Makefile.targ
151