3
# Make file for PCRE (Perl-Compatible Regular Expression) library.
5
# Edit these definitions for your system
7
# Should shared libraries be built: uncomment this to build them
10
CFLAGS = -O2 -DSUPPORT_UTF8
12
# Command to build a static library
15
# Command used to index static libraries
18
# Options for compiling shared library modules
19
CFLAGS-PIC = $(CFLAGS) -fPIC
21
# Command to build a shared library
22
# $@ will be replaced by the name of the library, eg libpcre.so.2
23
MK-SHARED-LIB = gcc -shared -Wl,-soname,$@ -o $@ -lc
25
# Options to add a run-time library path to a program. This is used when
26
# building pcretest, and allows the tests to be run with the libraries still
27
# in this directory. This allows the libraries to be tested before they're
28
# installed over the old working set!
31
# Everything below this line should not need modification
32
##########################################################################
34
OBJ = maketables.o get.o study.o pcre.o
35
PICOBJ = maketables.o-pic get.o-pic study.o-pic pcre.o-pic
37
# How to build .o-pic files
38
%.o-pic: %.c ; $(CC) $(CFLAGS-PIC) -c $< -o $@
40
ifdef BUILD-SHARED # Building shared libs
41
all: libpcre.a libpcreposix.a libpcre.so.3 libpcreposix.so.3 \
44
# This assumes that anyone building shared libraries will want to use
45
# them for pgrep and pcretest. Is this a good assumption?
47
pcregrep: libpcre.so.3 pcregrep.o
48
$(CC) $(CFLAGS) -o pcregrep pcregrep.o libpcre.so.3
50
pcretest: libpcre.so.3 libpcreposix.so.3 pcretest.o
51
$(CC) $(CFLAGS) -o pcretest pcretest.o libpcre.so.3 \
52
libpcreposix.so.3 $(RPATH)
54
else # Not building shared libs
55
all: libpcre.a libpcreposix.a pcretest pcregrep
57
pcregrep: libpcre.a pcregrep.o
58
$(CC) $(CFLAGS) -o pcregrep pcregrep.o libpcre.a
60
pcretest: libpcre.a libpcreposix.a pcretest.o
61
$(CC) $(CFLAGS) -o pcretest pcretest.o libpcre.a libpcreposix.a
66
libpcre.so.3: $(PICOBJ)
67
$(MK-SHARED-LIB) $(PICOBJ)
71
$(AR) libpcre.a $(OBJ)
74
libpcreposix.so.3: pcreposix.o-pic
75
$(MK-SHARED-LIB) -L. -lpcre pcreposix.o-pic
77
libpcreposix.a: pcreposix.o
79
$(AR) libpcreposix.a pcreposix.o
80
$(RANLIB) libpcreposix.a
82
pcre.o: chartables.c pcre.c pcre.h internal.h
83
pcre.o-pic: chartables.c pcre.c pcre.h internal.h
84
pcreposix.o: pcreposix.c pcreposix.h internal.h pcre.h
85
pcreposix.o-pic: pcreposix.c pcreposix.h internal.h pcre.h
86
maketables.o: maketables.c pcre.h internal.h
87
maketables.o-pic: maketables.c pcre.h internal.h
88
get.o: get.c pcre.h internal.h
89
get.o-pic: get.c pcre.h internal.h
90
study.o: study.c pcre.h internal.h
91
study.o-pic: study.c pcre.h internal.h
93
# Object files for extra programs
95
pcretest.o: pcretest.c pcre.h
96
pcregrep.o: pcregrep.c pcre.h
98
# An auxiliary program makes the default character table source
100
chartables.c: dftables
101
./dftables >chartables.c
103
dftables: dftables.c maketables.c pcre.h internal.h
104
$(CC) -o dftables $(CFLAGS) dftables.c
112
./pcretest testdata/testinput1 >my-testoutput1
113
diff -u testdata/testoutput1 my-testoutput1
115
# Second test (case insensitive)
116
./pcretest -i testdata/testinput2 >my-testoutput2
117
diff -u testdata/testoutput2 my-testoutput2
120
./pcretest testdata/testinput3 >my-testoutput3
121
diff -u testdata/testoutput3 my-testoutput3
123
# This requires .fr locale to be available
125
# ./pcretest -i testdata/testinput4 >my-testoutput4
126
# diff -u testdata/testoutput4 my-testoutput4
129
./pcretest testdata/testinput5 >my-testoutput5
130
diff -u testdata/testoutput5 my-testoutput5
133
./pcretest testdata/testinput6 >my-testoutput6
134
diff -u testdata/testoutput6 my-testoutput6
138
# We deliberately omit dftables and chartables.c from 'make clean'; once made
139
# chartables.c shouldn't change, and if people have edited the tables by hand,
140
# you don't want to throw them away.
142
clean:; -rm -f *.o *.o-pic *.a *.so* pcretest pcregrep
145
-rm -f config.h config.status config.cache config.log
146
-rm -f dftables chartables.c
148
# Declare which targets are phony, i.e. do not really result in files of
151
.PHONY: all test clean distclean