summaryrefslogtreecommitdiffstats
path: root/gnu/lib/libregex/test/Makefile
blob: e8516a86d2d9d7bf7b497cec64cf3c5a705a85b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#	$Id: $

# Generated automatically from Makefile.in by configure.
# Makefile for regex testing.
#
# Copyright (C) 1992 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

CPPFLAGS =
CFLAGS = -g
LDFLAGS =

srcdir = .
VPATH = .:../.

CC = gcc
DEFS =  -DHAVE_STRING_H=1
LIBS =  $(LOADLIBES)

ETAGS = etags
SHELL = /bin/sh

debug = -DDEBUG
ALL_CPPFLAGS = -I. -I$(srcdir) -I../$(srcdir) $(DEFS) $(CPPFLAGS) $(debug)

.c.o:
	$(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c $<


# Define this as `../regex.o' to get the optimized version.
regex_o = dregex.o
test_h = test.h
test_o = test.o bsd-interf.o other.o tregress.o psx-basic.o psx-extend.o \
         psx-generic.o psx-group.o psx-interf.o psx-interv.o
common_o = printchar.o upcase.o xmalloc.o $(malloc)

# We have a lot of mallocs we can try when we run afoul of strange bugs.
malloc =
#malloc = # the libc malloc
#malloc = g++malloc.o
#malloc = debugmalloc.o
#malloc = emacsmalloc.o
emacsmallocflags = -Drcheck -Dbotch=abort -DUSG

# default is to do nothing.
default:

all: regex syntax

regex: $(regex_o) $(common_o) $(test_o) main.o
	$(CC) -o $@ $(LDFLAGS) $^ $(LIBS)

# As long as we're doing tests, we enable debugging.
dregex.o: ../regex.c ../regex.h
	rm -f $@
	$(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c ../$(srcdir)/regex.c
	mv -f regex.o $@

# iregex is the interactive regex.
iregex: $(common_o) $(regex_o) iregex.o
	$(CC) -o $@ $(LDFLAGS) $^ $(LIBS)

# fileregex searches for an r.e. in every line of a given file.
fileregex_o = fileregex.o printchar.o $(regex_o)
fileregex: $(fileregex_o)
	$(CC) -o $@ $(LDFLAGS) $(fileregex_o) $(LIBS)

# cppregex is regex with a preprocessed regex.c.  Useful when the
# problem is inside some macro.
cppregex: regexcpp.o $(common_o) $(test_o) main.o
	$(CC) -o $@ $(LDFLAGS) $^ $(LIBS)

regexcpp.o: regexcpp.c

regexcpp.c: regex.c regexcpp.sed
	rm -f regexcpp.c
	$(CC) -E $(ALL_CPPFLAGS) ../$(srcdir)/regex.c \
          | egrep -v '^#|^ *$$' \
          | sed -f regexcpp.sed \
          > regexcpp.c
	chmod a-w regexcpp.c

# Have to give this malloc special flags.
emacsmalloc.o: emacsmalloc.c
	$(CC) -c $(CFLAGS) $(ALL_CPPFLAGS) $(emacsmallocflags) \
	  ../$(srcdir)/test/emacsmalloc.c

syntax: syntax.o
	$(CC) $(CFLAGS) -o $@ syntax.o

syntax.c: syntax.skel bits
	sed '/\[\[\[replace.*\]\]\]/r bits' syntax.skel > $@

bits: regex.h
	sed -n 1,/RE_SYNTAX_EMACS/p ../$(srcdir)/regex.h \
          | grep "#define RE_.*1" \
          | sed 's/^#define \(RE_[A-Z_]*\) .*/  TEST_BIT (\1);/' > $@

check: regex
	./regex

TAGS: regex.c regex.h *.h *.c
	$(ETAGS) -t $^

depend:
	gcc -MM $(ALL_CPPFLAGS) *.c > /tmp/depend
.PHONY: depend

install:
.PHONY: install

clean mostlyclean:
	rm -f *.o regex cppregex iregex fileregex regexcpp.c syntax

distclean: clean
	rm -f bits syntax.c Makefile

extraclean: distclean
	rm -f *~* *\#* patch* *.orig *.rej *.bak core a.out

realclean: distclean
	rm -f TAGS

Makefile: Makefile.in ../config.status
	(cd ..; sh config.status)

# Prevent GNU make 3 from overflowing arg limit on system V.
.NOEXPORT:

# Assumes $(distdir) is the place to put our files.
distfiles = ChangeLog TAGS *.in *.c *.h regexcpp.sed syntax.skel
dist: Makefile TAGS
	mkdir $(distdir)
	ln $(distfiles) $(distdir)

# Automatically-generated dependencies below here.
alloca.o : alloca.c
bsd-interf.o : bsd-interf.c
debugmalloc.o : debugmalloc.c
emacsmalloc.o : emacsmalloc.c getpagesize.h
fileregex.o : fileregex.c .././regex.h
g++malloc.o : g++malloc.c //usr/include/stdio.h getpagesize.h
iregex.o : iregex.c .././regex.h
main.o : main.c test.h .././regex.h
malloc-test.o : malloc-test.c
other.o : other.c test.h .././regex.h
printchar.o : printchar.c
psx-basic.o : psx-basic.c test.h .././regex.h
psx-extend.o : psx-extend.c test.h .././regex.h
psx-generic.o : psx-generic.c test.h .././regex.h
psx-group.o : psx-group.c test.h .././regex.h
psx-interf.o : psx-interf.c test.h .././regex.h
psx-interv.o : psx-interv.c test.h .././regex.h
syntax.o : syntax.c .././regex.h
test.o : test.c test.h .././regex.h
tregress.o : tregress.c test.h .././regex.h
upcase.o : upcase.c
xmalloc.o : xmalloc.c
OpenPOWER on IntegriCloud