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