mirror of
https://github.com/postgres/postgres.git
synced 2026-02-18 01:59:53 -05:00
parse.pl and check_rules.pl used "no warnings 'uninitialized'", which doesn't seem like it measures up to current project standards. Removing that shows that it was hiding various places that accessed off the end of an array, which are easily protected by minor logic adjustments. There's no change in the script results. While here, improve the Makefile rule that invokes these scripts. It neglected to depend on check_rules.pl, so that editing that file didn't result in re-running the check; and it ran check_rules.pl after building preproc.y, so that if check_rules.pl did fail the next "make" attempt would just bypass it. check_rules.pl failures are sufficiently un-heard-of that I don't feel a need to back-patch this. Discussion: https://postgr.es/m/838180.1658181982@sss.pgh.pa.us
102 lines
2.9 KiB
Makefile
102 lines
2.9 KiB
Makefile
#-------------------------------------------------------------------------
|
|
#
|
|
# Makefile for src/interfaces/ecpg/preproc
|
|
#
|
|
# Copyright (c) 1998-2022, PostgreSQL Global Development Group
|
|
#
|
|
# src/interfaces/ecpg/preproc/Makefile
|
|
#
|
|
#-------------------------------------------------------------------------
|
|
|
|
PGFILEDESC = "ecpg - embedded SQL precompiler for C"
|
|
PGAPPICON=win32
|
|
|
|
subdir = src/interfaces/ecpg/preproc
|
|
top_builddir = ../../../..
|
|
include $(top_builddir)/src/Makefile.global
|
|
|
|
override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
|
|
-I. -I$(srcdir) \
|
|
-I$(top_srcdir)/src/interfaces/ecpg/ecpglib \
|
|
-I$(libpq_srcdir) \
|
|
$(CPPFLAGS)
|
|
|
|
override CFLAGS += $(PTHREAD_CFLAGS)
|
|
|
|
OBJS = \
|
|
$(WIN32RES) \
|
|
c_keywords.o \
|
|
descriptor.o \
|
|
ecpg.o \
|
|
ecpg_keywords.o \
|
|
keywords.o \
|
|
output.o \
|
|
parser.o \
|
|
pgc.o \
|
|
preproc.o \
|
|
type.o \
|
|
typename.o \
|
|
variable.o
|
|
|
|
# where to find gen_keywordlist.pl and subsidiary files
|
|
TOOLSDIR = $(top_srcdir)/src/tools
|
|
GEN_KEYWORDLIST = $(PERL) -I $(TOOLSDIR) $(TOOLSDIR)/gen_keywordlist.pl
|
|
GEN_KEYWORDLIST_DEPS = $(TOOLSDIR)/gen_keywordlist.pl $(TOOLSDIR)/PerfectHash.pm
|
|
|
|
# Suppress parallel build to avoid a bug in GNU make 3.82
|
|
# (see comments in ../Makefile)
|
|
ifeq ($(MAKE_VERSION),3.82)
|
|
.NOTPARALLEL:
|
|
endif
|
|
|
|
all: ecpg
|
|
|
|
ecpg: $(OBJS) | submake-libpgport
|
|
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) $(PTHREAD_LIBS) -o $@$(X)
|
|
|
|
# We symlink typename.c from ecpglib and recompile it here
|
|
typename.c: % : $(top_srcdir)/src/interfaces/ecpg/ecpglib/%
|
|
rm -f $@ && $(LN_S) $< .
|
|
|
|
# See notes in src/backend/parser/Makefile about the following two rules
|
|
preproc.h: preproc.c
|
|
touch $@
|
|
|
|
preproc.c: BISONFLAGS += -d
|
|
|
|
preproc.y: ../../../backend/parser/gram.y parse.pl check_rules.pl ecpg.addons ecpg.header ecpg.tokens ecpg.trailer ecpg.type
|
|
$(PERL) $(srcdir)/check_rules.pl --srcdir $(srcdir) --parser $<
|
|
$(PERL) $(srcdir)/parse.pl --srcdir $(srcdir) --parser $< --output $@
|
|
|
|
# generate keyword headers
|
|
c_kwlist_d.h: c_kwlist.h $(GEN_KEYWORDLIST_DEPS)
|
|
$(GEN_KEYWORDLIST) --varname ScanCKeywords --no-case-fold $<
|
|
|
|
ecpg_kwlist_d.h: ecpg_kwlist.h $(GEN_KEYWORDLIST_DEPS)
|
|
$(GEN_KEYWORDLIST) --varname ScanECPGKeywords $<
|
|
|
|
# Force these dependencies to be known even without dependency info built:
|
|
ecpg_keywords.o c_keywords.o keywords.o preproc.o pgc.o parser.o: preproc.h
|
|
ecpg_keywords.o: ecpg_kwlist_d.h
|
|
c_keywords.o: c_kwlist_d.h
|
|
keywords.o: $(top_srcdir)/src/include/parser/kwlist.h
|
|
|
|
distprep: preproc.y preproc.c preproc.h pgc.c c_kwlist_d.h ecpg_kwlist_d.h
|
|
|
|
install: all installdirs
|
|
$(INSTALL_PROGRAM) ecpg$(X) '$(DESTDIR)$(bindir)'
|
|
|
|
installdirs:
|
|
$(MKDIR_P) '$(DESTDIR)$(bindir)'
|
|
|
|
uninstall:
|
|
rm -f '$(DESTDIR)$(bindir)/ecpg$(X)'
|
|
|
|
# preproc.y, preproc.c, preproc.h, pgc.c, c_kwlist_d.h, and ecpg_kwlist_d.h
|
|
# are in the distribution tarball, so they are not cleaned here.
|
|
clean distclean:
|
|
rm -f *.o ecpg$(X)
|
|
rm -f typename.c
|
|
|
|
maintainer-clean: distclean
|
|
rm -f preproc.y preproc.c preproc.h pgc.c c_kwlist_d.h ecpg_kwlist_d.h
|