xref: /illumos-gate/usr/src/cmd/ed/Makefile (revision a92282e44f968185a6bba094d1e5fece2da819cf)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# Copyright (c) 2018, Joyent, Inc.
26
27PROG= ed
28XPG4PROG= ed
29XPG6PROG= ed
30
31EDOBJ= ed.o compile.o
32XPG4EDOBJ= edobjs.xpg4/ed.o edobjs.xpg4/compile.o  values-xpg4.o
33XPG6EDOBJ= edobjs.xpg6/ed.o edobjs.xpg6/compile.o  values-xpg6.o
34OBJS= $(EDOBJ) $(XPG4EDOBJ) $(XPG6EDOBJ)
35SRCS= ./ed.c ../expr/compile.c
36
37POFILES= $(EDOBJ:%.o=%.po)
38
39include ../Makefile.cmd
40
41CFLAGS += $(CCVERBOSE)
42CERRWARN += -_gcc=-Wno-parentheses
43CERRWARN += -_gcc=-Wno-unused-variable
44CERRWARN += -_gcc=-Wno-unused-function
45CERRWARN += $(CNOWARN_UNINIT)
46
47# not linted
48SMATCH=off
49
50$(XPG4) := CFLAGS += -DXPG4
51$(XPG6) := CFLAGS += -DXPG6 -I$(SRC)/lib/libc/inc
52LDLIBS += -lmapmalloc -lgen -lcrypt_i
53XGETFLAGS += -a -x ed.xcl
54
55MAPFILE.INT =	../expr/mapfile-intf
56LDFLAGS +=	$(MAPFILE.INT:%=-Wl,-M%)
57
58POFILE= ed_cmd.po
59
60%.po: ../expr/%.c
61	$(COMPILE.cpp) $< > $*.c.i
62	$(XGETTEXT) $(XGETFLAGS) $*.c.i
63	$(MV) messages.po $@
64
65.KEEP_STATE:
66
67all:	$(PROG) $(XPG4) $(XPG6)
68
69$(PROG): $(EDOBJ) $(MAPFILE.INT)
70	$(LINK.c) $(EDOBJ) -o $@ $(LDLIBS)
71	$(POST_PROCESS)
72
73$(XPG4): edobjs.xpg4 $(XPG4EDOBJ) $(MAPFILE.INT)
74	$(LINK.c) $(XPG4EDOBJ) -o $@ $(LDLIBS)
75	$(POST_PROCESS)
76
77$(XPG6): edobjs.xpg6 $(XPG6EDOBJ)  $(MAPFILE.INT)
78	$(LINK.c) $(XPG6EDOBJ) -o $@ $(LDLIBS)
79	$(POST_PROCESS)
80
81compile.o:	../expr/compile.c
82	$(COMPILE.c) -o $@ ../expr/compile.c
83
84edobjs.xpg4/%.o:	%.c
85	$(COMPILE.c) -o $@ $<
86
87edobjs.xpg4/%.o:	../expr/compile.c
88	$(COMPILE.c) -o $@ $<
89
90edobjs.xpg6/%.o:	%.c
91	$(COMPILE.c) -o $@ $<
92
93edobjs.xpg6/%.o:	../expr/compile.c
94	$(COMPILE.c) -o $@ $<
95
96edobjs.xpg4:
97	-@mkdir -p $@
98
99edobjs.xpg6:
100	-@mkdir -p $@
101
102$(POFILE): $(POFILES)
103	$(RM) $@
104	cat $(POFILES) > $@
105
106install: all $(ROOTPROG) $(ROOTXPG4PROG) $(ROOTXPG6PROG)
107	$(RM) $(ROOTBIN)/red
108	$(LN) $(ROOTBIN)/ed $(ROOTBIN)/red
109
110values-xpg4.o: ../../lib/crt/common/values-xpg4.c
111	$(COMPILE.c) -o $@ ../../lib/crt/common/values-xpg4.c
112
113values-xpg6.o: ../../lib/crt/common/values-xpg6.c
114	$(COMPILE.c) -o $@ ../../lib/crt/common/values-xpg6.c
115
116clean:
117	-@rm -rf $(OBJS) $(XPG4) $(XPG6) edobjs.xpg4 edobjs.xpg6 \
118		compile.c.i
119
120include ../Makefile.targ
121