xref: /illumos-gate/usr/src/cmd/ed/Makefile (revision c13de8f6a88563211bd4432ca11ca38ed3bf0fc0)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29PROG= ed
30XPG4PROG= ed
31XPG6PROG= ed
32
33EDOBJ= ed.o compile.o
34XPG4EDOBJ= edobjs.xpg4/ed.o edobjs.xpg4/compile.o  values-xpg4.o
35XPG6EDOBJ= edobjs.xpg6/ed.o edobjs.xpg6/compile.o  values-xpg6.o
36OBJS= $(EDOBJ) $(XPG4EDOBJ) $(XPG6EDOBJ)
37SRCS= ./ed.c ../expr/compile.c
38
39POFILES= $(EDOBJ:%.o=%.po)
40
41include ../Makefile.cmd
42
43CFLAGS += $(CCVERBOSE)
44$(XPG4) := CFLAGS += -DXPG4
45$(XPG6) := CFLAGS += -DXPG6 -I$(SRC)/lib/libc/inc
46LAZYLIBS = $(ZLAZYLOAD) -lgen -lcrypt_i $(ZNOLAZYLOAD)
47lint := LAZYLIBS = -lgen -lcrypt
48LDLIBS += -lmapmalloc $(LAZYLIBS)
49XGETFLAGS += -a -x ed.xcl
50
51POFILE= ed_cmd.po
52
53%.po: ../expr/%.c
54	$(COMPILE.cpp) $< > $*.c.i
55	$(XGETTEXT) $(XGETFLAGS) $*.c.i
56	$(MV) messages.po $@
57
58.KEEP_STATE:
59
60all: $(PROG) $(XPG4) $(XPG6)
61
62$(PROG): $(EDOBJ)
63	$(LINK.c) $(EDOBJ) -o $@ $(LDLIBS)
64	$(POST_PROCESS)
65
66$(XPG4): edobjs.xpg4 $(XPG4EDOBJ)
67	$(LINK.c) $(XPG4EDOBJ) -o $@ $(LDLIBS)
68	$(POST_PROCESS)
69
70$(XPG6): edobjs.xpg6 $(XPG6EDOBJ)
71	$(LINK.c) $(XPG6EDOBJ) -o $@ $(LDLIBS)
72	$(POST_PROCESS)
73
74compile.o:	../expr/compile.c
75	$(COMPILE.c) -o $@ ../expr/compile.c
76
77edobjs.xpg4/%.o:	%.c
78	$(COMPILE.c) -o $@ $<
79
80edobjs.xpg4/%.o:	../expr/compile.c
81	$(COMPILE.c) -o $@ $<
82
83edobjs.xpg6/%.o:	%.c
84	$(COMPILE.c) -o $@ $<
85
86edobjs.xpg6/%.o:	../expr/compile.c
87	$(COMPILE.c) -o $@ $<
88
89edobjs.xpg4:
90	-@mkdir -p $@
91
92edobjs.xpg6:
93	-@mkdir -p $@
94
95$(POFILE): $(POFILES)
96	$(RM) $@
97	cat $(POFILES) > $@
98
99install: all $(ROOTPROG) $(ROOTXPG4PROG) $(ROOTXPG6PROG)
100	$(RM) $(ROOTBIN)/red
101	$(LN) $(ROOTBIN)/ed $(ROOTBIN)/red
102
103values-xpg4.o: ../../lib/common/common/values-xpg4.c
104	$(COMPILE.c) -o $@ ../../lib/common/common/values-xpg4.c
105
106values-xpg6.o: ../../lib/common/common/values-xpg6.c
107	$(COMPILE.c) -o $@ ../../lib/common/common/values-xpg6.c
108
109clean:
110	-@rm -rf $(OBJS) $(XPG4) $(XPG6) edobjs.xpg4 edobjs.xpg6 \
111		compile.c.i
112
113lint:	lint_PROG
114
115include ../Makefile.targ
116