forked from turbot/steampipe-postgres-fdw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (36 loc) · 1.55 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
# Makefile
PLATFORM=$(shell uname)
install: build
if test -d ~/.steampipe/db/14.2.0; then \
cp ./build-$(PLATFORM)/steampipe_postgres_fdw--1.0.sql ~/.steampipe/db/14.2.0/postgres/share/postgresql/extension/; \
cp ./build-$(PLATFORM)/steampipe_postgres_fdw.control ~/.steampipe/db/14.2.0/postgres/share/postgresql/extension/; \
cp ./build-$(PLATFORM)/steampipe_postgres_fdw.so ~/.steampipe/db/14.2.0/postgres/lib/postgresql/; \
fi
build: prebuild.go
$(MAKE) -C ./fdw clean
$(MAKE) -C ./fdw go
$(MAKE) -C ./fdw
$(MAKE) -C ./fdw inst
rm -f prebuild.go
# make target to generate a go file containing the C includes containing bindings to the
# postgres functions
prebuild.go:
# copy the template which contains the C includes
# this is used to import the postgres bindings by the underlying C compiler
cp prebuild.tmpl prebuild.go
# set the GOOS in the template
sed -i.bak 's|OS_PLACEHOLDER|$(shell go env GOOS)|' prebuild.go
# replace known placeholders with values from 'pg_config'
sed -i.bak 's|INTERNAL_INCLUDE_PLACEHOLDER|$(shell pg_config --includedir)|' prebuild.go
sed -i.bak 's|SERVER_INCLUDE_PLACEHOLDER|$(shell pg_config --includedir-server)|' prebuild.go
sed -i.bak 's|DISCLAIMER|This is generated. Do not check this in to Git|' prebuild.go
rm -f prebuild.go.bak
clean:
$(MAKE) -C ./fdw clean
rm -f prebuild.go
rm -f steampipe_postgres_fdw.a
rm -f steampipe_postgres_fdw.h
# Used to build the Darwin ARM binaries and upload to the github draft release.
# Usage: make release input="v1.7.2"
release:
./scripts/upload_arm_asset.sh $(input)