-
Notifications
You must be signed in to change notification settings - Fork 59
/
Makefile.global
56 lines (42 loc) · 1.46 KB
/
Makefile.global
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
PG_CONFIG ?= pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
PG_LIB := $(shell $(PG_CONFIG) --pkglibdir)
INCLUDEDIR := ${shell $(PG_CONFIG) --includedir}
INCLUDEDIR_SERVER := ${shell $(PG_CONFIG) --includedir-server}
USE_PGXS = 1
include $(PGXS)
# All the below stuff is vendored in from Postgres its Makefile.global. It's
# normally only enabled when --enabled-depend is provided to Postgres its
# ./configure script. This enables it even if that is not the case, so that
# running "make clean" is pretty much never necessary anymore to re-trigger
# builds of C/C++ files when their headers are modified.
ifneq ($(autodepend), yes)
ifndef COMPILE.c
COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
endif
ifndef COMPILE.cc
COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c
endif
DEPDIR = .deps
ifeq ($(GCC), yes)
# GCC allows us to create object and dependency file in one invocation.
%.o : %.c
@if test ! -d $(DEPDIR); then mkdir -p $(DEPDIR); fi
$(COMPILE.c) -o $@ $< -MMD -MP -MF $(DEPDIR)/$(*F).Po
%.o : %.cpp
@if test ! -d $(DEPDIR); then mkdir -p $(DEPDIR); fi
$(COMPILE.cc) -o $@ $< -MMD -MP -MF $(DEPDIR)/$(*F).Po
endif # GCC
# Include all the dependency files generated for the current
# directory. Note that make would complain if include was called with
# no arguments.
Po_files := $(wildcard $(DEPDIR)/*.Po)
ifneq (,$(Po_files))
include $(Po_files)
endif
# hook for clean-up
clean distclean: clean-deps
.PHONY: clean-deps
clean-deps:
@rm -rf $(DEPDIR)
endif # autodepend