Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 1 | # /**************************************************************** |
| 2 | # Copyright (C) Lucent Technologies 1997 |
| 3 | # All Rights Reserved |
Arnold D. Robbins | 795a06b | 2019-07-28 05:51:52 -0600 | [diff] [blame] | 4 | # |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 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. |
Arnold D. Robbins | 795a06b | 2019-07-28 05:51:52 -0600 | [diff] [blame] | 14 | # |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 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 | |
enh-google | 73af097 | 2020-02-28 03:18:29 -0800 | [diff] [blame] | 25 | CFLAGS = -fsanitize=address -O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 26 | CFLAGS = -g |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 27 | CFLAGS = |
Brian Kernighan | 0f4e1ba | 2018-08-24 09:09:59 -0400 | [diff] [blame] | 28 | CFLAGS = -O2 |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 29 | |
Brian Kernighan | 0f4e1ba | 2018-08-24 09:09:59 -0400 | [diff] [blame] | 30 | # compiler options |
Arnold D. Robbins | 32093f5 | 2018-08-22 20:40:26 +0300 | [diff] [blame] | 31 | #CC = gcc -Wall -g -Wwrite-strings |
Arnold D. Robbins | 32093f5 | 2018-08-22 20:40:26 +0300 | [diff] [blame] | 32 | #CC = gcc -O4 -Wall -pedantic -fno-strict-aliasing |
| 33 | #CC = gcc -fprofile-arcs -ftest-coverage # then gcov f1.c; cat f1.c.gcov |
Arnold D. Robbins | 961eec1 | 2019-10-24 09:42:51 -0400 | [diff] [blame] | 34 | HOSTCC = gcc -g -Wall -pedantic -Wcast-qual |
Arnold D. Robbins | 55edb1b | 2019-03-12 21:54:57 +0200 | [diff] [blame] | 35 | CC = $(HOSTCC) # change this is cross-compiling. |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 36 | |
Brian Kernighan | 0f4e1ba | 2018-08-24 09:09:59 -0400 | [diff] [blame] | 37 | # yacc options. pick one; this varies a lot by system. |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 38 | #YFLAGS = -d -S |
Brian Kernighan | e8c2800 | 2018-10-25 13:28:54 -0400 | [diff] [blame] | 39 | YACC = bison -d -y |
| 40 | #YACC = yacc -d |
Adam Sampson | 837b8da | 2018-08-27 20:27:34 +0100 | [diff] [blame] | 41 | # -S uses sprintf in yacc parser instead of sprint |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 42 | |
| 43 | OFILES = b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o |
| 44 | |
| 45 | SOURCE = awk.h ytab.c ytab.h proto.h awkgram.y lex.c b.c main.c \ |
Arnold D. Robbins | 795a06b | 2019-07-28 05:51:52 -0600 | [diff] [blame] | 46 | maketab.c parse.c lib.c run.c tran.c proctab.c |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 47 | |
| 48 | LISTING = awk.h proto.h awkgram.y lex.c b.c main.c maketab.c parse.c \ |
Arnold D. Robbins | 795a06b | 2019-07-28 05:51:52 -0600 | [diff] [blame] | 49 | lib.c run.c tran.c |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 50 | |
| 51 | SHIP = README LICENSE FIXES $(SOURCE) ytab[ch].bak makefile \ |
| 52 | awk.1 |
| 53 | |
| 54 | a.out: ytab.o $(OFILES) |
| 55 | $(CC) $(CFLAGS) ytab.o $(OFILES) $(ALLOC) -lm |
| 56 | |
| 57 | $(OFILES): awk.h ytab.h proto.h |
| 58 | |
Christoph Junghans | e4bb3bc | 2018-12-30 09:04:34 -0700 | [diff] [blame] | 59 | #Clear dependency for parallel build: (make -j) |
| 60 | #YACC generated y.tab.c and y.tab.h at the same time |
| 61 | #this needs to be a static pattern rules otherwise multiple target |
Arnold D. Robbins | 795a06b | 2019-07-28 05:51:52 -0600 | [diff] [blame] | 62 | #are mapped onto multiple executions of yacc, which overwrite |
Christoph Junghans | e4bb3bc | 2018-12-30 09:04:34 -0700 | [diff] [blame] | 63 | #each others outputs. |
| 64 | y%.c y%.h: awk.h proto.h awkgram.y |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 65 | $(YACC) $(YFLAGS) awkgram.y |
Christoph Junghans | e4bb3bc | 2018-12-30 09:04:34 -0700 | [diff] [blame] | 66 | mv y.$*.c y$*.c |
| 67 | mv y.$*.h y$*.h |
Adam Sampson | 9a4aa89 | 2018-08-27 20:28:29 +0100 | [diff] [blame] | 68 | |
| 69 | ytab.h: ytab.c |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 70 | |
| 71 | proctab.c: maketab |
Elliott Hughes | cc165f4 | 2019-01-29 17:20:00 -0800 | [diff] [blame] | 72 | ./maketab ytab.h >proctab.c |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 73 | |
| 74 | maketab: ytab.h maketab.c |
nee-san | c83d943 | 2019-03-12 22:52:17 +0300 | [diff] [blame] | 75 | $(HOSTCC) $(CFLAGS) maketab.c -o maketab |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 76 | |
| 77 | bundle: |
| 78 | @cp ytab.h ytabh.bak |
| 79 | @cp ytab.c ytabc.bak |
| 80 | @bundle $(SHIP) |
| 81 | |
| 82 | tar: |
| 83 | @cp ytab.h ytabh.bak |
| 84 | @cp ytab.c ytabc.bak |
| 85 | @bundle $(SHIP) >awk.shar |
| 86 | @tar cf awk.tar $(SHIP) |
| 87 | gzip awk.tar |
| 88 | ls -l awk.tar.gz |
| 89 | @zip awk.zip $(SHIP) |
| 90 | ls -l awk.zip |
| 91 | |
| 92 | gitadd: |
Brian Kernighan | 3ed9e24 | 2018-08-15 10:45:03 -0400 | [diff] [blame] | 93 | git add README LICENSE FIXES \ |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 94 | awk.h proto.h awkgram.y lex.c b.c main.c maketab.c parse.c \ |
| 95 | lib.c run.c tran.c \ |
Arnold D. Robbins | ab911ab | 2019-06-24 01:10:24 -0600 | [diff] [blame] | 96 | makefile awk.1 testdir |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 97 | |
| 98 | gitpush: |
Arnold D. Robbins | 795a06b | 2019-07-28 05:51:52 -0600 | [diff] [blame] | 99 | # only do this once: |
Brian Kernighan | 3ed9e24 | 2018-08-15 10:45:03 -0400 | [diff] [blame] | 100 | # git remote add origin https://github.com/onetrueawk/awk.git |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 101 | git push -u origin master |
| 102 | |
| 103 | names: |
| 104 | @echo $(LISTING) |
| 105 | |
Arnold D. Robbins | ab911ab | 2019-06-24 01:10:24 -0600 | [diff] [blame] | 106 | test check: |
| 107 | ./REGRESS |
| 108 | |
| 109 | clean: testclean |
Brian Kernighan | 87b9493 | 2012-12-22 10:35:39 -0500 | [diff] [blame] | 110 | rm -f a.out *.o *.obj maketab maketab.exe *.bb *.bbg *.da *.gcov *.gcno *.gcda # proctab.c |
Brian Kernighan | 3ed9e24 | 2018-08-15 10:45:03 -0400 | [diff] [blame] | 111 | |
Arnold D. Robbins | ab911ab | 2019-06-24 01:10:24 -0600 | [diff] [blame] | 112 | cleaner: testclean |
Brian Kernighan | 3ed9e24 | 2018-08-15 10:45:03 -0400 | [diff] [blame] | 113 | rm -f a.out *.o *.obj maketab maketab.exe *.bb *.bbg *.da *.gcov *.gcno *.gcda proctab.c ytab* |
Arnold D. Robbins | ab911ab | 2019-06-24 01:10:24 -0600 | [diff] [blame] | 114 | |
| 115 | # This is a bit of a band-aid until we can invest some more time |
| 116 | # in the test suite. |
| 117 | testclean: |
Arnold D. Robbins | cebda36 | 2019-07-26 12:57:48 +0300 | [diff] [blame] | 118 | cd testdir; rm -fr arnold-fixes beebe echo foo* \ |
| 119 | glop glop1 glop2 lilly.diff tempbig tempsmall time |
Arnold D. Robbins | 8b92a4a | 2019-10-24 09:44:00 -0400 | [diff] [blame] | 120 | |
| 121 | # For the habits of GNU maintainers: |
| 122 | distclean: clean |