xref: /titanic_50/usr/src/cmd/vi/port/Makefile (revision e07d9cb85217949d497b02d7211de8a197d2f2eb)
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 2007 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
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#
55# For message catalogue files
56#
57POFILES= $(EXOBJS:%.o=%.po) expreserve.po exrecover.po
58POFILE= port.po
59
60# Include all XPG4 and XPG4ONLY changes in the XPG4 version
61$(XPG4) := CFLAGS += -DXPG4 -DXPG4ONLY
62
63# Include all XPG4 changes, but don't include XPG4ONLY in the XPG6 version
64$(XPG6) := CFLAGS += -DXPG4 -DXPG6 -I$(SRC)/lib/libc/inc
65
66CPPFLAGS +=  -DUSG -DSTDIO -DVMUNIX -DTABS=8 -DSINGLE -DTAG_STACK
67
68# vi maintains its own versions of various routines from libc and libcurses,
69# so localize all symbols to avoid name space collisions.
70LDFLAGS +=	$(MAPFILE.NGB:%=-M%)
71
72CLOBBERFILES += $(LIBPROGS)
73ex :=		LDLIBS += -lmapmalloc -lcurses \
74			$(ZLAZYLOAD) -lgen -lcrypt_i $(ZNOLAZYLOAD)
75$(XPG4) :=	LDLIBS += -lmapmalloc -lcurses \
76			$(ZLAZYLOAD) -lgen -lcrypt_i $(ZNOLAZYLOAD)
77$(XPG6) :=	LDLIBS += -lmapmalloc -lcurses \
78			$(ZLAZYLOAD) -lgen -lcrypt_i $(ZNOLAZYLOAD)
79exrecover :=	LDLIBS += -lmapmalloc -lcrypt_i
80lint :=		LDLIBS += -lmapmalloc -lcurses -lgen -lcrypt
81
82ROOTLIBPROGS= $(LIBPROGS:%=$(ROOTLIB)/%)
83
84# hard links to ex
85ROOTLINKS= $(ROOTBIN)/vi $(ROOTBIN)/view $(ROOTBIN)/edit $(ROOTBIN)/vedit
86ROOTXPG4LINKS= $(ROOTXPG4BIN)/vi $(ROOTXPG4BIN)/view $(ROOTXPG4BIN)/edit \
87	$(ROOTXPG4BIN)/vedit
88ROOTXPG6LINKS= $(ROOTXPG6BIN)/vi $(ROOTXPG6BIN)/view $(ROOTXPG6BIN)/edit \
89	$(ROOTXPG6BIN)/vedit
90.KEEP_STATE:
91
92.PARALLEL: $(OBJS)
93
94all: $(PROG) $(XPG4) $(XPG6) $(LIBPROGS)
95
96$(PROG): $(EXOBJS)
97	$(LINK.c) $(EXOBJS) -o $@ $(LDLIBS)
98	$(POST_PROCESS)
99
100ex.xpg4: $(XD4) $(XPG4EXOBJS)
101	$(LINK.c) $(XPG4EXOBJS) -o $@ $(LDLIBS)
102	$(POST_PROCESS)
103
104ex.xpg6: $(XD6) $(XPG6EXOBJS)
105	$(LINK.c) $(XPG6EXOBJS) -o $@ $(LDLIBS)
106	$(POST_PROCESS)
107
108$(XD4)/compile.o $(XD6)/compile.o: ../../expr/compile.c
109	$(COMPILE.c) -o $@ ../../expr/compile.c
110
111%values-xpg4.o: ../../../lib/common/common/values-xpg4.c
112	$(COMPILE.c) -o $@ ../../../lib/common/common/values-xpg4.c
113
114%values-xpg6.o: ../../../lib/common/common/values-xpg6.c
115	$(COMPILE.c) -o $@ ../../../lib/common/common/values-xpg6.c
116
117$(XPG4EXOBJS): $(XD4)
118
119$(XPG6EXOBJS): $(XD6)
120
121$(XD4)/%.o:	%.c
122	$(COMPILE.c) -o $@ $<
123
124$(XD6)/%.o:	%.c
125	$(COMPILE.c) -o $@ $<
126
127$(XD4):
128	-@mkdir -p $@
129
130$(XD6):
131	-@mkdir -p $@
132
133exrecover:	$(EXRECOVEROBJS)
134	$(LINK.c) $(EXRECOVEROBJS) -o $@ $(LDLIBS)
135	$(POST_PROCESS)
136
137catalog: $(MSGDOMAIN) $(POFILE)
138
139$(POFILE): $(POFILES)
140	$(RM) $@
141	cat $(POFILES) > $@
142
143
144install: all $(ROOTPROG) $(ROOTLIBPROGS) $(ROOTLINKS) \
145	$(ROOTXPG4PROG) $(ROOTXPG4LINKS) $(ROOTXPG6PROG) $(ROOTXPG6LINKS)
146
147$(ROOTLINKS): $(ROOTPROG)
148	-$(RM) $@
149	-$(LN) -f $(ROOTPROG) $@
150
151$(ROOTXPG4LINKS): $(ROOTXPG4PROG)
152	-$(RM) $@
153	-$(LN) -f $(ROOTXPG4PROG) $@
154
155$(ROOTXPG6LINKS): $(ROOTXPG6PROG)
156	-$(RM) $@
157	-$(LN) -f $(ROOTXPG6PROG) $@
158
159clean:
160	$(RM) $(OBJS)
161
162lint: lint_SRCS
163
164include ../../Makefile.targ
165