Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
kratos-layout
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizifeng
kratos-layout
Commits
e600be6f
Commit
e600be6f
authored
Jun 08, 2022
by
kzkzzzz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
精简makefile
parent
480e29ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
67 deletions
+1
-67
Makefile
Makefile
+1
-67
No files found.
Makefile
View file @
e600be6f
GOPATH
:=
$(
shell
go
env
GOPATH
)
VERSION
=
$(
shell
git describe
--tags
--always
)
INTERNAL_PROTO_FILES
=
$(
shell
find internal
-name
*
.proto
)
API_PROTO_FILES
=
$(
shell
find api
-name
*
.proto
)
.PHONY
:
init
# init env
init
:
go
install
google.golang.org/protobuf/cmd/protoc-gen-go@latest
go
install
google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go
install
github.com/go-kratos/kratos/cmd/kratos/v2@latest
go
install
github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@latest
go
install
github.com/google/gnostic/cmd/protoc-gen-openapi@latest
.PHONY
:
config
# generate internal proto
config
:
protoc
--proto_path
=
./internal
\
--proto_path
=
./third_party
\
--go_out
=
paths
=
source_relative:./internal
\
$(INTERNAL_PROTO_FILES)
.PHONY
:
api
# generate api proto
api
:
protoc
--proto_path
=
./api
\
--proto_path
=
./third_party
\
--go_out
=
paths
=
source_relative:./api
\
--go-http_out
=
paths
=
source_relative:./api
\
--go-grpc_out
=
paths
=
source_relative:./api
\
--openapi_out
=
fq_schema_naming
=
true
,default_response
=
false
:.
\
$(API_PROTO_FILES)
.PHONY
:
build
.PHONY
:
build
# build
# build
build
:
build
:
mkdir
-p
bin/
&&
go build
-ldflags
"-X main.Version=
$(VERSION)
"
-o
./bin/ ./...
mkdir
-p
bin/
&&
go build
-ldflags
"-X main.Version=
$(VERSION)
"
-o
./bin/ ./...
\ No newline at end of file
.PHONY
:
generate
# generate
generate
:
go mod tidy
go get github.com/google/wire/cmd/wire@latest
go generate ./...
.PHONY
:
all
# generate all
all
:
make api
;
make config
;
make generate
;
# show help
help
:
@
echo
''
@
echo
'Usage:'
@
echo
' make [target]'
@
echo
''
@
echo
'Targets:'
@
awk
'/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^# (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \
printf "\033[36m%-22s\033[0m %s\n", helpCommand,helpMessage; \
} \
} \
{ lastLine = $$0 }'
$(MAKEFILE_LIST)
.DEFAULT_GOAL
:=
help
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment