xref: /titanic_50/usr/src/cmd/oawk/Makefile (revision e5dcf7beb7c949f9234713d5818b581ec3825443)
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# ident	"%Z%%M%	%I%	%E% SMI"
24#
25# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
26# Use is subject to license terms.
27#
28# cmd/oawk/Makefile
29#
30
31include		../Makefile.cmd
32
33PROG =		oawk
34LINKPROG =	awk
35
36SRCS =		b.c lib.c main.c parse.c run.c tran.c
37
38#TXTS =		README EXPLAIN
39
40OBJS =		awk.g.o awk.lx.o proctab.o tmptoken.o		\
41		$(SRCS:%.c=%.o)
42
43#
44# for message catalogue
45#
46POFILES=        $(OBJS:%.o=%.po)
47POFILE=         oawk.po
48XGETFLAGS +=    -a -x oawk.xcl
49
50NATIVEDIR =	native
51MAKEPRCTAB =	$(NATIVEDIR)/makeprctab
52
53NATIVEOBJS =	$(NATIVEDIR)/makeprctab.o $(NATIVEDIR)/tmptoken.o
54$(MAKEPRCTAB) :=	CC = $(NATIVECC)
55$(MAKEPRCTAB) :=	POST_PROCESS=
56$(MAKEPRCTAB) :=	POST_PROCESS_O=
57
58CLEANFILES =	proctab.c y.tab.h y.tab.c awk.h awk.g.c		\
59		tmptoken.c awk.lx.c $(NATIVEOBJS) $(MAKEPRCTAB)	\
60		temp
61
62YFLAGS =	-d
63XLDLIBS5CC +=	-lm
64LDLIBS +=	-lm
65CPPFLAGS =      -I. $(CPPFLAGS.master)
66CPPFLAGS +=	-D_FILE_OFFSET_BITS=64
67
68ROOTLINK =	$(LINKPROG:%=$(ROOTBIN)/%)
69
70.KEEP_STATE :
71
72all :		$(PROG) $(TXTS)
73
74$(PROG) :	$(OBJS)
75		$(LINK.c) $(OBJS)  -o $@  $(LDLIBS)
76		$(POST_PROCESS)
77
78$(POFILE):      $(POFILES)
79		$(RM)	$@
80		$(CAT) 	$(POFILES)      > $@
81
82awk.g.c + awk.h :	awk.g.y
83		$(RM) awk.g.c awk.h
84		$(YACC.y) awk.g.y
85		$(MV) y.tab.c awk.g.c
86		$(MV) y.tab.h awk.h
87
88awk.lx.c:	awk.lx.l
89		$(LEX.l) -w awk.lx.l > awk.lx.c
90
91tmptoken.c :	tokenscript token.c
92		$(RM) $@
93		ed - < tokenscript
94
95proctab.c :	$(MAKEPRCTAB)
96		$(RM) $@
97		$(MAKEPRCTAB) > $@
98
99$(MAKEPRCTAB) :	$(NATIVEDIR) $(NATIVEOBJS)
100		$(LINK.c) $(NATIVEOBJS) -o $@ $(XLDLIBS5CC)
101
102install : 	all $(ROOTPROG) $(ROOTLINK)
103
104$(NATIVEDIR) :
105		-@mkdir -p $(NATIVEDIR)
106
107$(NATIVEDIR)/%.o :	%.c
108		$(COMPILE.c) -o $@ $<
109
110$(ROOTLINK) :	$(ROOTPROG)
111		$(RM) $@; $(LN) $(ROOTPROG) $@
112
113clean:
114		$(RM) $(OBJS) $(CLEANFILES)
115
116lint :		lint_SRCS
117
118strip:
119		$(STRIP) $(PROG)
120
121include		../Makefile.targ
122