1 # Makefile for regex testing.
3 # Copyright (C) 1992 Free Software Foundation, Inc.
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)
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.
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.
24 VPATH = @srcdir@:../@srcdir@
28 LIBS = @LIBS@ $(LOADLIBES)
34 ALL_CPPFLAGS = -I. -I$(srcdir) -I../$(srcdir) $(DEFS) $(CPPFLAGS) $(debug)
37 $(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c $<
40 # Define this as `../regex.o' to get the optimized version.
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)
47 # We have a lot of mallocs we can try when we run afoul of strange bugs.
49 #malloc = # the libc malloc
51 #malloc = debugmalloc.o
52 #malloc = emacsmalloc.o
53 emacsmallocflags = -Drcheck -Dbotch=abort -DUSG
55 # default is to do nothing.
60 regex: $(regex_o) $(common_o) $(test_o) main.o
61 $(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
63 # As long as we're doing tests, we enable debugging.
64 dregex.o: ../regex.c ../regex.h
66 $(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c ../$(srcdir)/regex.c
69 # iregex is the interactive regex.
70 iregex: $(common_o) $(regex_o) iregex.o
71 $(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
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)
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)
83 regexcpp.o: regexcpp.c
85 regexcpp.c: regex.c regexcpp.sed
87 $(CC) -E $(ALL_CPPFLAGS) ../$(srcdir)/regex.c \
88 | egrep -v '^#|^ *$$' \
89 | sed -f regexcpp.sed \
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
99 $(CC) $(CFLAGS) -o $@ syntax.o
101 syntax.c: syntax.skel bits
102 sed '/\[\[\[replace.*\]\]\]/r bits' syntax.skel > $@
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);/' > $@
112 TAGS: regex.c regex.h *.h *.c
116 gcc -MM $(ALL_CPPFLAGS) *.c > /tmp/depend
123 rm -f *.o regex cppregex iregex fileregex regexcpp.c syntax
126 rm -f bits syntax.c Makefile
128 extraclean: distclean
129 rm -f *~* *\#* patch* *.orig *.rej *.bak core a.out
134 Makefile: Makefile.in ../config.status
135 (cd ..; sh config.status)
137 # Prevent GNU make 3 from overflowing arg limit on system V.
140 # Assumes $(distdir) is the place to put our files.
141 distfiles = ChangeLog TAGS *.in *.c *.h regexcpp.sed syntax.skel
144 ln $(distfiles) $(distdir)
146 # Automatically-generated dependencies below here.
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
168 xmalloc.o : xmalloc.c