File tree Expand file tree Collapse file tree 9 files changed +41
-28
lines changed Expand file tree Collapse file tree 9 files changed +41
-28
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,6 @@ subdir = src/backend/utils/hash
12
12
top_builddir = ../../../..
13
13
include $(top_builddir ) /src/Makefile.global
14
14
15
- OBJS = dynahash.o hashfn.o pg_crc.o
15
+ OBJS = dynahash.o hashfn.o
16
16
17
17
include $(top_srcdir ) /src/backend/common.mk
Original file line number Diff line number Diff line change 1
- /pg_crc.c
2
-
3
1
/pg_controldata
Original file line number Diff line number Diff line change @@ -15,16 +15,13 @@ subdir = src/bin/pg_controldata
15
15
top_builddir = ../../..
16
16
include $(top_builddir ) /src/Makefile.global
17
17
18
- OBJS = pg_controldata.o pg_crc.o $(WIN32RES )
18
+ OBJS = pg_controldata.o $(WIN32RES )
19
19
20
20
all : pg_controldata
21
21
22
22
pg_controldata : $(OBJS ) | submake-libpgport
23
23
$(CC ) $(CFLAGS ) $^ $(LDFLAGS ) $(LDFLAGS_EX ) $(LIBS ) -o $@ $(X )
24
24
25
- pg_crc.c : $(top_srcdir ) /src/backend/utils/hash/pg_crc.c
26
- rm -f $@ && $(LN_S ) $< .
27
-
28
25
install : all installdirs
29
26
$(INSTALL_PROGRAM ) pg_controldata$(X ) ' $(DESTDIR)$(bindir)/pg_controldata$(X)'
30
27
@@ -35,4 +32,4 @@ uninstall:
35
32
rm -f ' $(DESTDIR)$(bindir)/pg_controldata$(X)'
36
33
37
34
clean distclean maintainer-clean :
38
- rm -f pg_controldata$(X ) $(OBJS ) pg_crc.c
35
+ rm -f pg_controldata$(X ) $(OBJS )
Original file line number Diff line number Diff line change 1
- /pg_crc.c
2
-
3
1
/pg_resetxlog
Original file line number Diff line number Diff line change @@ -15,16 +15,13 @@ subdir = src/bin/pg_resetxlog
15
15
top_builddir = ../../..
16
16
include $(top_builddir ) /src/Makefile.global
17
17
18
- OBJS = pg_resetxlog.o pg_crc.o $(WIN32RES )
18
+ OBJS = pg_resetxlog.o $(WIN32RES )
19
19
20
20
all : pg_resetxlog
21
21
22
22
pg_resetxlog : $(OBJS ) | submake-libpgport
23
23
$(CC ) $(CFLAGS ) $^ $(LDFLAGS ) $(LDFLAGS_EX ) $(LIBS ) -o $@ $(X )
24
24
25
- pg_crc.c : $(top_srcdir ) /src/backend/utils/hash/pg_crc.c
26
- rm -f $@ && $(LN_S ) $< .
27
-
28
25
install : all installdirs
29
26
$(INSTALL_PROGRAM ) pg_resetxlog$(X ) ' $(DESTDIR)$(bindir)/pg_resetxlog$(X)'
30
27
@@ -35,4 +32,4 @@ uninstall:
35
32
rm -f ' $(DESTDIR)$(bindir)/pg_resetxlog$(X)'
36
33
37
34
clean distclean maintainer-clean :
38
- rm -f pg_resetxlog$(X ) $(OBJS ) pg_crc.c
35
+ rm -f pg_resetxlog$(X ) $(OBJS )
Original file line number Diff line number Diff line change 1
1
/*-------------------------------------------------------------------------
2
2
*
3
- * pg_crc.c
4
- * PostgreSQL CRC support
3
+ * pg_crc_tables.h
4
+ * Polynomial lookup tables for CRC macros
5
+ *
6
+ * We make these tables available as a .h file so that programs not linked
7
+ * with libpgport can still use the macros in pg_crc.h. They just need
8
+ * to #include this header as well.
5
9
*
6
10
* See Ross Williams' excellent introduction
7
11
* A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS, available from
17
21
* Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
18
22
* Portions Copyright (c) 1994, Regents of the University of California
19
23
*
20
- *
21
- * IDENTIFICATION
22
- * src/backend/utils/hash/pg_crc.c
24
+ * src/include/utils/pg_crc_tables.h
23
25
*
24
26
*-------------------------------------------------------------------------
25
27
*/
26
-
27
- /* Use c.h so that this file can be built in either frontend or backend */
28
- #include "c.h"
29
-
28
+ #ifndef PG_CRC_TABLES_H
29
+ #define PG_CRC_TABLES_H
30
30
31
31
/*
32
32
* This table is based on the polynomial
@@ -513,3 +513,5 @@ const uint64 pg_crc64_table[256] = {
513
513
#endif /* SIZEOF_VOID_P < 8 */
514
514
515
515
#endif /* PROVIDE_64BIT_CRC */
516
+
517
+ #endif /* PG_CRC_TABLES_H */
Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ override CPPFLAGS := -I$(top_builddir)/src/port -DFRONTEND $(CPPFLAGS)
31
31
LIBS += $(PTHREAD_LIBS )
32
32
33
33
OBJS = $(LIBOBJS ) chklocale.o dirmod.o erand48.o exec.o fls.o inet_net_ntop.o \
34
- noblock.o path.o pgcheckdir.o pgmkdirp .o pgsleep .o pgstrcasecmp .o \
35
- qsort.o qsort_arg.o sprompt.o thread.o
34
+ noblock.o path.o pgcheckdir.o pg_crc .o pgmkdirp .o pgsleep .o \
35
+ pgstrcasecmp.o qsort.o qsort_arg.o sprompt.o thread.o
36
36
37
37
# foo_srv.o and foo.o are both built from foo.c, but only foo.o has -DFRONTEND
38
38
OBJS_SRV = $(OBJS:%.o=%_srv.o )
Original file line number Diff line number Diff line change
1
+ /*-------------------------------------------------------------------------
2
+ *
3
+ * pg_crc.c
4
+ * PostgreSQL CRC support
5
+ *
6
+ * This file simply #includes the CRC table definitions so that they are
7
+ * available to programs linked with libpgport.
8
+ *
9
+ * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
10
+ * Portions Copyright (c) 1994, Regents of the University of California
11
+ *
12
+ *
13
+ * IDENTIFICATION
14
+ * src/port/pg_crc.c
15
+ *
16
+ *-------------------------------------------------------------------------
17
+ */
18
+
19
+ #include "c.h"
20
+
21
+ #include "utils/pg_crc_tables.h"
Original file line number Diff line number Diff line change @@ -261,8 +261,8 @@ sub AddDir
261
261
$mf =~ s { OBJS[^=]*=\s *(.*)$} {} m ;
262
262
}
263
263
264
- # Match rules that pull in source files from different directories
265
- # example: pg_crc.c: $(top_srcdir)/src/backend/utils/hash/pg_crc.c
264
+ # Match rules that pull in source files from different directories, eg
265
+ # pgstrcasecmp.c rint.c snprintf.c: % : $(top_srcdir)/src/port/%
266
266
my $replace_re = qr { ^([^:\n\$ ]+\. c)\s *:\s *(?:%\s *: )?\$ (\( [^\) ]+\) )\/ (.*)\/ [^\/ ]+$} m ;
267
267
while ($mf =~ m {$replace_re } m )
268
268
{
You can’t perform that action at this time.
0 commit comments