xref: /illumos-gate/usr/src/cmd/vi/port/Makefile (revision abc79d9dd51e98eafb6fc25b4a0b4f66bef40b00)
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#
23# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27# cmd/vi/port/Makefile
28
29PROG= ex
30XPG4PROG= ex
31XPG6PROG= ex
32LIBPROGS= expreserve exrecover
33XD4= exobjs.xpg4
34XD6= exobjs.xpg6
35
36EXOBJS=	bcopy.o ex.o ex_addr.o ex_cmds.o ex_cmds2.o \
37	ex_cmdsub.o ex_data.o ex_extern.o ex_get.o \
38	ex_io.o ex_put.o ex_re.o ex_set.o ex_subr.o \
39	ex_temp.o ex_tty.o ex_unix.o ex_v.o ex_vadj.o \
40	ex_vget.o ex_vmain.o ex_voper.o ex_vops.o \
41	ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
42	printf.o
43EXOBJS_XPG4= $(EXOBJS) compile.o values-xpg4.o
44EXOBJS_XPG6= $(EXOBJS) compile.o values-xpg6.o
45XPG4EXOBJS= ${EXOBJS_XPG4:%=$(XD4)/%}
46XPG6EXOBJS= ${EXOBJS_XPG6:%=$(XD6)/%}
47EXRECOVEROBJS=	exrecover.o ex_extern.o
48OBJS= $(EXOBJS) $(XPG4EXOBJS) $(XPG6EXOBJS) expreserve.o exrecover.o
49SRCS= $(EXOBJS:%.o=%.c) expreserve.c exrecover.c
50TXTS = READ_ME makeoptions asfix.c70 ex.news port.mk.370 port.mk.70	\
51	port.mk.c70 port.mk.usg ovdoprnt.s ovprintf.c rofix
52
53include ../../Makefile.cmd
54
55CERRWARN += -_gcc=-Wno-implicit-function-declaration
56CERRWARN += -_gcc=-Wno-clobbered
57CERRWARN += -_gcc=-Wno-parentheses
58CERRWARN += -_gcc=-Wno-unused-variable
59CERRWARN += -_gcc=-Wno-unused-label
60CERRWARN += -_gcc=-Wno-unused-value
61CERRWARN += -_gcc=-Wno-uninitialized
62CERRWARN += -_gcc=-Wno-address
63
64#
65# For message catalogue files
66#
67POFILES= $(EXOBJS:%.o=%.po) expreserve.po exrecover.po
68POFILE= port.po
69
70# Include all XPG4 and XPG4ONLY changes in the XPG4 version
71$(XPG4) := CFLAGS += -DXPG4 -DXPG4ONLY
72
73# Include all XPG4 changes, but don't include XPG4ONLY in the XPG6 version
74$(XPG6) := CFLAGS += -DXPG4 -DXPG6 -I$(SRC)/lib/libc/inc
75
76CPPFLAGS +=  -DUSG -DSTDIO -DVMUNIX -DTABS=8 -DSINGLE -DTAG_STACK
77
78# vi maintains its own versions of various routines from libc and libcurses,
79# so localize all symbols to avoid name space collisions.
80LDFLAGS +=	$(MAPFILE.NGB:%=-M%)
81
82CLOBBERFILES += $(LIBPROGS)
83ex :=		LDLIBS += -lmapmalloc -lcurses -lgen -lcrypt_i
84$(XPG4) :=	LDLIBS += -lmapmalloc -lcurses -lgen -lcrypt_i
85$(XPG6) :=	LDLIBS += -lmapmalloc -lcurses -lgen -lcrypt_i
86exrecover :=	LDLIBS += -lmapmalloc -lcrypt_i
87lint :=		LDLIBS += -lmapmalloc -lcurses -lgen -lcrypt
88
89ROOTLIBPROGS= $(LIBPROGS:%=$(ROOTLIB)/%)
90
91# hard links to ex
92ROOTLINKS= $(ROOTBIN)/edit $(ROOTHASBIN)/edit $(ROOTBIN)/vedit \
93	$(ROOTHASBIN)/vedit $(ROOTHASBIN)/vi $(ROOTHASBIN)/view \
94
95ROOTXPG4LINKS= $(ROOTXPG4BIN)/vi $(ROOTXPG4BIN)/view $(ROOTXPG4BIN)/edit \
96	$(ROOTXPG4BIN)/vedit
97ROOTXPG6LINKS= $(ROOTXPG6BIN)/vi $(ROOTXPG6BIN)/view $(ROOTXPG6BIN)/edit \
98	$(ROOTXPG6BIN)/vedit
99.KEEP_STATE:
100
101.PARALLEL: $(OBJS)
102
103all: $(PROG) $(XPG4) $(XPG6) $(LIBPROGS)
104
105$(PROG): $(EXOBJS)
106	$(LINK.c) $(EXOBJS) -o $@ $(LDLIBS)
107	$(POST_PROCESS)
108
109ex.xpg4: $(XD4) $(XPG4EXOBJS)
110	$(LINK.c) $(XPG4EXOBJS) -o $@ $(LDLIBS)
111	$(POST_PROCESS)
112
113ex.xpg6: $(XD6) $(XPG6EXOBJS)
114	$(LINK.c) $(XPG6EXOBJS) -o $@ $(LDLIBS)
115	$(POST_PROCESS)
116
117$(XD4)/compile.o $(XD6)/compile.o: ../../expr/compile.c
118	$(COMPILE.c) -o $@ ../../expr/compile.c
119
120%values-xpg4.o: ../../../lib/common/common/values-xpg4.c
121	$(COMPILE.c) -o $@ ../../../lib/common/common/values-xpg4.c
122
123%values-xpg6.o: ../../../lib/common/common/values-xpg6.c
124	$(COMPILE.c) -o $@ ../../../lib/common/common/values-xpg6.c
125
126$(XPG4EXOBJS): $(XD4)
127
128$(XPG6EXOBJS): $(XD6)
129
130$(XD4)/%.o:	%.c
131	$(COMPILE.c) -o $@ $<
132
133$(XD6)/%.o:	%.c
134	$(COMPILE.c) -o $@ $<
135
136$(XD4):
137	-@mkdir -p $@
138
139$(XD6):
140	-@mkdir -p $@
141
142exrecover:	$(EXRECOVEROBJS)
143	$(LINK.c) $(EXRECOVEROBJS) -o $@ $(LDLIBS)
144	$(POST_PROCESS)
145
146catalog: $(MSGDOMAIN) $(POFILE)
147
148$(POFILE): $(POFILES)
149	$(RM) $@
150	cat $(POFILES) > $@
151
152
153install: all $(ROOTHASBINPROG) $(ROOTLIBPROGS) $(ROOTLINKS) \
154	$(ROOTXPG4PROG) $(ROOTXPG4LINKS) $(ROOTXPG6PROG) $(ROOTXPG6LINKS)
155
156$(ROOTLINKS): $(ROOTHASBINPROG)
157	-$(RM) $@
158	-$(LN) -f $(ROOTHASBINPROG) $@
159
160$(ROOTXPG4LINKS): $(ROOTXPG4PROG)
161	-$(RM) $@
162	-$(LN) -f $(ROOTXPG4PROG) $@
163
164$(ROOTXPG6LINKS): $(ROOTXPG6PROG)
165	-$(RM) $@
166	-$(LN) -f $(ROOTXPG6PROG) $@
167
168clean:
169	$(RM) $(OBJS)
170
171lint: lint_SRCS
172
173include ../../Makefile.targ
174