Commit 14d309cc authored by Tom Lane's avatar Tom Lane

Fix missing dependencies in ecpg's test Makefiles.

Ensure that ecpg preprocessor output files are rebuilt when re-testing
after a change in the ecpg preprocessor itself, or a change in any of
several include files that get copied verbatim into the output files.
The lack of these dependencies was what created problems for Kevin Grittner
after the recent pgindent run.  There's no way for --enable-depend to
discover these dependencies automatically, so we've gotta put them into
the Makefiles by hand.

While at it, reduce the amount of duplication in the ecpg invocations.
parent fb1974cc
# 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)
......@@ -5,13 +8,25 @@ 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)
......@@ -3,9 +3,8 @@ top_builddir = ../../../../..
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)
......@@ -22,26 +21,5 @@ TESTS = test_informix test_informix.c \
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 $@ $<
......@@ -19,14 +19,14 @@ TESTS = array_of_struct array_of_struct.c \
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 $@ $<
......@@ -26,5 +26,5 @@ TESTS = array array.c \
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 $@ $<
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment