Skip to content

Commit accec23

Browse files
authored
chore: go driver makefile now considers more source files as dependencies (#3108)
QoL upgrade for driver development. More complete tracking for local changes. Saves on `rm`-ing before rebuilding libraries to integrate source changes! Also I replaced an error-prone `$<` (subtarget position dependent) with `$*` ## Demo ![demo](https://github.com/user-attachments/assets/8f9ff140-5bac-402a-934e-077e01e2d475) ## Scenarios covered 1. edit already tracked driver files 2. edit `go.mod` 3. edit `../driver/bigquery` files 4. (not shown but works) edit other package like `../driver/databricks` and `../go.sum` --> triggers no rebuild
1 parent 3e481a6 commit accec23

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

go/adbc/pkg/Makefile

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
GO_BUILD=go build
18-
RM=rm -f
17+
MANAGERS = bigquery flightsql panicdummy snowflake
18+
19+
GO_BUILD := go build
20+
RM := rm -f
21+
1922
ifeq ($(shell go env GOOS),linux)
2023
SUFFIX=so
2124
else ifeq ($(shell go env GOOS),windows)
@@ -28,17 +31,18 @@ endif
2831
GIT_VERSION=$(shell git tag -l --points-at $(shell git rev-list --tags --max-count=1) --sort=-v:refname | head -n 1)
2932
VERSION=$(subst go/adbc/,,$(GIT_VERSION))
3033

31-
DRIVERS := \
32-
libadbc_driver_bigquery.$(SUFFIX) \
33-
libadbc_driver_flightsql.$(SUFFIX) \
34-
libadbc_driver_panicdummy.$(SUFFIX) \
35-
libadbc_driver_snowflake.$(SUFFIX)
34+
# Expand dynamically libadbc_driver_.SUFFIX
35+
DRIVERS := $(addsuffix .$(SUFFIX),$(addprefix libadbc_driver_,$(MANAGERS)))
36+
37+
# =========
38+
# Targets
39+
# =========
3640

3741
.PHONY: all regenerate
3842
all: $(DRIVERS)
3943

40-
libadbc_driver_%.$(SUFFIX): %
41-
$(GO_BUILD) -buildvcs=true -tags driverlib -o $@ -buildmode=c-shared -ldflags "-s -w -X github.com/apache/arrow-adbc/go/adbc/driver/internal/driverbase.infoDriverVersion=$(VERSION)" ./$<
44+
libadbc_driver_%.$(SUFFIX): % ../driver/% ../go.mod ../go.sum
45+
$(GO_BUILD) -buildvcs=true -tags driverlib -o $@ -buildmode=c-shared -ldflags "-s -w -X github.com/apache/arrow-adbc/go/adbc/driver/internal/driverbase.infoDriverVersion=$(VERSION)" ./$*
4246
$(RM) $(basename $@).h
4347

4448
regenerate:

0 commit comments

Comments
 (0)