xref: /illumos-gate/usr/src/cmd/oawk/Makefile (revision e98dc02a871a9cd0498c8862434b16aa85e772d3)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate# with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
227c478bd9Sstevel@tonic-gate#
237c478bd9Sstevel@tonic-gate# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
26f3655454SJohn Levon# Copyright 2020 Joyent, Inc.
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gateinclude		../Makefile.cmd
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gatePROG =		oawk
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gateSRCS =		b.c lib.c main.c parse.c run.c tran.c
337c478bd9Sstevel@tonic-gate
347c478bd9Sstevel@tonic-gate#TXTS =		README EXPLAIN
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gateOBJS =		awk.g.o awk.lx.o proctab.o tmptoken.o		\
377c478bd9Sstevel@tonic-gate		$(SRCS:%.c=%.o)
387c478bd9Sstevel@tonic-gate
397c478bd9Sstevel@tonic-gate#
407c478bd9Sstevel@tonic-gate# for message catalogue
417c478bd9Sstevel@tonic-gate#
427c478bd9Sstevel@tonic-gatePOFILES=        $(OBJS:%.o=%.po)
437c478bd9Sstevel@tonic-gatePOFILE=         oawk.po
447c478bd9Sstevel@tonic-gateXGETFLAGS +=    -a -x oawk.xcl
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gateNATIVEDIR =	native
477c478bd9Sstevel@tonic-gateMAKEPRCTAB =	$(NATIVEDIR)/makeprctab
487c478bd9Sstevel@tonic-gate
497c478bd9Sstevel@tonic-gateNATIVEOBJS =	$(NATIVEDIR)/makeprctab.o $(NATIVEDIR)/tmptoken.o
507c478bd9Sstevel@tonic-gate$(MAKEPRCTAB) :=	CC = $(NATIVECC)
517c478bd9Sstevel@tonic-gate$(MAKEPRCTAB) :=	POST_PROCESS=
527c478bd9Sstevel@tonic-gate$(MAKEPRCTAB) :=	POST_PROCESS_O=
535801b0f0SToomas Soome$(MAKEPRCTAB) :=	NATIVE_LIBS += libm.so libc.so
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gateCLEANFILES =	proctab.c y.tab.h y.tab.c awk.h awk.g.c		\
567c478bd9Sstevel@tonic-gate		tmptoken.c awk.lx.c $(NATIVEOBJS) $(MAKEPRCTAB)	\
577c478bd9Sstevel@tonic-gate		temp
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gateYFLAGS =	-d
607c478bd9Sstevel@tonic-gateLDLIBS += -lm
617c478bd9Sstevel@tonic-gateCPPFLAGS =      -I. $(CPPFLAGS.master)
627c478bd9Sstevel@tonic-gateCPPFLAGS +=	-D_FILE_OFFSET_BITS=64
637c478bd9Sstevel@tonic-gate
647014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-implicit-function-declaration
657014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-unused-label
667014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-unused-variable
677014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-extra
687014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-parentheses
697014882cSRichard Lowe
705661bb76SJohn Levon# missing type declarations
715661bb76SJohn LevonSMATCH =	off
725661bb76SJohn Levon
737c478bd9Sstevel@tonic-gate.KEEP_STATE :
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gateall :		$(PROG) $(TXTS)
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gate$(PROG) :	$(OBJS)
787c478bd9Sstevel@tonic-gate		$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
797c478bd9Sstevel@tonic-gate		$(POST_PROCESS)
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gate$(POFILE):      $(POFILES)
827c478bd9Sstevel@tonic-gate		$(RM)	$@
837c478bd9Sstevel@tonic-gate		$(CAT)	$(POFILES) > $@
847c478bd9Sstevel@tonic-gate
857c478bd9Sstevel@tonic-gateawk.g.c + awk.h :	awk.g.y
867c478bd9Sstevel@tonic-gate		$(RM) awk.g.c awk.h
877c478bd9Sstevel@tonic-gate		$(YACC.y) awk.g.y
887c478bd9Sstevel@tonic-gate		$(MV) y.tab.c awk.g.c
897c478bd9Sstevel@tonic-gate		$(MV) y.tab.h awk.h
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gateawk.lx.c:	awk.lx.l
927c478bd9Sstevel@tonic-gate		$(LEX.l) -w awk.lx.l > awk.lx.c
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gatetmptoken.c :	tokenscript token.c
957c478bd9Sstevel@tonic-gate		$(RM) $@
967c478bd9Sstevel@tonic-gate		ed - < tokenscript
977c478bd9Sstevel@tonic-gate
987c478bd9Sstevel@tonic-gateproctab.c :	$(MAKEPRCTAB)
997c478bd9Sstevel@tonic-gate		$(RM) $@
1007c478bd9Sstevel@tonic-gate		$(MAKEPRCTAB) > $@
1017c478bd9Sstevel@tonic-gate
1027c478bd9Sstevel@tonic-gate$(MAKEPRCTAB) :	$(NATIVEDIR) $(NATIVEOBJS)
1037c478bd9Sstevel@tonic-gate		$(LINK.c) $(NATIVEOBJS) -o $@ $(XLDLIBS5CC)
1047c478bd9Sstevel@tonic-gate
105*e98dc02aSDan McDonaldinstall :	all $(ROOTPROG)
1067c478bd9Sstevel@tonic-gate
1077c478bd9Sstevel@tonic-gate$(NATIVEDIR) :
1087c478bd9Sstevel@tonic-gate		-@mkdir -p $(NATIVEDIR)
1097c478bd9Sstevel@tonic-gate
1107c478bd9Sstevel@tonic-gate$(NATIVEDIR)/%.o :	%.c
1117c478bd9Sstevel@tonic-gate		$(COMPILE.c) -o $@ $<
1127c478bd9Sstevel@tonic-gate
1137c478bd9Sstevel@tonic-gateclean:
1147c478bd9Sstevel@tonic-gate		$(RM) $(OBJS) $(CLEANFILES)
1157c478bd9Sstevel@tonic-gate
1167c478bd9Sstevel@tonic-gatelint :		lint_SRCS
1177c478bd9Sstevel@tonic-gate
1187c478bd9Sstevel@tonic-gatestrip:
1197c478bd9Sstevel@tonic-gate		$(STRIP) $(PROG)
1207c478bd9Sstevel@tonic-gate
1217c478bd9Sstevel@tonic-gateinclude		../Makefile.targ
122