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