Skip to content

Commit

Permalink
Add .exe to windows output filename using make
Browse files Browse the repository at this point in the history
Signed-off-by: Yilun <zyl.skysniper@gmail.com>
  • Loading branch information
yilunzhang committed Jun 25, 2023
1 parent cbfd93c commit a250fb9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ XGO_MODULE=github.com/nknorg/nconnect/bin
XGO_BUILD=xgo -ldflags $(LDFLAGS) --targets=$(XGO_TARGET) $(XGOFLAGS)
BUILD_DIR=build
BIN_NAME=nConnect

ifdef GOARM
BIN_DIR=$(GOOS)-$(GOARCH)v$(GOARM)
XGO_TARGET=$(GOOS)/$(GOARCH)-$(GOARM)
Expand All @@ -17,16 +18,23 @@ BIN_DIR=$(GOOS)-$(GOARCH)
XGO_TARGET=$(GOOS)/$(GOARCH)
endif

LOCAL_EXT=$(EXT)
ifeq ($(OS),Windows_NT)
ifeq ($(LOCAL_EXT),)
LOCAL_EXT=.exe
endif
endif

web/dist: $(shell find web/src -type f -not -path "web/src/node_modules/*" -not -path "web/src/dist/*")
-@cd web/src && yarn && yarn generate && rm -rf ./dist/index.html.html && rm -rf ../dist && cp -a ./dist ../dist

.PHONY: local
local: web/dist
$(BUILD) -o $(BIN_NAME)$(EXT) $(MAIN)
$(BUILD) -o $(BIN_NAME)$(LOCAL_EXT) $(MAIN)

.PHONY: local_with_proxy
local_with_proxy: web/dist
$(USE_PROXY) $(BUILD) -o $(BIN_NAME)$(EXT) $(MAIN)
$(USE_PROXY) ${MAKE} local

.PHONY: local_or_with_proxy
local_or_with_proxy:
Expand Down

0 comments on commit a250fb9

Please sign in to comment.