OSDN Git Service

Fix the isolation tester compilation on VPATH builds
[pg-rex/syncrep.git] / src / test / isolation / Makefile
1 #
2 # Makefile for isolation tests
3 #
4
5 subdir = src/test/isolation
6 top_builddir = ../../..
7 include $(top_builddir)/src/Makefile.global
8
9 ifeq ($(PORTNAME), win32)
10 LDLIBS += -lws2_32
11 endif
12
13 override CPPFLAGS := -I$(srcdir) -I$(libpq_srcdir) $(CPPFLAGS)
14 override LDLIBS := $(libpq_pgport) $(LDLIBS)
15
16 OBJS =  specparse.o isolationtester.o
17
18 submake-regress:
19         $(MAKE) -C $(top_builddir)/src/test/regress pg_regress.o
20
21 pg_regress.o: | submake-regress
22         rm -f $@ && $(LN_S) $(top_builddir)/src/test/regress/pg_regress.o .
23
24 pg_isolation_regress: isolation_main.o pg_regress.o
25         $(CC) $(CFLAGS) $^ $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
26
27 all: isolationtester pg_isolation_regress
28
29 isolationtester: $(OBJS) | submake-libpq submake-libpgport
30         $(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
31
32 distprep: specparse.c
33
34 # There is no correct way to write a rule that generates two files.
35 # Rules with two targets don't have that meaning, they are merely
36 # shorthand for two otherwise separate rules.  To be safe for parallel
37 # make, we must chain the dependencies like this.  The semicolon is
38 # important, otherwise make will choose the built-in rule for
39 # gram.y=>gram.c.
40
41 all: isolationtester$(X) pg_isolation_regress$(X)
42
43 specparse.h: specparse.c ;
44
45 # specscanner is compiled as part of specparse
46 specparse.o: specscanner.c
47
48 specparse.c: specparse.y
49 ifdef BISON
50         $(BISON) $(BISONFLAGS) -o $@ $<
51 else
52         @$(missing) bison $< $@
53 endif
54
55 specscanner.c: specscanner.l
56 ifdef FLEX
57         $(FLEX) $(FLEXFLAGS) -o'$@' $<
58 else
59         @$(missing) flex $< $@
60 endif
61 # specparse.c is in the distribution tarball, so is not cleaned here
62 clean distclean:
63         rm -f isolationtester$(X) pg_isolation_regress$(X) $(OBJS) isolation_main.o
64         rm -f pg_regress.o
65         rm -rf results
66
67 maintainer-clean: distclean
68         rm -f specparse.c specscanner.c
69
70 installcheck: all
71         ./pg_isolation_regress --schedule=$(srcdir)/isolation_schedule
72
73 check: all
74         ./pg_isolation_regress --temp-install=./tmp_check --top-builddir=$(top_builddir) --schedule=$(srcdir)/isolation_schedule