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