-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
85 lines (69 loc) · 2.16 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# contrib/synchdb/Makefile
MODULE_big = synchdb
EXTENSION = synchdb
DATA = synchdb--1.0.sql
PGFILEDESC = "synchdb - allows logical replication with heterogeneous databases"
REGRESS = synchdb
OBJS = synchdb.o \
format_converter.o \
replication_agent.o
DBZ_ENGINE_PATH = dbz-engine
# Dynamically set JDK paths
JAVA_PATH := $(shell which java)
JDK_HOME_PATH := $(shell readlink -f $(JAVA_PATH) | sed 's:/bin/java::')
JDK_INCLUDE_PATH := $(JDK_HOME_PATH)/include
# Detect the operating system
UNAME_S := $(shell uname -s)
# Set JDK_INCLUDE_PATH based on the operating system
ifeq ($(UNAME_S), Linux)
JDK_INCLUDE_PATH_OS := $(JDK_INCLUDE_PATH)/linux
$(info Detected OS: Linux)
else ifeq ($(UNAME_S), Darwin)
JDK_INCLUDE_PATH_OS := $(JDK_INCLUDE_PATH)/darwin
$(info Detected OS: Darwin)
else
$(error Unsupported operating system: $(UNAME_S))
endif
JDK_LIB_PATH := $(JDK_HOME_PATH)/lib/server
PG_CFLAGS = -I$(JDK_INCLUDE_PATH) -I$(JDK_INCLUDE_PATH_OS)
PG_LDFLAGS = -L$(JDK_LIB_PATH) -ljvm
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/synchdb
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
# Target that checks JDK paths
check_jdk:
@echo "Checking JDK environment"
@if [ ! -d $(JDK_INCLUDE_PATH) ]; then \
echo "Error: JDK include path $(JDK_INCLUDE_PATH) not found"; \
exit 1; \
fi
@if [ ! -d $(JDK_INCLUDE_PATH_OS) ]; then \
echo "Error: JDK include path for OS $(JDK_INCLUDE_PATH_OS) not found"; \
exit 1; \
fi
@if [ ! -d $(JDK_LIB_PATH) ]; then \
echo "Error: JDK lib path $(JDK_LIB_PATH) not found"; \
exit 1; \
fi
@echo "JDK Paths"
@echo "$(JDK_INCLUDE_PATH)"
@echo "$(JDK_INCLUDE_PATH_OS)"
@echo "$(JDK_LIB_PATH)"
@echo "JDK check passed"
build_dbz:
cd $(DBZ_ENGINE_PATH) && mvn clean install
clean_dbz:
cd $(DBZ_ENGINE_PATH) && mvn clean
install_dbz:
rm -rf $(libdir)/dbz_engine
install -d $(libdir)/dbz_engine
cp -rp $(DBZ_ENGINE_PATH)/target/* $(libdir)/dbz_engine
# chown -R root:root $(libdir)/dbz_engine
# append new recipe to the original all and clean as defined by global Makefile