xref: /illumos-gate/usr/src/cmd/ed/Makefile (revision b9e93c10c0a2a4bb069d38bb311021a9478c4711)
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# ident	"%Z%%M%	%I%	%E% SMI"
26#
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
41
42CFLAGS += $(CCVERBOSE)
43$(XPG4) := CFLAGS += -DXPG4
44$(XPG6) := CFLAGS += -DXPG6 -I$(SRC)/lib/libc/inc
45lint := LDLIBS += -lgen -lcrypt
46LDLIBS += -lmapmalloc -lgen -lcrypt_i
47XGETFLAGS += -a -x ed.xcl
48
49MAPFILE.INT =	../expr/mapfile-intf
50LDFLAGS +=	$(MAPFILE.INT:%=-M%)
51
52POFILE= ed_cmd.po
53
54%.po: ../expr/%.c
55	$(COMPILE.cpp) $< > $*.c.i
56	$(XGETTEXT) $(XGETFLAGS) $*.c.i
57	$(MV) messages.po $@
58
59.KEEP_STATE:
60
61all:	$(PROG) $(XPG4) $(XPG6)
62
63$(PROG): $(EDOBJ) $(MAPFILE.INT)
64	$(LINK.c) $(EDOBJ) -o $@ $(LDLIBS)
65	$(POST_PROCESS)
66
67$(XPG4): edobjs.xpg4 $(XPG4EDOBJ) $(MAPFILE.INT)
68	$(LINK.c) $(XPG4EDOBJ) -o $@ $(LDLIBS)
69	$(POST_PROCESS)
70
71$(XPG6): edobjs.xpg6 $(XPG6EDOBJ)  $(MAPFILE.INT)
72	$(LINK.c) $(XPG6EDOBJ) -o $@ $(LDLIBS)
73	$(POST_PROCESS)
74
75compile.o:	../expr/compile.c
76	$(COMPILE.c) -o $@ ../expr/compile.c
77
78edobjs.xpg4/%.o:	%.c
79	$(COMPILE.c) -o $@ $<
80
81edobjs.xpg4/%.o:	../expr/compile.c
82	$(COMPILE.c) -o $@ $<
83
84edobjs.xpg6/%.o:	%.c
85	$(COMPILE.c) -o $@ $<
86
87edobjs.xpg6/%.o:	../expr/compile.c
88	$(COMPILE.c) -o $@ $<
89
90edobjs.xpg4:
91	-@mkdir -p $@
92
93edobjs.xpg6:
94	-@mkdir -p $@
95
96$(POFILE): $(POFILES)
97	$(RM) $@
98	cat $(POFILES) > $@
99
100install: all $(ROOTPROG) $(ROOTXPG4PROG) $(ROOTXPG6PROG)
101	$(RM) $(ROOTBIN)/red
102	$(LN) $(ROOTBIN)/ed $(ROOTBIN)/red
103
104values-xpg4.o: ../../lib/common/common/values-xpg4.c
105	$(COMPILE.c) -o $@ ../../lib/common/common/values-xpg4.c
106
107values-xpg6.o: ../../lib/common/common/values-xpg6.c
108	$(COMPILE.c) -o $@ ../../lib/common/common/values-xpg6.c
109
110clean:
111	-@rm -rf $(OBJS) $(XPG4) $(XPG6) edobjs.xpg4 edobjs.xpg6 \
112		compile.c.i
113
114lint:	lint_PROG
115
116include ../Makefile.targ
117