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