1# This file is included into the Makefiles of subdirectories of ecpg/test/,
2# so the file references have one more level of .. than you might expect.
3
4override CPPFLAGS := -I../../include -I$(top_srcdir)/src/interfaces/ecpg/include \
5	-I$(libpq_srcdir) $(CPPFLAGS)
6override CFLAGS += $(PTHREAD_CFLAGS)
7
8LDFLAGS_INTERNAL += -L../../ecpglib -lecpg -L../../pgtypeslib -lpgtypes $(libpq)
9
10override LIBS += $(PTHREAD_LIBS)
11
12# Standard way to invoke the ecpg preprocessor
13ECPG = ../../preproc/ecpg --regression -I$(srcdir)/../../include -I$(srcdir)
14
15# Files that most or all ecpg preprocessor test outputs depend on
16ECPG_TEST_DEPENDENCIES = ../../preproc/ecpg$(X) \
17	$(srcdir)/../regression.h \
18	$(srcdir)/../../include/sqlca.h \
19	$(srcdir)/../../include/sqlda.h \
20	$(srcdir)/../../include/sqltypes.h \
21	$(srcdir)/../../include/sql3types.h
22
23%: %.o
24	$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
25
26# Caution: this build rule is overridden in some child Makefiles
27# where it's necessary to use nondefault switches to ecpg;
28# make sure those rules match except for the extra switches.
29%.c: %.pgc $(ECPG_TEST_DEPENDENCIES)
30	$(ECPG) -o $@ $<
31
32clean:
33	rm -f $(TESTS) $(TESTS:%=%.o) $(TESTS:%=%.c)
34