xref: /illumos-gate/usr/src/cmd/zfs/Makefile (revision e4f5a11d4a234623168c1558fcdf4341e11769e1)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25
26PROG=		zfs
27OBJS=		zfs_main.o zfs_iter.o
28SRCS=		$(OBJS:%.o=%.c)
29POFILES=	zfs_main.po zfs_iter.po
30POFILE=		zfs.po
31
32include ../Makefile.cmd
33include ../Makefile.ctf
34
35FSTYPE=         zfs
36LINKPROGS=	mount umount
37ROOTETCFSTYPE=  $(ROOTETC)/fs/$(FSTYPE)
38USRLIBFSTYPE=	$(ROOTLIB)/fs/$(FSTYPE)
39
40LDLIBS += -lzfs -luutil -lumem -lnvpair
41
42INCS += -I../../common/zfs
43
44C99MODE=	-xc99=%all
45C99LMODE=	-Xc99=%all
46
47CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS)
48$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
49
50# lint complains about unused _umem_* functions
51LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
52LINTFLAGS64 += -xerroff=E_NAME_DEF_NOT_USED2
53
54ROOTUSRSBINLINKS = $(PROG:%=$(ROOTUSRSBIN)/%)
55USRLIBFSTYPELINKS = $(LINKPROGS:%=$(USRLIBFSTYPE)/%)
56ROOTETCFSTYPELINKS = $(LINKPROGS:%=$(ROOTETCFSTYPE)/%)
57
58.KEEP_STATE:
59
60.PARALLEL:
61
62all: $(PROG)
63
64$(PROG): $(OBJS)
65	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
66	$(POST_PROCESS)
67
68install: all $(ROOTSBINPROG) $(ROOTUSRSBINLINKS) $(USRLIBFSTYPELINKS) \
69	$(ROOTETCFSTYPELINKS)
70
71$(POFILE): $(POFILES)
72	$(RM) $@
73	cat $(POFILES) > $@
74
75clean:
76	$(RM) $(OBJS)
77
78lint:	lint_SRCS
79
80# Links from /usr/sbin to /sbin
81$(ROOTUSRSBINLINKS):
82	-$(RM) $@; $(SYMLINK) ../../sbin/$(PROG) $@
83
84# Links from /usr/lib/fs/zfs to /sbin
85$(USRLIBFSTYPELINKS):
86	-$(RM) $@; $(SYMLINK) ../../../../sbin/$(PROG) $@
87
88# Links from /etc/fs/zfs to /sbin
89$(ROOTETCFSTYPELINKS):
90	-$(RM) $@; $(SYMLINK) ../../../sbin/$(PROG) $@
91
92FRC:
93
94include ../Makefile.targ
95