[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / runtime / regex / test / Makefile.in
1 # Makefile for regex testing.
2
3 # Copyright (C) 1992 Free Software Foundation, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 CPPFLAGS =
20 CFLAGS = -g
21 LDFLAGS =
22
23 srcdir = @srcdir@
24 VPATH = @srcdir@:../@srcdir@
25
26 CC = @CC@
27 DEFS = @DEFS@
28 LIBS = @LIBS@ $(LOADLIBES)
29
30 ETAGS = etags
31 SHELL = /bin/sh
32
33 debug = -DDEBUG
34 ALL_CPPFLAGS = -I. -I$(srcdir) -I../$(srcdir) $(DEFS) $(CPPFLAGS) $(debug)
35
36 .c.o:
37         $(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c $<
38
39
40 # Define this as `../regex.o' to get the optimized version.
41 regex_o = dregex.o
42 test_h = test.h
43 test_o = test.o bsd-interf.o other.o tregress.o psx-basic.o psx-extend.o \
44          psx-generic.o psx-group.o psx-interf.o psx-interv.o
45 common_o = printchar.o upcase.o xmalloc.o $(malloc)
46
47 # We have a lot of mallocs we can try when we run afoul of strange bugs.
48 malloc = @ALLOCA@
49 #malloc = # the libc malloc
50 #malloc = g++malloc.o
51 #malloc = debugmalloc.o
52 #malloc = emacsmalloc.o
53 emacsmallocflags = -Drcheck -Dbotch=abort -DUSG
54
55 # default is to do nothing.
56 default:
57
58 all: regex syntax
59
60 regex: $(regex_o) $(common_o) $(test_o) main.o
61         $(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
62
63 # As long as we're doing tests, we enable debugging.
64 dregex.o: ../regex.c ../regex.h
65         rm -f $@
66         $(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c ../$(srcdir)/regex.c
67         mv regex.o $@
68
69 # iregex is the interactive regex.
70 iregex: $(common_o) $(regex_o) iregex.o
71         $(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
72
73 # fileregex searches for an r.e. in every line of a given file.
74 fileregex_o = fileregex.o printchar.o $(regex_o)
75 fileregex: $(fileregex_o)
76         $(CC) -o $@ $(LDFLAGS) $(fileregex_o) $(LIBS)
77
78 # cppregex is regex with a preprocessed regex.c.  Useful when the
79 # problem is inside some macro.
80 cppregex: regexcpp.o $(common_o) $(test_o) main.o
81         $(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
82
83 regexcpp.o: regexcpp.c 
84
85 regexcpp.c: regex.c regexcpp.sed
86         rm -f regexcpp.c
87         $(CC) -E $(ALL_CPPFLAGS) ../$(srcdir)/regex.c \
88           | egrep -v '^#|^ *$$' \
89           | sed -f regexcpp.sed \
90           > regexcpp.c
91         chmod a-w regexcpp.c
92
93 # Have to give this malloc special flags.
94 emacsmalloc.o: emacsmalloc.c
95         $(CC) -c $(CFLAGS) $(ALL_CPPFLAGS) $(emacsmallocflags) \
96           ../$(srcdir)/test/emacsmalloc.c
97
98 syntax: syntax.o
99         $(CC) $(CFLAGS) -o $@ syntax.o
100
101 syntax.c: syntax.skel bits
102         sed '/\[\[\[replace.*\]\]\]/r bits' syntax.skel > $@
103
104 bits: regex.h
105         sed -n 1,/RE_SYNTAX_EMACS/p ../$(srcdir)/regex.h \
106           | grep "#define RE_.*1" \
107           | sed 's/^#define \(RE_[A-Z_]*\) .*/  TEST_BIT (\1);/' > $@
108
109 check: regex
110         ./regex
111
112 TAGS: regex.c regex.h *.h *.c
113         $(ETAGS) -t $^
114
115 depend:
116         gcc -MM $(ALL_CPPFLAGS) *.c > /tmp/depend
117 .PHONY: depend
118
119 install:
120 .PHONY: install
121
122 clean mostlyclean:
123         rm -f *.o regex cppregex iregex fileregex regexcpp.c syntax
124
125 distclean: clean
126         rm -f bits syntax.c Makefile
127
128 extraclean: distclean
129         rm -f *~* *\#* patch* *.orig *.rej *.bak core a.out
130
131 realclean: distclean
132         rm -f TAGS
133
134 Makefile: Makefile.in ../config.status
135         (cd ..; sh config.status)
136
137 # Prevent GNU make 3 from overflowing arg limit on system V.
138 .NOEXPORT:
139
140 # Assumes $(distdir) is the place to put our files.
141 distfiles = ChangeLog TAGS *.in *.c *.h regexcpp.sed syntax.skel
142 dist: Makefile TAGS
143         mkdir $(distdir)
144         ln $(distfiles) $(distdir)
145
146 # Automatically-generated dependencies below here.
147 alloca.o : alloca.c 
148 bsd-interf.o : bsd-interf.c 
149 debugmalloc.o : debugmalloc.c 
150 emacsmalloc.o : emacsmalloc.c getpagesize.h 
151 fileregex.o : fileregex.c .././regex.h 
152 g++malloc.o : g++malloc.c //usr/include/stdio.h getpagesize.h 
153 iregex.o : iregex.c .././regex.h 
154 main.o : main.c test.h .././regex.h 
155 malloc-test.o : malloc-test.c 
156 other.o : other.c test.h .././regex.h 
157 printchar.o : printchar.c 
158 psx-basic.o : psx-basic.c test.h .././regex.h 
159 psx-extend.o : psx-extend.c test.h .././regex.h 
160 psx-generic.o : psx-generic.c test.h .././regex.h 
161 psx-group.o : psx-group.c test.h .././regex.h 
162 psx-interf.o : psx-interf.c test.h .././regex.h 
163 psx-interv.o : psx-interv.c test.h .././regex.h 
164 syntax.o : syntax.c .././regex.h 
165 test.o : test.c test.h .././regex.h 
166 tregress.o : tregress.c test.h .././regex.h 
167 upcase.o : upcase.c 
168 xmalloc.o : xmalloc.c