top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
-OBJS = dynahash.o hashfn.o pg_crc.o
+OBJS = dynahash.o hashfn.o
include $(top_srcdir)/src/backend/common.mk
-/pg_crc.c
-
/pg_controldata
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
-OBJS= pg_controldata.o pg_crc.o $(WIN32RES)
+OBJS= pg_controldata.o $(WIN32RES)
all: pg_controldata
pg_controldata: $(OBJS) | submake-libpgport
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
-pg_crc.c: $(top_srcdir)/src/backend/utils/hash/pg_crc.c
- rm -f $@ && $(LN_S) $< .
-
install: all installdirs
$(INSTALL_PROGRAM) pg_controldata$(X) '$(DESTDIR)$(bindir)/pg_controldata$(X)'
rm -f '$(DESTDIR)$(bindir)/pg_controldata$(X)'
clean distclean maintainer-clean:
- rm -f pg_controldata$(X) $(OBJS) pg_crc.c
+ rm -f pg_controldata$(X) $(OBJS)
-/pg_crc.c
-
/pg_resetxlog
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
-OBJS= pg_resetxlog.o pg_crc.o $(WIN32RES)
+OBJS= pg_resetxlog.o $(WIN32RES)
all: pg_resetxlog
pg_resetxlog: $(OBJS) | submake-libpgport
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
-pg_crc.c: $(top_srcdir)/src/backend/utils/hash/pg_crc.c
- rm -f $@ && $(LN_S) $< .
-
install: all installdirs
$(INSTALL_PROGRAM) pg_resetxlog$(X) '$(DESTDIR)$(bindir)/pg_resetxlog$(X)'
rm -f '$(DESTDIR)$(bindir)/pg_resetxlog$(X)'
clean distclean maintainer-clean:
- rm -f pg_resetxlog$(X) $(OBJS) pg_crc.c
+ rm -f pg_resetxlog$(X) $(OBJS)
/*-------------------------------------------------------------------------
*
- * pg_crc.c
- * PostgreSQL CRC support
+ * pg_crc_tables.h
+ * Polynomial lookup tables for CRC macros
+ *
+ * We make these tables available as a .h file so that programs not linked
+ * with libpgport can still use the macros in pg_crc.h. They just need
+ * to #include this header as well.
*
* See Ross Williams' excellent introduction
* A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS, available from
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- *
- * IDENTIFICATION
- * src/backend/utils/hash/pg_crc.c
+ * src/include/utils/pg_crc_tables.h
*
*-------------------------------------------------------------------------
*/
-
-/* Use c.h so that this file can be built in either frontend or backend */
-#include "c.h"
-
+#ifndef PG_CRC_TABLES_H
+#define PG_CRC_TABLES_H
/*
* This table is based on the polynomial
#endif /* SIZEOF_VOID_P < 8 */
#endif /* PROVIDE_64BIT_CRC */
+
+#endif /* PG_CRC_TABLES_H */
LIBS += $(PTHREAD_LIBS)
OBJS = $(LIBOBJS) chklocale.o dirmod.o erand48.o exec.o fls.o inet_net_ntop.o \
- noblock.o path.o pgcheckdir.o pgmkdirp.o pgsleep.o pgstrcasecmp.o \
- qsort.o qsort_arg.o sprompt.o thread.o
+ noblock.o path.o pgcheckdir.o pg_crc.o pgmkdirp.o pgsleep.o \
+ pgstrcasecmp.o qsort.o qsort_arg.o sprompt.o thread.o
# foo_srv.o and foo.o are both built from foo.c, but only foo.o has -DFRONTEND
OBJS_SRV = $(OBJS:%.o=%_srv.o)
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * pg_crc.c
+ * PostgreSQL CRC support
+ *
+ * This file simply #includes the CRC table definitions so that they are
+ * available to programs linked with libpgport.
+ *
+ * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ * src/port/pg_crc.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "c.h"
+
+#include "utils/pg_crc_tables.h"
$mf =~ s{OBJS[^=]*=\s*(.*)$}{}m;
}
- # Match rules that pull in source files from different directories
- # example: pg_crc.c: $(top_srcdir)/src/backend/utils/hash/pg_crc.c
+ # Match rules that pull in source files from different directories, eg
+ # pgstrcasecmp.c rint.c snprintf.c: % : $(top_srcdir)/src/port/%
my $replace_re = qr{^([^:\n\$]+\.c)\s*:\s*(?:%\s*: )?\$(\([^\)]+\))\/(.*)\/[^\/]+$}m;
while ($mf =~ m{$replace_re}m)
{