@@ -7,47 +7,25 @@ $(V).SILENT:
7
7
# SUB_APPS ?= cmdr-cli loop
8
8
# MAIN_ENTRY_FILE ?= . # Or: "main.go"
9
9
10
+ # NAME := blueprint
11
+ # PACKAGE_NAME := github.com/hedzr/cmdr/v2
12
+ # ENTRY_PKG := ./examples/blueprint
13
+
14
+ # PLATFORM ?= linux
15
+ # ARCH ?= amd64
16
+ # BUILD_DIR ?= bin
17
+ # LOGS_DIR ?= ./logs
18
+
10
19
-include ./ci/mk/env.mk
11
20
-include ./ci/mk/cc.mk
12
21
-include ./ci/mk/git.mk
13
22
14
23
-include .env
15
24
-include .env.local
16
25
26
+ -include ./ci/mk/vars.mk
17
27
18
- NAME := myservice
19
- PACKAGE_NAME := github.com/hedzr/cmdr-addons
20
- ENTRY_PKG := ./examples/myservice
21
-
22
- PLATFORM := linux
23
- ARCH := amd64
24
- BUILD_DIR := bin
25
- LOGS_DIR := ./logs
26
-
27
- GO := $(shell which go)
28
- GOOS := $(shell go env GOOS)
29
- GOARCH := $(shell go env GOARCH)
30
- GOPROXY := $(shell go env GOPROXY)
31
- GOVERSION := $(shell go version)
32
- DEFAULT_TARGET := $(GOOS ) -$(GOARCH )
33
- W_PKG := github.com/hedzr/cmdr/v2/conf
34
- CMDR_SETTING := \
35
- -X '$(W_PKG ) .Buildstamp=$(TIMESTAMP ) ' \
36
- -X '$(W_PKG ) .Githash=$(GIT_REVISION ) ' \
37
- -X '$(W_PKG ) .GitSummary=$(GIT_SUMMARY ) ' \
38
- -X '$(W_PKG ) .GitDesc=$(GIT_DESC ) ' \
39
- -X '$(W_PKG ) .BuilderComments=$(BUILDER_COMMENT ) ' \
40
- -X '$(W_PKG ) .GoVersion=$(GOVERSION ) ' \
41
- -X '$(W_PKG ) .Version=$(GIT_VERSION ) ' \
42
- -X '$(W_PKG ) .AppName=$(NAME ) '
43
- GOBUILD := CGO_ENABLED=0 \
44
- $(GO ) build \
45
- -tags "cmdr hzstudio sec antonal" \
46
- -trimpath \
47
- -ldflags="-s -w $(CMDR_SETTING ) " \
48
- -o $(BUILD_DIR )
49
-
50
- .PHONY : all $(BUILD_DIR ) /$(NAME ) release release-all test build
28
+ .PHONY : all $(BUILD_DIR ) /$(NAME ) release release-all test build primary-target main
51
29
all : build
52
30
normal : clean $(BUILD_DIR ) /$(NAME )
53
31
@@ -78,10 +56,10 @@ build: $(BUILD_DIR)/$(NAME)
78
56
build-default : $(DEFAULT_TARGET )
79
57
@echo BUILD OK
80
58
81
- # myservice : build executable for current GOOS & GOARCH
82
- myservice : my-service
83
- # my-service : build executable for the TARGET GOOS & GOARCH (see also PLATFORM & ARCH vars)
84
- my-service :
59
+ # primary-target : build executable for current GOOS & GOARCH
60
+ primary-target : main
61
+ # main : build executable for the TARGET GOOS & GOARCH (see also PLATFORM & ARCH vars)
62
+ main :
85
63
@-$(MAKE ) $(BUILD_DIR ) /$(NAME ) GOOS=$(PLATFORM ) GOARCH=$(ARCH )
86
64
87
65
# bin/cmdr is the default executable for running under your current GOOS & GOARCH.
0 commit comments