1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00
Files
postgres/src/interfaces/ecpg/preproc/Makefile
Peter Eisentraut 8521d13194 Refactor flex and bison make rules
Numerous flex and bison make rules have appeared in the source tree
over time, and they are all virtually identical, so we can replace
them by pattern rules with some variables for customization.

Users of pgxs will also be able to benefit from this.
2012-10-11 06:57:04 -04:00

77 lines
2.2 KiB
Makefile

#-------------------------------------------------------------------------
#
# Makefile for src/interfaces/ecpg/preproc
#
# Copyright (c) 1998-2012, 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
MAJOR_VERSION= 4
MINOR_VERSION= 9
PATCHLEVEL=0
override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I. -I$(srcdir) -DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
$(CPPFLAGS)
override CFLAGS += $(PTHREAD_CFLAGS) -DECPG_COMPILE
OBJS= preproc.o type.o ecpg.o output.o parser.o \
keywords.o c_keywords.o ecpg_keywords.o kwlookup.o ../ecpglib/typename.o descriptor.o variable.o \
$(WIN32RES)
all: ecpg
ecpg: $(OBJS) | submake-libpgport
$(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) $^ $(LIBS) $(PTHREAD_LIBS) -o $@$(X)
../ecpglib/typename.o: ../ecpglib/typename.c
$(MAKE) -C $(dir $@) $(notdir $@)
# pgc is compiled as part of preproc
preproc.o: pgc.c
preproc.h: preproc.c ;
preproc.c: BISONFLAGS += -d
preproc.y: ../../../backend/parser/gram.y parse.pl ecpg.addons ecpg.header ecpg.tokens ecpg.trailer ecpg.type
$(PERL) $(srcdir)/parse.pl $(srcdir) < $< > $@
$(PERL) $(srcdir)/check_rules.pl $(srcdir) $<
ecpg_keywords.o c_keywords.o keywords.o preproc.o parser.o: preproc.h
kwlookup.c: % : $(top_srcdir)/src/backend/parser/%
rm -f $@ && $(LN_S) $< .
distprep: preproc.y preproc.c preproc.h pgc.c
install: all installdirs
$(INSTALL_PROGRAM) ecpg$(X) '$(DESTDIR)$(bindir)'
installdirs:
$(MKDIR_P) '$(DESTDIR)$(bindir)'
uninstall:
rm -f '$(DESTDIR)$(bindir)/ecpg$(X)'
clean distclean:
rm -f kwlookup.c *.o ecpg$(X)
# garbage from development
@rm -f core a.out
# `make distclean' must not remove preproc.y, preproc.c, preproc.h, or pgc.c
# since we want to ship those files in the distribution for people with
# inadequate tools. Instead, `make maintainer-clean' will remove them.
maintainer-clean: distclean
rm -f preproc.y preproc.c preproc.h pgc.c