Skip to content

Commit 34abf12

Browse files
committed
fix dist-bin
1 parent f9a2516 commit 34abf12

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

Makefile

+17-19
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,17 @@ pkg:
7474
cp $(ZIP_NAME) ..
7575

7676
## XGO build
77-
.PHONY: dist-clean dist build-xgo dist-zip
77+
.PHONY: dist-clean dist build-xgo dist-zip dist-bin
7878

79-
dist: dist-clean build-xgo $(BINARY_FILES) dist-zip
79+
dist: dist-clean build-xgo dist-bin dist-zip
8080

8181
XGOCMD=xgo -go $(GOVERSION) $(BUILDFLAG)
8282
XGO_TARGETS=linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm-7,linux/arm64,linux/mips,linux/mips64,linux/mipsle,windows/amd64,windows/386
83-
8483
DIST_BIN=dist/bin
8584
BINARY_FILE := $(TARGET_NAME)
86-
BINARY_FILES := $(wildcard $(DIST_BIN)/$(BINARY_FILE)-*)
85+
86+
dist-clean:
87+
rm -Rf dist/trdsql_*
8788

8889
build-xgo:
8990
-mkdir dist
@@ -92,21 +93,18 @@ build-xgo:
9293
$(XGOCMD) --targets=$(XGO_TARGETS) -dest dist/tmp github.com/noborus/trdsql/cmd/trdsql
9394
find dist/tmp -type f -exec cp {} $(DIST_BIN) \;
9495

95-
.PHONY: $(BINARY_FILES)
96-
97-
dist-clean:
98-
rm -Rf dist/trdsql_*
99-
100-
$(BINARY_FILES):
101-
@OS_ARCH=`echo $@ | sed -e 's/.*-\(.*\)-\(.*\)/\1-\2/' -e 's/\.exe//'`; \
102-
BINSUFFIX=`echo $@ | sed -n -e 's/.*\(\.exe\)$$/\1/p'`; \
103-
OS=`echo $$OS_ARCH | cut -d '-' -f 1`; \
104-
ARCH=`echo $$OS_ARCH | cut -d '-' -f 2`; \
105-
DIST_DIR=dist/trdsql_$(VERSION)_$${OS}_$${ARCH}; \
106-
mkdir -p $$DIST_DIR; \
107-
cp $@ $$DIST_DIR/$(BINARY_FILE)$${BINSUFFIX}; \
108-
109-
dist-zip: $(BINARY_FILES)
96+
dist-bin:
97+
for file in $(wildcard $(DIST_BIN)/$(BINARY_FILE)-*); do \
98+
OS_ARCH=`echo $$file | sed -e 's/.*-\(.*\)-\(.*\)/\1-\2/' -e 's/\.exe//'`; \
99+
BINSUFFIX=`echo $$file | sed -n -e 's/.*\(\.exe\)$$/\1/p'`; \
100+
OS=`echo $${OS_ARCH} | cut -d '-' -f 1`; \
101+
ARCH=`echo $${OS_ARCH} | cut -d '-' -f 2`; \
102+
DIST_DIR=dist/trdsql_$(VERSION)_$${OS}_$${ARCH}; \
103+
mkdir -p $${DIST_DIR}; \
104+
cp $$file $${DIST_DIR}/$(BINARY_FILE)$${BINSUFFIX}; \
105+
done
106+
107+
dist-zip: dist-bin
110108
cd dist && \
111109
$(DIST_ZIP_DIRS) cp ../README.md {} \; && \
112110
$(DIST_ZIP_DIRS) cp ../LICENSE {} \; && \

0 commit comments

Comments
 (0)