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