forked from nextgres/uplpgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (42 loc) · 1.71 KB
/
Copy pathMakefile
File metadata and controls
55 lines (42 loc) · 1.71 KB
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
# UPL Common — shared AST, interpreter, JIT compilation, and runtime
#
# Builds libupl_common.a, a static library linked into each language driver.
# Source: postgres.env must be sourced before building.
PG_CONFIG ?= pg_config
PG_INCLUDEDIR_SERVER := $(shell $(PG_CONFIG) --includedir-server)
# Prefer an llvm-config on PATH (Linux, and macOS with LLVM on PATH); fall
# back to the Homebrew location. Override with UPL_LLVM_CONFIG=... if needed.
UPL_LLVM_CONFIG ?= $(shell command -v llvm-config 2>/dev/null || echo /opt/homebrew/opt/llvm/bin/llvm-config)
UPL_LLVM_CFLAGS := $(shell $(UPL_LLVM_CONFIG) --cflags)
CORE_DIR = ../core
CC ?= cc
# -fPIC: these objects are archived into a static library that is linked
# into the driver's shared object; ELF platforms require
# position-independent code for that. A no-op on macOS.
#
# -MMD -MP: let the compiler record which headers each object actually
# included, into a .d file we read back below. A hand-written header list
# goes stale silently — it rebuilds nothing when a header it forgot changes,
# and the result is testing a binary that does not match the source.
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith \
-Wdeclaration-after-statement -Werror=vla \
-Wendif-labels -Wmissing-format-attribute \
-Wformat-security -fno-strict-aliasing -fwrapv \
-fvisibility=hidden -fPIC -O2 -MMD -MP \
-I$(PG_INCLUDEDIR_SERVER) \
-I$(CORE_DIR) \
$(UPL_LLVM_CFLAGS)
OBJS = upl_comp.o upl_exec.o upl_funcs.o \
upl_compile_stmts.o upl_compile_expr.o upl_runtime.o
DEPS = $(OBJS:.o=.d)
LIB = libupl_common.a
.PHONY: all clean
all: $(LIB)
$(LIB): $(OBJS)
rm -f $@
ar rcs $@ $^
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f $(OBJS) $(DEPS) $(LIB)
-include $(DEPS)