+# This file is included into the Makefiles of subdirectories of ecpg/test/,
+# so the file references have one more level of .. than you might expect.
+
override CPPFLAGS := -I../../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(libpq_srcdir) $(CPPFLAGS)
override CFLAGS += $(PTHREAD_CFLAGS)
override LDFLAGS := -L../../ecpglib -L../../pgtypeslib $(filter-out -l%, $(libpq)) $(LDFLAGS)
override LIBS := -lecpg -lpgtypes $(filter -l%, $(libpq)) $(LIBS) $(PTHREAD_LIBS)
-ECPG = ../../preproc/ecpg --regression -I$(srcdir)/../../include
+# Standard way to invoke the ecpg preprocessor
+ECPG = ../../preproc/ecpg --regression -I$(srcdir)/../../include -I$(srcdir)
+
+# Files that most or all ecpg preprocessor test outputs depend on
+ECPG_TEST_DEPENDENCIES = ../../preproc/ecpg \
+ $(srcdir)/../regression.h \
+ $(srcdir)/../../include/sqlca.h \
+ $(srcdir)/../../include/sqlda.h \
+ $(srcdir)/../../include/sqltypes.h \
+ $(srcdir)/../../include/sql3types.h
%: %.o
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
-%.c: %.pgc ../regression.h
- $(ECPG) -o $@ -I$(srcdir) $<
+# Caution: this build rule is overridden in some child Makefiles
+# where it's necessary to use nondefault switches to ecpg;
+# make sure those rules match except for the extra switches.
+%.c: %.pgc $(ECPG_TEST_DEPENDENCIES)
+ $(ECPG) -o $@ $<
clean:
rm -f $(TESTS) $(TESTS:%=%.o) $(TESTS:%=%.c)
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/$(subdir)/../Makefile.regress
-# special informix compatibility switches
+# Use special informix compatibility switch for all tests in this directory
ECPG += -C INFORMIX
-ECPG_NOIND = $(ECPG) -r no_indicator
override LDFLAGS := -L../../compatlib $(LDFLAGS)
override LIBS := -lecpg_compat $(LIBS)
all: $(TESTS)
-test_informix.c: test_informix.pgc ../regression.h
- $(ECPG) -o $@ -I$(srcdir) $<
-
-test_informix2.c: test_informix2.pgc ../regression.h
- $(ECPG) -o $@ -I$(srcdir) $<
-
-sqlda.c: sqlda.pgc ../regression.h
- $(ECPG) -o $@ -I$(srcdir) $<
-
-dec_test.c: dec_test.pgc ../regression.h
- $(ECPG) -o $@ -I$(srcdir) $<
-
-rfmtdate.c: rfmtdate.pgc ../regression.h
- $(ECPG) -o $@ -I$(srcdir) $<
-
-rfmtlong.c: rfmtlong.pgc ../regression.h
- $(ECPG) -o $@ -I$(srcdir) $<
-
-rnull.c: rnull.pgc ../regression.h
- $(ECPG_NOIND) -o $@ -I$(srcdir) $<
-
-charfuncs.c: charfuncs.pgc ../regression.h
- $(ECPG) -o $@ -I$(srcdir) $<
+rnull.c: rnull.pgc $(ECPG_TEST_DEPENDENCIES)
+ $(ECPG) -r no_indicator -o $@ $<
all: $(TESTS)
-array_of_struct.c: array_of_struct.pgc ../regression.h
- $(ECPG) -c -o $@ -I$(srcdir) $<
+array_of_struct.c: array_of_struct.pgc $(ECPG_TEST_DEPENDENCIES)
+ $(ECPG) -c -o $@ $<
-pointer_to_struct.c: pointer_to_struct.pgc ../regression.h
- $(ECPG) -c -o $@ -I$(srcdir) $<
+pointer_to_struct.c: pointer_to_struct.pgc $(ECPG_TEST_DEPENDENCIES)
+ $(ECPG) -c -o $@ $<
-autoprep.c: autoprep.pgc ../regression.h
- $(ECPG) -r prepare -o $@ -I$(srcdir) $<
+autoprep.c: autoprep.pgc $(ECPG_TEST_DEPENDENCIES)
+ $(ECPG) -r prepare -o $@ $<
-strings.c: strings.pgc strings.h ../regression.h
- $(ECPG) -i -o $@ -I$(srcdir) $<
+strings.c: strings.pgc strings.h $(ECPG_TEST_DEPENDENCIES)
+ $(ECPG) -i -o $@ $<
all: $(TESTS)
-oldexec.c: oldexec.pgc ../regression.h
- $(ECPG) -r questionmarks -o $@ -I$(srcdir) $<
+oldexec.c: oldexec.pgc $(ECPG_TEST_DEPENDENCIES)
+ $(ECPG) -r questionmarks -o $@ $<