File: Makefile

package info (click to toggle)
pcre 1.09-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 468 kB
  • ctags: 290
  • sloc: ansic: 3,710; makefile: 135; perl: 103; sh: 5
file content (164 lines) | stat: -rw-r--r-- 4,375 bytes parent folder | download | duplicates (2)
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
# Make file for PCRE (Perl-Compatible Regular Expression) library.

# Edit these definitions for your system

# Should shared libraries be built: uncomment this to build them
BUILD-SHARED = true

# C Compiler to use 
CC = gcc

# Options for compiling executables and static library modules
#
# 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.
CFLAGS = -O2

# Command used to index static libraries
#
# It is believed that RANLIB=ranlib is required for AIX, BSDI, FreeBSD, Linux,
# MIPS RISCOS, NetBSD, OpenBSD, Digital Unix, and Ultrix.
#RANLIB = @true
RANLIB = ranlib

# Options for compiling shared library modules
CFLAGS-PIC = $(CFLAGS) -fPIC

# Command to build a shared library
# $@ will be replaced by the name of the library, eg libpcre.so.1
MK-SHARED-LIB = gcc -shared -Wl,-soname,$@ -o $@ -lc

# Options to add a run-time library path to a program. This is used when
# building pcretest, and allows the tests to be run with the libraries still
# in this directory. This allows the libraries to be tested before they're
# installed over the old working set!
RPATH = -Wl,-rpath,.

# Everything below this line should not need modification
##########################################################################

OBJ = chartables.o study.o pcre.o
PICOBJ = chartables.o-pic study.o-pic pcre.o-pic

ifdef BUILD-SHARED # Building shared libs
all:            libpcre.a libpcreposix.a libpcre.so.1 libpcreposix.so.1 \
							pcretest pgrep

# This assumes that anyone building shared libraries will want to use
# them for pgrep and pcretest. Is this a good assumption?

pgrep:          libpcre.so.1 pgrep.o
		$(CC) $(CFLAGS) -o pgrep pgrep.o libpcre.so.1

pcretest:       libpcre.so.1 libpcreposix.so.1 pcretest.o
		$(CC) $(CFLAGS) -o pcretest pcretest.o libpcre.so.1 \
				libpcreposix.so.1 $(RPATH)

else # Not building shared libs
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
endif


# Libraries

libpcre.so.1:	$(PICOBJ)
		$(MK-SHARED-LIB) $(PICOBJ)

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

libpcreposix.so.1: pcreposix.o-pic
		$(MK-SHARED-LIB) -L. -lpcre pcreposix.o-pic
 
libpcreposix.a: pcreposix.o
		/bin/rm -f libpcreposix.a
		ar cq libpcreposix.a pcreposix.o
		$(RANLIB) libpcreposix.a


# Object files for libraries

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

pcre.o-pic:	pcre.c pcre.h internal.h
		$(CC) -c $(CFLAGS-PIC) -o $@ pcre.c

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

pcreposix.o-pic:	pcreposix.c pcreposix.h internal.h
		$(CC) -c $(CFLAGS-PIC) -o $@ pcreposix.c

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

chartables.o-pic:	chartables.c
		$(CC) -c $(CFLAGS-PIC) -o $@ chartables.c

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

study.o-pic:    study.c pcre.h internal.h
		$(CC) -c $(CFLAGS-PIC) -o $@ study.c


# Object files for extra programs

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

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


# An auxiliary program makes the character tables

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

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


# Regression test

test: 		all

		# First test
	        ./pcretest testinput >my-testoutput
	        diff -u3 testoutput my-testoutput

		# Second test
	        ./pcretest -i testinput2 >my-testoutput2
	        diff -u3 testoutput2 my-testoutput2

		rm my-testoutput*

# 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:;         rm -f *.o *.o-pic *.a *.so* pcretest pgrep

distclean:	clean
		rm -f maketables chartables.c

# Declare which targets are phony, i.e. do not really result in files of 
# that name

.PHONY:	all test clean distclean

# End