xref: /illumos-gate/usr/src/cmd/mv/Makefile (revision 689b9301078f0c35c7f198fcee8032a0d30eff3a)
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
38
39clean $(XPG4)	:= OBJS += values-xpg4.o
40
41CLOBBERFILES += $(CPFILE) $(LNFILE)
42CFLAGS	+=	$(CCVERBOSE)
43CERRWARN +=	-_gcc=-Wno-parentheses
44CERRWARN +=	-_gcc=-Wno-unused-variable
45CERRWARN +=	$(CNOWARN_UNINIT)
46$(XPG4) := CFLAGS += -DXPG4
47LINTFLAGS += -DXPG4 -u
48XGETFLAGS += -a -x mv.xcl
49CPPFLAGS += -D_FILE_OFFSET_BITS=64 -I $(SRC)/common/util
50
51lint :=	LDLIBS += -lcmdutils -lavl -lsec -lnvpair
52$(PROG) := LDLIBS += -lcmdutils -lavl -lsec -lnvpair
53$(XPG4) := LDLIBS += -lcmdutils -lavl -lsec -lnvpair
54
55.KEEP_STATE:
56
57all:	$(PROG) $(CPFILE) $(LNFILE) $(XPG4)
58
59$(PROG):	$$(OBJS)
60	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
61	$(POST_PROCESS)
62
63$(XPG4):	$$(XPG4OBJS)
64	$(LINK.c) -o $@ $(XPG4OBJS) $(LDLIBS)
65	$(POST_PROCESS)
66
67%.o:    $(SRC)/common/util/%.c
68	$(COMPILE.c) $(OUTPUT_OPTION) $<
69	$(POST_PROCESS_O)
70
71xpg4_%.o:    %.c
72	$(COMPILE.c) -o $@ $<
73	$(POST_PROCESS_O)
74
75xpg4_%.o:    $(SRC)/common/util/%.c
76	$(COMPILE.c) -o $@ $<
77	$(POST_PROCESS_O)
78
79%values-xpg4.o:		../../lib/crt/common/values-xpg4.c
80	$(COMPILE.c) -o $@ ../../lib/crt/common/values-xpg4.c
81
82$(CPFILE):	$(PROG)
83	@$(RM) $(CPFILE); $(LN) $(PROG) $(CPFILE)
84
85$(LNFILE):	$(PROG)
86	@$(RM) $(LNFILE); $(LN) $(PROG) $(LNFILE)
87
88install: all $(ROOTXPG4PROG) $(ROOTLINKS) $(ROOTXPG4LINKS)
89
90$(ROOTLINKS):	$(ROOTPROG)
91	$(RM) $@
92	$(LN) $(ROOTPROG) $@
93
94$(ROOTXPG4LINKS):	$(ROOTXPG4PROG)
95	$(RM) $@
96	$(LN) $(ROOTXPG4PROG) $@
97
98clean:
99	$(RM) $(OBJS) $(XPG4OBJS)
100
101lint:	lint_SRCS
102
103include ../Makefile.targ
104