xref: /aosp_15_r20/external/one-true-awk/makefile (revision 9a7741de182b2776d7b30d6355f2585c0780a51b)
1*9a7741deSElliott Hughes# /****************************************************************
2*9a7741deSElliott Hughes# Copyright (C) Lucent Technologies 1997
3*9a7741deSElliott Hughes# All Rights Reserved
4*9a7741deSElliott Hughes#
5*9a7741deSElliott Hughes# Permission to use, copy, modify, and distribute this software and
6*9a7741deSElliott Hughes# its documentation for any purpose and without fee is hereby
7*9a7741deSElliott Hughes# granted, provided that the above copyright notice appear in all
8*9a7741deSElliott Hughes# copies and that both that the copyright notice and this
9*9a7741deSElliott Hughes# permission notice and warranty disclaimer appear in supporting
10*9a7741deSElliott Hughes# documentation, and that the name Lucent Technologies or any of
11*9a7741deSElliott Hughes# its entities not be used in advertising or publicity pertaining
12*9a7741deSElliott Hughes# to distribution of the software without specific, written prior
13*9a7741deSElliott Hughes# permission.
14*9a7741deSElliott Hughes#
15*9a7741deSElliott Hughes# LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16*9a7741deSElliott Hughes# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
17*9a7741deSElliott Hughes# IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
18*9a7741deSElliott Hughes# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19*9a7741deSElliott Hughes# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
20*9a7741deSElliott Hughes# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21*9a7741deSElliott Hughes# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
22*9a7741deSElliott Hughes# THIS SOFTWARE.
23*9a7741deSElliott Hughes# ****************************************************************/
24*9a7741deSElliott Hughes
25*9a7741deSElliott HughesCFLAGS = -fsanitize=address -O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls
26*9a7741deSElliott HughesCFLAGS = -g
27*9a7741deSElliott HughesCFLAGS =
28*9a7741deSElliott HughesCFLAGS = -O2
29*9a7741deSElliott Hughes
30*9a7741deSElliott Hughes# compiler options
31*9a7741deSElliott Hughes#CC = cc -Wall -g -Wwrite-strings
32*9a7741deSElliott Hughes#CC = cc -O4 -Wall -pedantic -fno-strict-aliasing
33*9a7741deSElliott Hughes#CC = cc -fprofile-arcs -ftest-coverage # then gcov f1.c; cat f1.c.gcov
34*9a7741deSElliott HughesHOSTCC = cc -g -Wall -pedantic -Wcast-qual
35*9a7741deSElliott Hughes# HOSTCC = g++ -g -Wall -pedantic -Wcast-qual
36*9a7741deSElliott HughesCC = $(HOSTCC)  # change this is cross-compiling.
37*9a7741deSElliott Hughes
38*9a7741deSElliott Hughes# By fiat, to make our lives easier, yacc is now defined to be bison.
39*9a7741deSElliott Hughes# If you want something else, you're on your own.
40*9a7741deSElliott Hughes# YACC = yacc -d -b awkgram
41*9a7741deSElliott HughesYACC = bison -d
42*9a7741deSElliott Hughes
43*9a7741deSElliott HughesOFILES = b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o
44*9a7741deSElliott Hughes
45*9a7741deSElliott HughesSOURCE = awk.h awkgram.tab.c awkgram.tab.h proto.h awkgram.y lex.c b.c main.c \
46*9a7741deSElliott Hughes	maketab.c parse.c lib.c run.c tran.c proctab.c
47*9a7741deSElliott Hughes
48*9a7741deSElliott HughesLISTING = awk.h proto.h awkgram.y lex.c b.c main.c maketab.c parse.c \
49*9a7741deSElliott Hughes	lib.c run.c tran.c
50*9a7741deSElliott Hughes
51*9a7741deSElliott HughesSHIP = README LICENSE FIXES $(SOURCE) awkgram.tab.[ch].bak makefile  \
52*9a7741deSElliott Hughes	 awk.1
53*9a7741deSElliott Hughes
54*9a7741deSElliott Hughesa.out:	awkgram.tab.o $(OFILES)
55*9a7741deSElliott Hughes	$(CC) $(CFLAGS) awkgram.tab.o $(OFILES) $(ALLOC)  -lm
56*9a7741deSElliott Hughes
57*9a7741deSElliott Hughes$(OFILES):	awk.h awkgram.tab.h proto.h
58*9a7741deSElliott Hughes
59*9a7741deSElliott Hughesawkgram.tab.c awkgram.tab.h:	awk.h proto.h awkgram.y
60*9a7741deSElliott Hughes	$(YACC) $(YFLAGS) awkgram.y
61*9a7741deSElliott Hughes
62*9a7741deSElliott Hughesproctab.c:	maketab
63*9a7741deSElliott Hughes	./maketab awkgram.tab.h >proctab.c
64*9a7741deSElliott Hughes
65*9a7741deSElliott Hughesmaketab:	awkgram.tab.h maketab.c
66*9a7741deSElliott Hughes	$(HOSTCC) $(CFLAGS) maketab.c -o maketab
67*9a7741deSElliott Hughes
68*9a7741deSElliott Hughesbundle:
69*9a7741deSElliott Hughes	@cp awkgram.tab.h awkgram.tab.h.bak
70*9a7741deSElliott Hughes	@cp awkgram.tab.c awkgram.tab.c.bak
71*9a7741deSElliott Hughes	@bundle $(SHIP)
72*9a7741deSElliott Hughes
73*9a7741deSElliott Hughestar:
74*9a7741deSElliott Hughes	@cp awkgram.tab.h awkgram.tab.h.bak
75*9a7741deSElliott Hughes	@cp awkgram.tab.c awkgram.tab.c.bak
76*9a7741deSElliott Hughes	@bundle $(SHIP) >awk.shar
77*9a7741deSElliott Hughes	@tar cf awk.tar $(SHIP)
78*9a7741deSElliott Hughes	gzip awk.tar
79*9a7741deSElliott Hughes	ls -l awk.tar.gz
80*9a7741deSElliott Hughes	@zip awk.zip $(SHIP)
81*9a7741deSElliott Hughes	ls -l awk.zip
82*9a7741deSElliott Hughes
83*9a7741deSElliott Hughesgitadd:
84*9a7741deSElliott Hughes	git add README LICENSE FIXES \
85*9a7741deSElliott Hughes           awk.h proto.h awkgram.y lex.c b.c main.c maketab.c parse.c \
86*9a7741deSElliott Hughes	   lib.c run.c tran.c \
87*9a7741deSElliott Hughes	   makefile awk.1 testdir
88*9a7741deSElliott Hughes
89*9a7741deSElliott Hughesgitpush:
90*9a7741deSElliott Hughes	# only do this once:
91*9a7741deSElliott Hughes	# git remote add origin https://github.com/onetrueawk/awk.git
92*9a7741deSElliott Hughes	git push -u origin master
93*9a7741deSElliott Hughes
94*9a7741deSElliott Hughesnames:
95*9a7741deSElliott Hughes	@echo $(LISTING)
96*9a7741deSElliott Hughes
97*9a7741deSElliott Hughestest check:
98*9a7741deSElliott Hughes	./REGRESS
99*9a7741deSElliott Hughes
100*9a7741deSElliott Hughesclean: testclean
101*9a7741deSElliott Hughes	rm -f a.out *.o *.obj maketab maketab.exe *.bb *.bbg *.da *.gcov *.gcno *.gcda # proctab.c
102*9a7741deSElliott Hughes
103*9a7741deSElliott Hughescleaner: testclean
104*9a7741deSElliott Hughes	rm -f a.out *.o *.obj maketab maketab.exe *.bb *.bbg *.da *.gcov *.gcno *.gcda proctab.c awkgram.tab.*
105*9a7741deSElliott Hughes
106*9a7741deSElliott Hughes# This is a bit of a band-aid until we can invest some more time
107*9a7741deSElliott Hughes# in the test suite.
108*9a7741deSElliott Hughestestclean:
109*9a7741deSElliott Hughes	cd testdir; rm -fr arnold-fixes beebe devnull echo foo* \
110*9a7741deSElliott Hughes		glop glop1 glop2 lilly.diff tempbig tempsmall time
111*9a7741deSElliott Hughes
112*9a7741deSElliott Hughes# For the habits of GNU maintainers:
113*9a7741deSElliott Hughesdistclean: cleaner
114