2 # Makefile.in for PCRE (Perl-Compatible Regular Expression) library.
4 #---------------------------------------------------------------------------#
5 # To build mingw32 DLL uncomment the next two lines. This addition for #
6 # mingw32 was contributed by <Paul.Sokolovsky@technologist.com>. I (Philip #
7 # Hazel) don't know anything about it! There are some additional targets at #
8 # the bottom of this Makefile. #
9 #---------------------------------------------------------------------------#
15 #---------------------------------------------------------------------------#
16 # The next few lines are modified by "configure" to insert data that it is #
17 # given in its arguments, or which it finds out for itself. #
18 #---------------------------------------------------------------------------#
20 # BINDIR is the directory in which the pcregrep command is installed.
21 # INCDIR is the directory in which the public header file pcre.h is installed.
22 # LIBDIR is the directory in which the libraries are installed.
23 # MANDIR is the directory in which the man pages are installed.
24 # The pcretest program, as it is a test program, does not get installed
28 exec_prefix = @exec_prefix@
40 # LIBTOOL defaults to "./libtool", which enables the building of shared
41 # libraries. If "configure" is called with --disable-shared-libraries, LIBTOOL
42 # is set to "", which stops shared libraries from being built, and LIBSUFFIX
43 # is set to "a" instead of "la", which causes the shared libraries not to be
47 LIBSUFFIX = @LIBSUFFIX@
49 # These are the version numbers for the shared libraries
51 PCRELIBVERSION = @PCRE_LIB_VERSION@
52 PCREPOSIXLIBVERSION = @PCRE_POSIXLIB_VERSION@
55 #---------------------------------------------------------------------------#
56 # A copy of install-sh is in this distribution and is used by default. #
57 #---------------------------------------------------------------------------#
59 INSTALL = ./install-sh -c
60 INSTALL_DATA = ${INSTALL} -m 644
63 #---------------------------------------------------------------------------#
64 # For almost all systems, the command to create a library is "ar cq", but #
65 # there is at least one where it is different, so this command must be #
66 # configurable. However, I haven't got round to learning how to make #
67 # "configure" find this out for itself. It is necessary to use a command #
68 # such as "make AR='ar -rc'" if you need to vary this. The setting of AR is #
69 # *not* passed over to ./ltconfig, because it does its own setting up. #
70 #---------------------------------------------------------------------------#
75 ##############################################################################
78 OBJ = maketables.o get.o study.o pcre.o
79 LOBJ = maketables.lo get.lo study.lo pcre.lo
81 all: libtool libpcre.$(LIBSUFFIX) libpcreposix.$(LIBSUFFIX) pcretest pcregrep
83 libtool: config.guess config.sub ltconfig ltmain.sh
84 @if test "$(LIBTOOL)" = "./libtool"; then \
85 echo '--- Building libtool ---'; \
86 CC=$(CC) CFLAGS='$(CFLAGS)' RANLIB='$(RANLIB)' ./ltconfig ./ltmain.sh; \
87 echo '--- Built libtool ---'; fi
89 pcregrep: libpcre.$(LIBSUFFIX) pcregrep.o
91 @echo '--- Building pcregrep utility'
93 $(LIBTOOL) $(CC) $(CFLAGS) -o pcregrep pcregrep.o libpcre.$(LIBSUFFIX)
95 pcretest: libpcre.$(LIBSUFFIX) libpcreposix.$(LIBSUFFIX) pcretest.o
97 @echo '--- Building pcretest testing program'
99 $(LIBTOOL) $(PURIFY) $(CC) $(CFLAGS) -o pcretest pcretest.o \
100 libpcre.$(LIBSUFFIX) libpcreposix.$(LIBSUFFIX)
104 @echo '--- Building static library: libpcre'
107 $(AR) libpcre.a $(OBJ)
112 @echo '--- Building shared library: libpcre'
115 ./libtool $(CC) -version-info '$(PCRELIBVERSION)' -o libpcre.la -rpath $(LIBDIR) $(LOBJ)
117 libpcreposix.a: pcreposix.o
119 @echo '--- Building static library: libpcreposix'
121 -rm -f libpcreposix.a
122 $(AR) libpcreposix.a pcreposix.o
123 $(RANLIB) libpcreposix.a
125 libpcreposix.la: pcreposix.o
127 @echo '--- Building shared library: libpcreposix'
129 -rm -f libpcreposix.la
130 ./libtool $(CC) -version-info '$(PCREPOSIXLIBVERSION)' -o libpcreposix.la -rpath $(LIBDIR) pcreposix.lo
132 pcre.o: chartables.c pcre.c pcre.h internal.h config.h Makefile
133 $(LIBTOOL) $(CC) -c $(CFLAGS) $(UTF8) pcre.c
135 pcreposix.o: pcreposix.c pcreposix.h internal.h pcre.h config.h Makefile
136 $(LIBTOOL) $(CC) -c $(CFLAGS) pcreposix.c
138 maketables.o: maketables.c pcre.h internal.h config.h Makefile
139 $(LIBTOOL) $(CC) -c $(CFLAGS) maketables.c
141 get.o: get.c pcre.h internal.h config.h Makefile
142 $(LIBTOOL) $(CC) -c $(CFLAGS) get.c
144 study.o: study.c pcre.h internal.h config.h Makefile
145 $(LIBTOOL) $(CC) -c $(CFLAGS) $(UTF8) study.c
147 pcretest.o: pcretest.c pcre.h config.h Makefile
148 $(CC) -c $(CFLAGS) $(UTF8) pcretest.c
150 pcregrep.o: pcregrep.c pcre.h Makefile config.h
151 $(CC) -c $(CFLAGS) $(UTF8) pcregrep.c
153 # An auxiliary program makes the default character table source
155 chartables.c: dftables
156 ./dftables >chartables.c
158 dftables: dftables.c maketables.c pcre.h internal.h config.h Makefile
159 $(CC) -o dftables $(CFLAGS) dftables.c
162 $(LIBTOOL) $(INSTALL_DATA) libpcre.$(LIBSUFFIX) $(DESTDIR)/$(LIBDIR)/libpcre.$(LIBSUFFIX)
163 $(LIBTOOL) $(INSTALL_DATA) libpcreposix.$(LIBSUFFIX) $(DESTDIR)/$(LIBDIR)/libpcreposix.$(LIBSUFFIX)
164 $(INSTALL_DATA) pcre.h $(DESTDIR)/$(INCDIR)/pcre.h
165 $(INSTALL_DATA) pcreposix.h $(DESTDIR)/$(INCDIR)/pcreposix.h
166 $(INSTALL_DATA) doc/pcre.3 $(DESTDIR)/$(MANDIR)/man3/pcre.3
167 $(INSTALL_DATA) doc/pcreposix.3 $(DESTDIR)/$(MANDIR)/man3/pcreposix.3
168 $(INSTALL_DATA) doc/pcregrep.1 $(DESTDIR)/$(MANDIR)/man1/pcregrep.1
169 @if test "$(LIBTOOL)" = "./libtool"; then \
171 echo '--- Rebuilding pcregrep to use installed shared library ---'; \
172 echo $(CC) $(CFLAGS) -o pcregrep pcregrep.o -L$(DESTDIR)/$(LIBDIR) -lpcre; \
173 $(CC) $(CFLAGS) -o pcregrep pcregrep.o -L$(DESTDIR)/$(LIBDIR) -lpcre; \
174 echo '--- Rebuilding pcretest to use installed shared library ---'; \
175 echo $(CC) $(CFLAGS) -o pcretest pcretest.o -L$(DESTDIR)/$(LIBDIR) -lpcre -lpcreposix; \
176 $(CC) $(CFLAGS) -o pcretest pcretest.o -L$(DESTDIR)/$(LIBDIR) -lpcre -lpcreposix; \
178 $(INSTALL) pcregrep $(DESTDIR)/$(BINDIR)/pcregrep
179 $(INSTALL) pcre-config $(DESTDIR)/$(BINDIR)/pcre-config
181 # We deliberately omit dftables and chartables.c from 'make clean'; once made
182 # chartables.c shouldn't change, and if people have edited the tables by hand,
183 # you don't want to throw them away.
185 clean:; -rm -rf *.o *.lo *.a *.la .libs pcretest pcregrep testtry
187 # But "make distclean" should get back to a virgin distribution
190 -rm -f chartables.c libtool pcre-config pcre.h \
191 Makefile config.h config.status config.log config.cache
200 ######## MINGW32 ############### MINGW32 ############### MINGW32 #############
202 # This addition for mingw32 was contributed by Paul Sokolovsky
203 # <Paul.Sokolovsky@technologist.com>. I (PH) don't know anything about it!
205 dll: _dll libpcre.dll.a pcregrep_d pcretest_d
208 $(MAKE) CFLAGS=-DSTATIC pcre.dll
210 pcre.dll: $(OBJ) pcreposix.o pcre.def
211 libpcre.dll.a: pcre.def
213 pcregrep_d: libpcre.dll.a pcregrep.o
214 $(CC) $(CFLAGS) -L. -o pcregrep pcregrep.o -lpcre.dll
216 pcretest_d: libpcre.dll.a pcretest.o
217 $(PURIFY) $(CC) $(CFLAGS) -L. -o pcretest pcretest.o -lpcre.dll