xref: /illumos-gate/usr/src/cmd/mv/Makefile (revision be6cf6cdf685195e88e4050d17ae189a595e13bf)
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# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
22# Use is subject to license terms.
23#
24
25PROG=		mv
26XPG4PROG=	mv
27OBJS1=		mv.o
28OBJS=           $(OBJS1) getresponse.o
29CPFILE=		cp
30LNFILE=		ln
31XPG4OBJS=	$(OBJS:%.o=xpg4_%.o)
32SRCS=		$(OBJS1:%.o=%.c) $(SRC)/common/util/getresponse.c
33
34ROOTLINKS= $(ROOTBIN)/$(CPFILE) $(ROOTBIN)/$(LNFILE)
35ROOTXPG4LINKS= $(ROOTXPG4BIN)/$(CPFILE) $(ROOTXPG4BIN)/$(LNFILE)
36
37include ../Makefile.cmd
38include ../Makefile.ctf
39
40clean $(XPG4)	:= OBJS += values-xpg4.o
41
42CLOBBERFILES += $(CPFILE) $(LNFILE)
43CFLAGS	+=	$(CCVERBOSE)
44$(XPG4) := CFLAGS += -DXPG4
45XGETFLAGS += -a -x mv.xcl
46CPPFLAGS += -D_FILE_OFFSET_BITS=64 -I $(SRC)/common/util
47
48$(PROG) := LDLIBS += -lcmdutils -lavl -lsec -lnvpair
49$(XPG4) := LDLIBS += -lcmdutils -lavl -lsec -lnvpair
50
51CTF_MODE = link
52
53.KEEP_STATE:
54
55all:	$(PROG) $(CPFILE) $(LNFILE) $(XPG4)
56
57$(PROG):	$$(OBJS)
58	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
59	$(POST_PROCESS)
60
61$(XPG4):	$$(XPG4OBJS)
62	$(LINK.c) -o $@ $(XPG4OBJS) $(LDLIBS)
63	$(POST_PROCESS)
64
65%.o:    $(SRC)/common/util/%.c
66	$(COMPILE.c) $(OUTPUT_OPTION) $<
67	$(POST_PROCESS_O)
68
69xpg4_%.o:    %.c
70	$(COMPILE.c) -o $@ $<
71	$(POST_PROCESS_O)
72
73xpg4_%.o:    $(SRC)/common/util/%.c
74	$(COMPILE.c) -o $@ $<
75	$(POST_PROCESS_O)
76
77%values-xpg4.o:		../../lib/crt/common/values-xpg4.c
78	$(COMPILE.c) -o $@ ../../lib/crt/common/values-xpg4.c
79
80$(CPFILE):	$(PROG)
81	@$(RM) $(CPFILE); $(LN) $(PROG) $(CPFILE)
82
83$(LNFILE):	$(PROG)
84	@$(RM) $(LNFILE); $(LN) $(PROG) $(LNFILE)
85
86install: all $(ROOTXPG4PROG) $(ROOTLINKS) $(ROOTXPG4LINKS)
87
88$(ROOTLINKS):	$(ROOTPROG)
89	$(RM) $@
90	$(LN) $(ROOTPROG) $@
91
92$(ROOTXPG4LINKS):	$(ROOTXPG4PROG)
93	$(RM) $@
94	$(LN) $(ROOTXPG4PROG) $@
95
96clean:
97	$(RM) $(OBJS) $(XPG4OBJS)
98
99include ../Makefile.targ
100