| 1 |
# Make file for PCRE (Perl-Compatible Regular Expression) library. |
# Make file for PCRE (Perl-Compatible Regular Expression) library. |
| 2 |
|
|
| 3 |
# Edit CC, CFLAGS, and RANLIB for your system. |
# If you are using a Unix system, see below. I am a Unix person, so that is |
| 4 |
|
# the stuff I really know about. PCRE is developed on a Unix box. |
| 5 |
|
|
| 6 |
|
# To build mingw32 DLL uncomment the next two lines. This addition for mingw32 |
| 7 |
|
# was contributed by Paul Sokolovsky <Paul.Sokolovsky@technologist.com>. I |
| 8 |
|
# (Philip Hazel) don't know anything about it! There are some additional |
| 9 |
|
# targets at the bottom of this Makefile. |
| 10 |
|
# |
| 11 |
|
# include dll.mk |
| 12 |
|
# DLL_LDFLAGS=-s |
| 13 |
|
|
| 14 |
|
|
| 15 |
|
######## NON-UNIX ############ NON-UNIX ############## NON-UNIX ############## |
| 16 |
|
# If you want to compile PCRE for a non-Unix system, note that it consists |
| 17 |
|
# entirely of code written in Standard C, and so should compile successfully |
| 18 |
|
# using normal compiling commands to do the following: |
| 19 |
|
# |
| 20 |
|
# (1) Compile dftables.c as a stand-alone program, and then run it with |
| 21 |
|
# output sent to chartables.c. This generates a set of standard character |
| 22 |
|
# tables. |
| 23 |
|
# |
| 24 |
|
# (2) Compile maketables.c, get.c, study.c and pcre.c and link them all |
| 25 |
|
# together. This is the pcre library (chartables.c gets included by means of |
| 26 |
|
# an #include directive). |
| 27 |
|
# |
| 28 |
|
# (3) Compile pcreposix.c and link it as the pcreposix library. |
| 29 |
|
# |
| 30 |
|
# (4) Compile the test program pcretest.c. This needs the functions in the |
| 31 |
|
# pcre and pcreposix libraries when linking. |
| 32 |
|
# |
| 33 |
|
# (5) Run pcretest on the testinput files, and check that the output matches |
| 34 |
|
# the corresponding testoutput files. You must use the -i option with |
| 35 |
|
# testinput2. |
| 36 |
|
|
| 37 |
|
|
| 38 |
|
######## UNIX ################## UNIX ################## UNIX ################ |
| 39 |
|
# On a Unix system: |
| 40 |
|
# |
| 41 |
|
# Edit CC, CFLAGS, and RANLIB for your system. |
| 42 |
|
# |
| 43 |
# It is believed that RANLIB=ranlib is required for AIX, BSDI, FreeBSD, Linux, |
# It is believed that RANLIB=ranlib is required for AIX, BSDI, FreeBSD, Linux, |
| 44 |
# MIPS RISCOS, NetBSD, OpenBSD, Digital Unix, and Ultrix. |
# MIPS RISCOS, NetBSD, OpenBSD, Digital Unix, and Ultrix. |
| 45 |
|
# |
| 46 |
# Use CFLAGS = -DUSE_BCOPY on SunOS4 and any other system that lacks the |
# Use CFLAGS = -DUSE_BCOPY on SunOS4 and any other system that lacks the |
| 47 |
# memmove() function, but has bcopy(). |
# memmove() function, but has bcopy(). |
| 48 |
|
# |
| 49 |
# Use CFLAGS = -DSTRERROR_FROM_ERRLIST on SunOS4 and any other system that |
# Use CFLAGS = -DSTRERROR_FROM_ERRLIST on SunOS4 and any other system that |
| 50 |
# lacks the strerror() function, but can provide the equivalent by indexing |
# lacks the strerror() function, but can provide the equivalent by indexing |
| 51 |
# into errlist. |
# into errlist. |
| 52 |
|
|
| 53 |
CC = gcc -O2 |
AR = ar cq |
| 54 |
|
CC = gcc -O2 -Wall |
| 55 |
CFLAGS = |
CFLAGS = |
| 56 |
RANLIB = @true |
RANLIB = @true |
| 57 |
|
|
| 58 |
########################################################################## |
# If you are going to obey "make install", edit these settings for your |
| 59 |
|
# system. BINDIR is the directory in which the pgrep command is installed. |
| 60 |
|
# INCDIR is the directory in which the public header file pcre.h is installed. |
| 61 |
|
# LIBDIR is the directory in which the libraries are installed. MANDIR is the |
| 62 |
|
# directory in which the man pages are installed. The pcretest program, as it |
| 63 |
|
# is a test program, does not get installed anywhere. |
| 64 |
|
|
| 65 |
|
BINDIR = /usr/local/bin |
| 66 |
|
INCDIR = /usr/local/include |
| 67 |
|
LIBDIR = /usr/local/lib |
| 68 |
|
MANDIR = /usr/local/man |
| 69 |
|
|
| 70 |
OBJ = chartables.o study.o pcre.o |
|
| 71 |
|
############################################################################## |
| 72 |
|
|
| 73 |
|
|
| 74 |
|
OBJ = maketables.o get.o study.o pcre.o |
| 75 |
|
|
| 76 |
all: libpcre.a libpcreposix.a pcretest pgrep |
all: libpcre.a libpcreposix.a pcretest pgrep |
| 77 |
|
|
| 79 |
$(CC) $(CFLAGS) -o pgrep pgrep.o libpcre.a |
$(CC) $(CFLAGS) -o pgrep pgrep.o libpcre.a |
| 80 |
|
|
| 81 |
pcretest: libpcre.a libpcreposix.a pcretest.o |
pcretest: libpcre.a libpcreposix.a pcretest.o |
| 82 |
$(CC) $(CFLAGS) -o pcretest pcretest.o libpcre.a libpcreposix.a |
$(PURIFY) $(CC) $(CFLAGS) -o pcretest pcretest.o libpcre.a libpcreposix.a |
| 83 |
|
|
| 84 |
libpcre.a: $(OBJ) |
libpcre.a: $(OBJ) |
| 85 |
/bin/rm -f libpcre.a |
-rm -f libpcre.a |
| 86 |
ar cq libpcre.a $(OBJ) |
$(AR) libpcre.a $(OBJ) |
| 87 |
$(RANLIB) libpcre.a |
$(RANLIB) libpcre.a |
| 88 |
|
|
| 89 |
libpcreposix.a: pcreposix.o |
libpcreposix.a: pcreposix.o |
| 90 |
/bin/rm -f libpcreposix.a |
-rm -f libpcreposix.a |
| 91 |
ar cq libpcreposix.a pcreposix.o |
$(AR) libpcreposix.a pcreposix.o |
| 92 |
$(RANLIB) libpcreposix.a |
$(RANLIB) libpcreposix.a |
| 93 |
|
|
| 94 |
pcre.o: pcre.c pcre.h internal.h Makefile |
pcre.o: chartables.c pcre.c pcre.h internal.h Makefile |
| 95 |
$(CC) -c $(CFLAGS) pcre.c |
$(CC) -c $(CFLAGS) pcre.c |
| 96 |
|
|
| 97 |
pcreposix.o: pcreposix.c pcreposix.h internal.h Makefile |
pcreposix.o: pcreposix.c pcreposix.h internal.h pcre.h Makefile |
| 98 |
$(CC) -c $(CFLAGS) pcreposix.c |
$(CC) -c $(CFLAGS) pcreposix.c |
| 99 |
|
|
| 100 |
chartables.o: chartables.c |
maketables.o: maketables.c pcre.h internal.h Makefile |
| 101 |
$(CC) -c $(CFLAGS) chartables.c |
$(CC) -c $(CFLAGS) maketables.c |
| 102 |
|
|
| 103 |
|
get.o: get.c pcre.h internal.h Makefile |
| 104 |
|
$(CC) -c $(CFLAGS) get.c |
| 105 |
|
|
| 106 |
study.o: study.c pcre.h internal.h Makefile |
study.o: study.c pcre.h internal.h Makefile |
| 107 |
$(CC) -c $(CFLAGS) study.c |
$(CC) -c $(CFLAGS) study.c |
| 112 |
pgrep.o: pgrep.c pcre.h Makefile |
pgrep.o: pgrep.c pcre.h Makefile |
| 113 |
$(CC) -c $(CFLAGS) pgrep.c |
$(CC) -c $(CFLAGS) pgrep.c |
| 114 |
|
|
| 115 |
# An auxiliary program makes the character tables |
# An auxiliary program makes the default character table source |
| 116 |
|
|
| 117 |
chartables.c: maketables |
chartables.c: dftables |
| 118 |
./maketables >chartables.c |
./dftables >chartables.c |
| 119 |
|
|
| 120 |
maketables: maketables.c Makefile |
dftables: dftables.c maketables.c pcre.h internal.h Makefile |
| 121 |
$(CC) -o maketables $(CFLAGS) maketables.c |
$(CC) -o dftables $(CFLAGS) dftables.c |
| 122 |
|
|
| 123 |
# We deliberately omit maketables and chartables.c from 'make clean'; once made |
install: all |
| 124 |
|
cp libpcre.a libpcreposix.a $(LIBDIR) |
| 125 |
|
cp pcre.h $(INCDIR) |
| 126 |
|
cp pgrep $(BINDIR) |
| 127 |
|
cp pcre.3 pcreposix.3 $(MANDIR)/man3 |
| 128 |
|
cp pgrep.1 $(MANDIR)/man1 |
| 129 |
|
|
| 130 |
|
# We deliberately omit dftables and chartables.c from 'make clean'; once made |
| 131 |
# chartables.c shouldn't change, and if people have edited the tables by hand, |
# chartables.c shouldn't change, and if people have edited the tables by hand, |
| 132 |
# you don't want to throw them away. |
# you don't want to throw them away. |
| 133 |
|
|
| 134 |
clean:; /bin/rm -f *.o *.a pcretest pgrep |
clean:; -rm -f *.o *.a pcretest pgrep |
|
|
|
|
# Run the tests |
|
| 135 |
|
|
| 136 |
runtest: all |
runtest: all |
| 137 |
./pcretest testinput testtry |
./RunTest |
| 138 |
diff testtry testoutput |
|
| 139 |
./pcretest -i testinput2 testtry |
######## MINGW32 ############### MINGW32 ############### MINGW32 ############# |
| 140 |
diff testtry testoutput2 |
|
| 141 |
rm -f testtry |
# This addition for mingw32 was contributed by Paul Sokolovsky |
| 142 |
|
# <Paul.Sokolovsky@technologist.com>. I (PH) don't know anything about it! |
| 143 |
|
|
| 144 |
|
dll: _dll libpcre.dll.a pgrep_d pcretest_d |
| 145 |
|
|
| 146 |
|
_dll: |
| 147 |
|
$(MAKE) CFLAGS=-DSTATIC pcre.dll |
| 148 |
|
|
| 149 |
|
pcre.dll: $(OBJ) pcreposix.o pcre.def |
| 150 |
|
libpcre.dll.a: pcre.def |
| 151 |
|
|
| 152 |
|
pgrep_d: libpcre.dll.a pgrep.o |
| 153 |
|
$(CC) $(CFLAGS) -L. -o pgrep pgrep.o -lpcre.dll |
| 154 |
|
|
| 155 |
|
pcretest_d: libpcre.dll.a pcretest.o |
| 156 |
|
$(PURIFY) $(CC) $(CFLAGS) -L. -o pcretest pcretest.o -lpcre.dll |
| 157 |
|
|
| 158 |
# End |
# End |