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