summaryrefslogtreecommitdiff
path: root/Makefile
blob: b04ceda22725350250c8395a6eee81f433ca18c7 (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
# Make file for PCRE (Perl-Compatible Regular Expression) library.

# Edit CC, CFLAGS, and RANLIB for your system.

# It is believed that RANLIB=ranlib is required for AIX, BSDI, FreeBSD, Linux,
# MIPS RISCOS, NetBSD, OpenBSD, Digital Unix, and Ultrix.

# Use CFLAGS = -DUSE_BCOPY on SunOS4 and any other system that lacks the
# memmove() function, but has bcopy().

# Use CFLAGS = -DSTRERROR_FROM_ERRLIST on SunOS4 and any other system that
# lacks the strerror() function, but can provide the equivalent by indexing
# into errlist.

CC = gcc -O2
CFLAGS =
RANLIB = @true

##########################################################################

OBJ = chartables.o study.o pcre.o

all:            libpcre.a libpcreposix.a pcretest pgrep

pgrep:          libpcre.a pgrep.o
		$(CC) $(CFLAGS) -o pgrep pgrep.o libpcre.a

pcretest:       libpcre.a libpcreposix.a pcretest.o
		$(CC) $(CFLAGS) -o pcretest pcretest.o libpcre.a libpcreposix.a

libpcre.a:      $(OBJ)
		/bin/rm -f libpcre.a
		ar cq libpcre.a $(OBJ)
		$(RANLIB) libpcre.a

libpcreposix.a: pcreposix.o
		/bin/rm -f libpcreposix.a
		ar cq libpcreposix.a pcreposix.o
		$(RANLIB) libpcreposix.a

pcre.o:         pcre.c pcre.h internal.h Makefile
		$(CC) -c $(CFLAGS) pcre.c

pcreposix.o:    pcreposix.c pcreposix.h internal.h Makefile
		$(CC) -c $(CFLAGS) pcreposix.c

chartables.o:   chartables.c
		$(CC) -c $(CFLAGS) chartables.c

study.o:        study.c pcre.h internal.h Makefile
		$(CC) -c $(CFLAGS) study.c

pcretest.o:     pcretest.c pcre.h Makefile
		$(CC) -c $(CFLAGS) pcretest.c

pgrep.o:        pgrep.c pcre.h Makefile
		$(CC) -c $(CFLAGS) pgrep.c

# An auxiliary program makes the character tables

chartables.c:    maketables
		./maketables >chartables.c

maketables:     maketables.c Makefile
		$(CC) -o maketables $(CFLAGS) maketables.c

# We deliberately omit maketables and chartables.c from 'make clean'; once made
# chartables.c shouldn't change, and if people have edited the tables by hand,
# you don't want to throw them away.

clean:;         /bin/rm -f *.o *.a pcretest pgrep

# Run the tests

runtest:        all
		./pcretest testinput testtry
		diff testtry testoutput
		./pcretest -i testinput2 testtry
		diff testtry testoutput2
		rm -f testtry

# End