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