xref: /illumos-gate/usr/src/cmd/vi/port/Makefile (revision 2b9481465d6ee67ac62c160dbf79c3ec3348c611)
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# Copyright (c) 2018, Joyent, Inc.
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 ex.news
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 += $(CNOWARN_UNINIT)
62CERRWARN += -_gcc=-Wno-address
63
64# way too old
65SMATCH=off
66
67#
68# For message catalogue files
69#
70POFILES= $(EXOBJS:%.o=%.po) expreserve.po exrecover.po
71POFILE= port.po
72
73# Include all XPG4 and XPG4ONLY changes in the XPG4 version
74$(XPG4) := CFLAGS += -DXPG4 -DXPG4ONLY
75
76# Include all XPG4 changes, but don't include XPG4ONLY in the XPG6 version
77$(XPG6) := CFLAGS += -DXPG4 -DXPG6 -I$(SRC)/lib/libc/inc
78
79CPPFLAGS +=  -DUSG -DSTDIO -DVMUNIX -DTABS=8 -DSINGLE -DTAG_STACK
80
81# vi maintains its own versions of various routines from libc and libcurses,
82# so localize all symbols to avoid name space collisions.
83LDFLAGS +=	$(MAPFILE.NGB:%=-Wl,-M%)
84
85CLOBBERFILES += $(LIBPROGS)
86ex :=		LDLIBS += -lmapmalloc -lcurses -lgen -lcrypt_i
87$(XPG4) :=	LDLIBS += -lmapmalloc -lcurses -lgen -lcrypt_i
88$(XPG6) :=	LDLIBS += -lmapmalloc -lcurses -lgen -lcrypt_i
89exrecover :=	LDLIBS += -lmapmalloc -lcrypt_i
90
91ROOTLIBPROGS= $(LIBPROGS:%=$(ROOTLIB)/%)
92
93# hard links to ex
94ROOTLINKS= $(ROOTBIN)/edit $(ROOTHASBIN)/edit $(ROOTBIN)/vedit \
95	$(ROOTHASBIN)/vedit $(ROOTHASBIN)/vi $(ROOTHASBIN)/view \
96
97ROOTXPG4LINKS= $(ROOTXPG4BIN)/vi $(ROOTXPG4BIN)/view $(ROOTXPG4BIN)/edit \
98	$(ROOTXPG4BIN)/vedit
99ROOTXPG6LINKS= $(ROOTXPG6BIN)/vi $(ROOTXPG6BIN)/view $(ROOTXPG6BIN)/edit \
100	$(ROOTXPG6BIN)/vedit
101.KEEP_STATE:
102
103.PARALLEL: $(OBJS)
104
105all: $(PROG) $(XPG4) $(XPG6) $(LIBPROGS)
106
107$(PROG): $(EXOBJS)
108	$(LINK.c) $(EXOBJS) -o $@ $(LDLIBS)
109	$(POST_PROCESS)
110
111ex.xpg4: $(XD4) $(XPG4EXOBJS)
112	$(LINK.c) $(XPG4EXOBJS) -o $@ $(LDLIBS)
113	$(POST_PROCESS)
114
115ex.xpg6: $(XD6) $(XPG6EXOBJS)
116	$(LINK.c) $(XPG6EXOBJS) -o $@ $(LDLIBS)
117	$(POST_PROCESS)
118
119$(XD4)/compile.o $(XD6)/compile.o: ../../expr/compile.c
120	$(COMPILE.c) -o $@ ../../expr/compile.c
121
122%values-xpg4.o: ../../../lib/crt/common/values-xpg4.c
123	$(COMPILE.c) -o $@ ../../../lib/crt/common/values-xpg4.c
124
125%values-xpg6.o: ../../../lib/crt/common/values-xpg6.c
126	$(COMPILE.c) -o $@ ../../../lib/crt/common/values-xpg6.c
127
128$(XPG4EXOBJS): $(XD4)
129
130$(XPG6EXOBJS): $(XD6)
131
132$(XD4)/%.o:	%.c
133	$(COMPILE.c) -o $@ $<
134
135$(XD6)/%.o:	%.c
136	$(COMPILE.c) -o $@ $<
137
138$(XD4):
139	-@mkdir -p $@
140
141$(XD6):
142	-@mkdir -p $@
143
144exrecover:	$(EXRECOVEROBJS)
145	$(LINK.c) $(EXRECOVEROBJS) -o $@ $(LDLIBS)
146	$(POST_PROCESS)
147
148catalog: $(MSGDOMAIN) $(POFILE)
149
150$(POFILE): $(POFILES)
151	$(RM) $@
152	cat $(POFILES) > $@
153
154
155install: all $(ROOTHASBINPROG) $(ROOTLIBPROGS) $(ROOTLINKS) \
156	$(ROOTXPG4PROG) $(ROOTXPG4LINKS) $(ROOTXPG6PROG) $(ROOTXPG6LINKS)
157
158$(ROOTLINKS): $(ROOTHASBINPROG)
159	-$(RM) $@
160	-$(LN) -f $(ROOTHASBINPROG) $@
161
162$(ROOTXPG4LINKS): $(ROOTXPG4PROG)
163	-$(RM) $@
164	-$(LN) -f $(ROOTXPG4PROG) $@
165
166$(ROOTXPG6LINKS): $(ROOTXPG6PROG)
167	-$(RM) $@
168	-$(LN) -f $(ROOTXPG6PROG) $@
169
170clean:
171	$(RM) $(OBJS)
172
173include ../../Makefile.targ
174