xref: /illumos-gate/usr/src/cmd/vi/port/Makefile (revision 278421a2)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
524da5b34Srie# Common Development and Distribution License (the "License").
624da5b34Srie# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
21ead1f93eSLiane Praza
227c478bd9Sstevel@tonic-gate#
23ead1f93eSLiane Praza# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
265661bb76SJohn Levon# Copyright (c) 2018, Joyent, Inc.
27ead1f93eSLiane Praza
287c478bd9Sstevel@tonic-gate# cmd/vi/port/Makefile
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gatePROG= ex
317c478bd9Sstevel@tonic-gateXPG4PROG= ex
327c478bd9Sstevel@tonic-gateXPG6PROG= ex
337c478bd9Sstevel@tonic-gateLIBPROGS= expreserve exrecover
347c478bd9Sstevel@tonic-gateXD4= exobjs.xpg4
357c478bd9Sstevel@tonic-gateXD6= exobjs.xpg6
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gateEXOBJS=	bcopy.o ex.o ex_addr.o ex_cmds.o ex_cmds2.o \
387c478bd9Sstevel@tonic-gate	ex_cmdsub.o ex_data.o ex_extern.o ex_get.o \
397c478bd9Sstevel@tonic-gate	ex_io.o ex_put.o ex_re.o ex_set.o ex_subr.o \
407c478bd9Sstevel@tonic-gate	ex_temp.o ex_tty.o ex_unix.o ex_v.o ex_vadj.o \
417c478bd9Sstevel@tonic-gate	ex_vget.o ex_vmain.o ex_voper.o ex_vops.o \
427c478bd9Sstevel@tonic-gate	ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
437c478bd9Sstevel@tonic-gate	printf.o
447c478bd9Sstevel@tonic-gateEXOBJS_XPG4= $(EXOBJS) compile.o values-xpg4.o
457c478bd9Sstevel@tonic-gateEXOBJS_XPG6= $(EXOBJS) compile.o values-xpg6.o
467c478bd9Sstevel@tonic-gateXPG4EXOBJS= ${EXOBJS_XPG4:%=$(XD4)/%}
477c478bd9Sstevel@tonic-gateXPG6EXOBJS= ${EXOBJS_XPG6:%=$(XD6)/%}
487c478bd9Sstevel@tonic-gateEXRECOVEROBJS=	exrecover.o ex_extern.o
497c478bd9Sstevel@tonic-gateOBJS= $(EXOBJS) $(XPG4EXOBJS) $(XPG6EXOBJS) expreserve.o exrecover.o
507c478bd9Sstevel@tonic-gateSRCS= $(EXOBJS:%.o=%.c) expreserve.c exrecover.c
51*278421a2SRichard LoweTXTS = READ_ME makeoptions ex.news
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gateinclude ../../Makefile.cmd
547014882cSRichard Lowe
557014882cSRichard LoweCERRWARN += -_gcc=-Wno-implicit-function-declaration
567014882cSRichard LoweCERRWARN += -_gcc=-Wno-clobbered
577014882cSRichard LoweCERRWARN += -_gcc=-Wno-parentheses
587014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-variable
597014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-label
607014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-value
61d3b5f563SJohn LevonCERRWARN += $(CNOWARN_UNINIT)
627014882cSRichard LoweCERRWARN += -_gcc=-Wno-address
637014882cSRichard Lowe
645661bb76SJohn Levon# way too old
655661bb76SJohn LevonSMATCH=off
665661bb76SJohn Levon
677c478bd9Sstevel@tonic-gate#
687c478bd9Sstevel@tonic-gate# For message catalogue files
697c478bd9Sstevel@tonic-gate#
707c478bd9Sstevel@tonic-gatePOFILES= $(EXOBJS:%.o=%.po) expreserve.po exrecover.po
717c478bd9Sstevel@tonic-gatePOFILE= port.po
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gate# Include all XPG4 and XPG4ONLY changes in the XPG4 version
747c478bd9Sstevel@tonic-gate$(XPG4) := CFLAGS += -DXPG4 -DXPG4ONLY
757c478bd9Sstevel@tonic-gate
767c478bd9Sstevel@tonic-gate# Include all XPG4 changes, but don't include XPG4ONLY in the XPG6 version
773a5240e9Scf$(XPG6) := CFLAGS += -DXPG4 -DXPG6 -I$(SRC)/lib/libc/inc
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gateCPPFLAGS +=  -DUSG -DSTDIO -DVMUNIX -DTABS=8 -DSINGLE -DTAG_STACK
8024da5b34Srie
8124da5b34Srie# vi maintains its own versions of various routines from libc and libcurses,
8224da5b34Srie# so localize all symbols to avoid name space collisions.
8385f4cb87SRichard LoweLDFLAGS +=	$(MAPFILE.NGB:%=-Wl,-M%)
8424da5b34Srie
857c478bd9Sstevel@tonic-gateCLOBBERFILES += $(LIBPROGS)
8667e3a03eSrieex :=		LDLIBS += -lmapmalloc -lcurses -lgen -lcrypt_i
8767e3a03eSrie$(XPG4) :=	LDLIBS += -lmapmalloc -lcurses -lgen -lcrypt_i
8867e3a03eSrie$(XPG6) :=	LDLIBS += -lmapmalloc -lcurses -lgen -lcrypt_i
897c478bd9Sstevel@tonic-gateexrecover :=	LDLIBS += -lmapmalloc -lcrypt_i
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gateROOTLIBPROGS= $(LIBPROGS:%=$(ROOTLIB)/%)
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gate# hard links to ex
94ead1f93eSLiane PrazaROOTLINKS= $(ROOTBIN)/edit $(ROOTHASBIN)/edit $(ROOTBIN)/vedit \
95ead1f93eSLiane Praza	$(ROOTHASBIN)/vedit $(ROOTHASBIN)/vi $(ROOTHASBIN)/view \
96ead1f93eSLiane Praza
977c478bd9Sstevel@tonic-gateROOTXPG4LINKS= $(ROOTXPG4BIN)/vi $(ROOTXPG4BIN)/view $(ROOTXPG4BIN)/edit \
987c478bd9Sstevel@tonic-gate	$(ROOTXPG4BIN)/vedit
997c478bd9Sstevel@tonic-gateROOTXPG6LINKS= $(ROOTXPG6BIN)/vi $(ROOTXPG6BIN)/view $(ROOTXPG6BIN)/edit \
1007c478bd9Sstevel@tonic-gate	$(ROOTXPG6BIN)/vedit
1017c478bd9Sstevel@tonic-gate.KEEP_STATE:
1027c478bd9Sstevel@tonic-gate
1037c478bd9Sstevel@tonic-gate.PARALLEL: $(OBJS)
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gateall: $(PROG) $(XPG4) $(XPG6) $(LIBPROGS)
1067c478bd9Sstevel@tonic-gate
1077c478bd9Sstevel@tonic-gate$(PROG): $(EXOBJS)
1087c478bd9Sstevel@tonic-gate	$(LINK.c) $(EXOBJS) -o $@ $(LDLIBS)
1097c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gateex.xpg4: $(XD4) $(XPG4EXOBJS)
1127c478bd9Sstevel@tonic-gate	$(LINK.c) $(XPG4EXOBJS) -o $@ $(LDLIBS)
1137c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1147c478bd9Sstevel@tonic-gate
1157c478bd9Sstevel@tonic-gateex.xpg6: $(XD6) $(XPG6EXOBJS)
1167c478bd9Sstevel@tonic-gate	$(LINK.c) $(XPG6EXOBJS) -o $@ $(LDLIBS)
1177c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1187c478bd9Sstevel@tonic-gate
1197c478bd9Sstevel@tonic-gate$(XD4)/compile.o $(XD6)/compile.o: ../../expr/compile.c
1207c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ ../../expr/compile.c
1217c478bd9Sstevel@tonic-gate
1223e76f9d6SRichard Lowe%values-xpg4.o: ../../../lib/crt/common/values-xpg4.c
1233e76f9d6SRichard Lowe	$(COMPILE.c) -o $@ ../../../lib/crt/common/values-xpg4.c
1247c478bd9Sstevel@tonic-gate
1253e76f9d6SRichard Lowe%values-xpg6.o: ../../../lib/crt/common/values-xpg6.c
1263e76f9d6SRichard Lowe	$(COMPILE.c) -o $@ ../../../lib/crt/common/values-xpg6.c
1277c478bd9Sstevel@tonic-gate
1287c478bd9Sstevel@tonic-gate$(XPG4EXOBJS): $(XD4)
1297c478bd9Sstevel@tonic-gate
1307c478bd9Sstevel@tonic-gate$(XPG6EXOBJS): $(XD6)
1317c478bd9Sstevel@tonic-gate
1327c478bd9Sstevel@tonic-gate$(XD4)/%.o:	%.c
1337c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1347c478bd9Sstevel@tonic-gate
1357c478bd9Sstevel@tonic-gate$(XD6)/%.o:	%.c
1367c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
1377c478bd9Sstevel@tonic-gate
1387c478bd9Sstevel@tonic-gate$(XD4):
1397c478bd9Sstevel@tonic-gate	-@mkdir -p $@
1407c478bd9Sstevel@tonic-gate
1417c478bd9Sstevel@tonic-gate$(XD6):
1427c478bd9Sstevel@tonic-gate	-@mkdir -p $@
1437c478bd9Sstevel@tonic-gate
1447c478bd9Sstevel@tonic-gateexrecover:	$(EXRECOVEROBJS)
1457c478bd9Sstevel@tonic-gate	$(LINK.c) $(EXRECOVEROBJS) -o $@ $(LDLIBS)
1467c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1477c478bd9Sstevel@tonic-gate
1487c478bd9Sstevel@tonic-gatecatalog: $(MSGDOMAIN) $(POFILE)
1497c478bd9Sstevel@tonic-gate
1507c478bd9Sstevel@tonic-gate$(POFILE): $(POFILES)
1517c478bd9Sstevel@tonic-gate	$(RM) $@
1527c478bd9Sstevel@tonic-gate	cat $(POFILES) > $@
1537c478bd9Sstevel@tonic-gate
1547c478bd9Sstevel@tonic-gate
155ead1f93eSLiane Prazainstall: all $(ROOTHASBINPROG) $(ROOTLIBPROGS) $(ROOTLINKS) \
1567c478bd9Sstevel@tonic-gate	$(ROOTXPG4PROG) $(ROOTXPG4LINKS) $(ROOTXPG6PROG) $(ROOTXPG6LINKS)
1577c478bd9Sstevel@tonic-gate
158ead1f93eSLiane Praza$(ROOTLINKS): $(ROOTHASBINPROG)
1597c478bd9Sstevel@tonic-gate	-$(RM) $@
160ead1f93eSLiane Praza	-$(LN) -f $(ROOTHASBINPROG) $@
1617c478bd9Sstevel@tonic-gate
1627c478bd9Sstevel@tonic-gate$(ROOTXPG4LINKS): $(ROOTXPG4PROG)
1637c478bd9Sstevel@tonic-gate	-$(RM) $@
1647c478bd9Sstevel@tonic-gate	-$(LN) -f $(ROOTXPG4PROG) $@
1657c478bd9Sstevel@tonic-gate
1667c478bd9Sstevel@tonic-gate$(ROOTXPG6LINKS): $(ROOTXPG6PROG)
1677c478bd9Sstevel@tonic-gate	-$(RM) $@
1687c478bd9Sstevel@tonic-gate	-$(LN) -f $(ROOTXPG6PROG) $@
1697c478bd9Sstevel@tonic-gate
1707c478bd9Sstevel@tonic-gateclean:
1717c478bd9Sstevel@tonic-gate	$(RM) $(OBJS)
1727c478bd9Sstevel@tonic-gate
1737c478bd9Sstevel@tonic-gateinclude ../../Makefile.targ
174