xref: /illumos-gate/usr/src/cmd/mv/Makefile (revision 581cede61ac9c14d8d4ea452562a567189eead78)
1# CDDL HEADER START
2#
3# The contents of this file are subject to the terms of the
4# Common Development and Distribution License (the "License").
5# You may not use this file except in compliance with the License.
6#
7# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8# or http://www.opensolaris.org/os/licensing.
9# See the License for the specific language governing permissions
10# and limitations under the License.
11#
12# When distributing Covered Code, include this CDDL HEADER in each
13# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14# If applicable, add the following below this CDDL HEADER, with the
15# fields enclosed by brackets "[]" replaced with your own identifying
16# information: Portions Copyright [yyyy] [name of copyright owner]
17#
18# CDDL HEADER END
19#
20#
21#ident	"%Z%%M%	%I%	%E% SMI"
22#
23# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27PROG=		mv
28XPG4PROG=	mv
29OBJS1=		mv.o
30OBJS=           $(OBJS1) getresponse.o
31CPFILE=		cp
32LNFILE=		ln
33XPG4OBJS=	$(OBJS:%.o=xpg4_%.o)
34SRCS=		$(OBJS1:%.o=%.c) $(SRC)/common/util/getresponse.c
35
36ROOTLINKS= $(ROOTBIN)/$(CPFILE) $(ROOTBIN)/$(LNFILE)
37ROOTXPG4LINKS= $(ROOTXPG4BIN)/$(CPFILE) $(ROOTXPG4BIN)/$(LNFILE)
38
39include ../Makefile.cmd
40
41clean $(XPG4)	:= OBJS += values-xpg4.o
42
43CLOBBERFILES += $(CPFILE) $(LNFILE)
44CFLAGS	+=	$(CCVERBOSE)
45$(XPG4) := CFLAGS += -DXPG4
46LINTFLAGS += -DXPG4 -u
47XGETFLAGS += -a -x mv.xcl
48CPPFLAGS += -D_FILE_OFFSET_BITS=64 -I $(SRC)/common/util
49
50lint :=	LDLIBS += -lcmdutils -lavl -lsec -lnvpair
51$(PROG) := LDLIBS += -lcmdutils -lavl -lsec -lnvpair
52$(XPG4) := LDLIBS += -lcmdutils -lavl -lsec -lnvpair
53
54.KEEP_STATE:
55
56all:	$(PROG) $(CPFILE) $(LNFILE) $(XPG4)
57
58$(PROG):	$$(OBJS)
59	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
60	$(POST_PROCESS)
61
62$(XPG4):	$$(XPG4OBJS)
63	$(LINK.c) -o $@ $(XPG4OBJS) $(LDLIBS)
64	$(POST_PROCESS)
65
66%.o:    $(SRC)/common/util/%.c
67	$(COMPILE.c) $(OUTPUT_OPTION) $<
68	$(POST_PROCESS_O)
69
70xpg4_%.o:    %.c
71	$(COMPILE.c) -o $@ $<
72	$(POST_PROCESS_O)
73
74xpg4_%.o:    $(SRC)/common/util/%.c
75	$(COMPILE.c) -o $@ $<
76	$(POST_PROCESS_O)
77
78%values-xpg4.o:		../../lib/common/common/values-xpg4.c
79	$(COMPILE.c) -o $@ ../../lib/common/common/values-xpg4.c
80
81$(CPFILE):	$(PROG)
82	@$(RM) $(CPFILE); $(LN) $(PROG) $(CPFILE)
83
84$(LNFILE):	$(PROG)
85	@$(RM) $(LNFILE); $(LN) $(PROG) $(LNFILE)
86
87install: all $(ROOTXPG4PROG) $(ROOTLINKS) $(ROOTXPG4LINKS)
88
89$(ROOTLINKS):	$(ROOTPROG)
90	$(RM) $@
91	$(LN) $(ROOTPROG) $@
92
93$(ROOTXPG4LINKS):	$(ROOTXPG4PROG)
94	$(RM) $@
95	$(LN) $(ROOTXPG4PROG) $@
96
97clean:
98	$(RM) $(OBJS) $(XPG4OBJS)
99
100lint:	lint_SRCS
101
102include ../Makefile.targ
103