@@ -10,26 +10,37 @@ install: build
1010 if test -d ~ /.steampipe/db/14.2.0; then \
1111 cp ./build-$(PLATFORM ) /steampipe_postgres_fdw--1.0.sql $(STEAMPIPE_INSTALL_DIR ) /db/14.2.0/postgres/share/postgresql/extension/; \
1212 cp ./build-$(PLATFORM ) /steampipe_postgres_fdw.control $(STEAMPIPE_INSTALL_DIR ) /db/14.2.0/postgres/share/postgresql/extension/; \
13- fi
14-
15- if test -f ./build-$(PLATFORM)/steampipe_postgres_fdw.so; then \
1613 cp ./build-$(PLATFORM ) /steampipe_postgres_fdw.so $(STEAMPIPE_INSTALL_DIR ) /db/14.2.0/postgres/lib/postgresql/; \
1714 fi
18- if test -f ./build-$(PLATFORM)/steampipe_postgres_fdw.dylib; then \
19- cp ./build-$(PLATFORM)/steampipe_postgres_fdw.dylib $(STEAMPIPE_INSTALL_DIR)/db/14.2.0/postgres/lib/postgresql/; \
20- fi
2115
2216# build standalone
2317standalone : validate_plugin prebuild.go
2418 @echo " Building standalone FDW for plugin: $( plugin) "
25- go run generate/generator.go templates . $(plugin ) $(plugin_github_url )
26- go mod tidy
27- $(MAKE ) -C ./fdw clean
28- $(MAKE ) -C ./fdw go
29- $(MAKE ) -C ./fdw
19+
20+ # Remove existing work dir and create a new directory for the render process
21+ rm -rf work && \
22+ mkdir -p work
23+
24+ # Copy the entire source tree, excluding .git directory, into the new directory
25+ rsync -a --exclude='.git' . work/ >/dev/null 2>&1
26+
27+ # Change to the new directory to perform operations
28+ cd work && \
29+ go run generate/generator.go templates . $(plugin) $(plugin_github_url) && \
30+ go mod tidy && \
31+ $(MAKE) -C ./fdw clean && \
32+ $(MAKE) -C ./fdw go && \
33+ $(MAKE) -C ./fdw && \
3034 $(MAKE) -C ./fdw standalone
31-
32- rm -f prebuild.go
35+
36+ # Delete existing build-${PLATFORM} and copy the binaries to the actual
37+ # build-${PLATFORM} folder
38+ rm -rf build-${PLATFORM} && \
39+ mkdir -p build-${PLATFORM} && \
40+ cp -a work/build-${PLATFORM}/* build-${PLATFORM}/
41+
42+ # Note: The work directory will contain the full code tree with changes,
43+ # binaries will be copied to build-${PLATFORM} folder
3344
3445# render target
3546render : validate_plugin prebuild.go
@@ -113,4 +124,3 @@ clean:
113124# Usage: make release input="v1.7.2"
114125release :
115126 ./scripts/upload_arm_asset.sh $(input )
116-
0 commit comments