xref: /illumos-gate/usr/src/cmd/vi/port/Makefile (revision 99ebb4ca412cb0a19d77a3899a87c055b9c30fa8)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28# cmd/vi/port/Makefile
29
30PROG= ex
31XPG4PROG= ex
32XPG6PROG= ex
33LIBPROGS= expreserve exrecover
34XD4= exobjs.xpg4
35XD6= exobjs.xpg6
36
37EXOBJS=	bcopy.o ex.o ex_addr.o ex_cmds.o ex_cmds2.o \
38	ex_cmdsub.o ex_data.o ex_extern.o ex_get.o \
39	ex_io.o ex_put.o ex_re.o ex_set.o ex_subr.o \
40	ex_temp.o ex_tty.o ex_unix.o ex_v.o ex_vadj.o \
41	ex_vget.o ex_vmain.o ex_voper.o ex_vops.o \
42	ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
43	printf.o
44EXOBJS_XPG4= $(EXOBJS) compile.o values-xpg4.o
45EXOBJS_XPG6= $(EXOBJS) compile.o values-xpg6.o
46XPG4EXOBJS= ${EXOBJS_XPG4:%=$(XD4)/%}
47XPG6EXOBJS= ${EXOBJS_XPG6:%=$(XD6)/%}
48EXRECOVEROBJS=	exrecover.o ex_extern.o
49OBJS= $(EXOBJS) $(XPG4EXOBJS) $(XPG6EXOBJS) expreserve.o exrecover.o
50SRCS= $(EXOBJS:%.o=%.c) expreserve.c exrecover.c
51TXTS = READ_ME makeoptions asfix.c70 ex.news port.mk.370 port.mk.70	\
52	port.mk.c70 port.mk.usg ovdoprnt.s ovprintf.c rofix
53
54include ../../Makefile.cmd
55#
56# For message catalogue files
57#
58POFILES= $(EXOBJS:%.o=%.po) expreserve.po exrecover.po
59POFILE= port.po
60
61# Include all XPG4 and XPG4ONLY changes in the XPG4 version
62$(XPG4) := CFLAGS += -DXPG4 -DXPG4ONLY
63
64# Include all XPG4 changes, but don't include XPG4ONLY in the XPG6 version
65$(XPG6) := CFLAGS += -DXPG4 -DXPG6 -I$(SRC)/lib/libc/inc
66
67CPPFLAGS +=  -DUSG -DSTDIO -DVMUNIX -DTABS=8 -DSINGLE -DTAG_STACK
68CLOBBERFILES += $(LIBPROGS)
69ex :=		LDLIBS += -lmapmalloc -lcurses \
70			$(ZLAZYLOAD) -lgen -lcrypt_i $(ZNOLAZYLOAD)
71$(XPG4) :=	LDLIBS += -lmapmalloc -lcurses \
72			$(ZLAZYLOAD) -lgen -lcrypt_i $(ZNOLAZYLOAD)
73$(XPG6) :=	LDLIBS += -lmapmalloc -lcurses \
74			$(ZLAZYLOAD) -lgen -lcrypt_i $(ZNOLAZYLOAD)
75exrecover :=	LDLIBS += -lmapmalloc -lcrypt_i
76lint :=		LDLIBS += -lmapmalloc -lcurses -lgen -lcrypt
77
78ROOTLIBPROGS= $(LIBPROGS:%=$(ROOTLIB)/%)
79
80# hard links to ex
81ROOTLINKS= $(ROOTBIN)/vi $(ROOTBIN)/view $(ROOTBIN)/edit $(ROOTBIN)/vedit
82ROOTXPG4LINKS= $(ROOTXPG4BIN)/vi $(ROOTXPG4BIN)/view $(ROOTXPG4BIN)/edit \
83	$(ROOTXPG4BIN)/vedit
84ROOTXPG6LINKS= $(ROOTXPG6BIN)/vi $(ROOTXPG6BIN)/view $(ROOTXPG6BIN)/edit \
85	$(ROOTXPG6BIN)/vedit
86.KEEP_STATE:
87
88.PARALLEL: $(OBJS)
89
90all: $(PROG) $(XPG4) $(XPG6) $(LIBPROGS)
91
92$(PROG): $(EXOBJS)
93	$(LINK.c) $(EXOBJS) -o $@ $(LDLIBS)
94	$(POST_PROCESS)
95
96ex.xpg4: $(XD4) $(XPG4EXOBJS)
97	$(LINK.c) $(XPG4EXOBJS) -o $@ $(LDLIBS)
98	$(POST_PROCESS)
99
100ex.xpg6: $(XD6) $(XPG6EXOBJS)
101	$(LINK.c) $(XPG6EXOBJS) -o $@ $(LDLIBS)
102	$(POST_PROCESS)
103
104$(XD4)/compile.o $(XD6)/compile.o: ../../expr/compile.c
105	$(COMPILE.c) -o $@ ../../expr/compile.c
106
107%values-xpg4.o: ../../../lib/common/common/values-xpg4.c
108	$(COMPILE.c) -o $@ ../../../lib/common/common/values-xpg4.c
109
110%values-xpg6.o: ../../../lib/common/common/values-xpg6.c
111	$(COMPILE.c) -o $@ ../../../lib/common/common/values-xpg6.c
112
113$(XPG4EXOBJS): $(XD4)
114
115$(XPG6EXOBJS): $(XD6)
116
117$(XD4)/%.o:	%.c
118	$(COMPILE.c) -o $@ $<
119
120$(XD6)/%.o:	%.c
121	$(COMPILE.c) -o $@ $<
122
123$(XD4):
124	-@mkdir -p $@
125
126$(XD6):
127	-@mkdir -p $@
128
129exrecover:	$(EXRECOVEROBJS)
130	$(LINK.c) $(EXRECOVEROBJS) -o $@ $(LDLIBS)
131	$(POST_PROCESS)
132
133catalog: $(MSGDOMAIN) $(POFILE)
134
135$(POFILE): $(POFILES)
136	$(RM) $@
137	cat $(POFILES) > $@
138
139
140install: all $(ROOTPROG) $(ROOTLIBPROGS) $(ROOTLINKS) \
141	$(ROOTXPG4PROG) $(ROOTXPG4LINKS) $(ROOTXPG6PROG) $(ROOTXPG6LINKS)
142
143$(ROOTLINKS): $(ROOTPROG)
144	-$(RM) $@
145	-$(LN) -f $(ROOTPROG) $@
146
147$(ROOTXPG4LINKS): $(ROOTXPG4PROG)
148	-$(RM) $@
149	-$(LN) -f $(ROOTXPG4PROG) $@
150
151$(ROOTXPG6LINKS): $(ROOTXPG6PROG)
152	-$(RM) $@
153	-$(LN) -f $(ROOTXPG6PROG) $@
154
155clean:
156	$(RM) $(OBJS)
157
158lint: lint_SRCS
159
160include ../../Makefile.targ
161