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