Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
6ca905ac
Commit
6ca905ac
authored
Jul 01, 2016
by
Mike Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds source debug build options
Signed-off-by:
Mike Brown
<
brownwm@us.ibm.com
>
parent
7823c577
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
4 deletions
+28
-4
Makefile
Makefile
+11
-1
development.md
docs/devel/development.md
+8
-2
golang.sh
hack/lib/golang.sh
+9
-1
No files found.
Makefile
View file @
6ca905ac
...
@@ -62,6 +62,10 @@ GOLDFLAGS ?=
...
@@ -62,6 +62,10 @@ GOLDFLAGS ?=
KUBE_GOLDFLAGS
=
$(GOLDFLAGS)
KUBE_GOLDFLAGS
=
$(GOLDFLAGS)
export
KUBE_GOLDFLAGS
GOLDFLAGS
export
KUBE_GOLDFLAGS
GOLDFLAGS
GOGCFLAGS
?=
KUBE_GOGCFLAGS
=
$(GOGCFLAGS)
export
KUBE_GOGCFLAGS
GOGCFLAGS
# Build code.
# Build code.
#
#
# Args:
# Args:
...
@@ -69,12 +73,17 @@ export KUBE_GOLDFLAGS GOLDFLAGS
...
@@ -69,12 +73,17 @@ export KUBE_GOLDFLAGS GOLDFLAGS
# package, the build will produce executable files under $(OUT_DIR)/go/bin.
# package, the build will produce executable files under $(OUT_DIR)/go/bin.
# If not specified, "everything" will be built.
# If not specified, "everything" will be built.
# GOFLAGS: Extra flags to pass to 'go' when building.
# GOFLAGS: Extra flags to pass to 'go' when building.
# GOLDFLAGS: Extra linking flags to pass to 'go' when building.
# GOLDFLAGS: Extra linking flags passed to 'go' when building.
# GOGCFLAGS: Additional go compile flags passed to 'go' when building.
#
#
# Example:
# Example:
# make
# make
# make all
# make all
# make all WHAT=cmd/kubelet GOFLAGS=-v
# make all WHAT=cmd/kubelet GOFLAGS=-v
# make all GOGCFLAGS="-N -l"
# Note: Use the -N -l options to disable compiler optimizations an inlining.
# Using these build options allows you to subsequently use source
# debugging tools like delve.
.PHONY
:
all
.PHONY
:
all
all
:
generated_files
all
:
generated_files
hack/make-rules/build.sh
$(WHAT)
hack/make-rules/build.sh
$(WHAT)
...
@@ -107,6 +116,7 @@ verify:
...
@@ -107,6 +116,7 @@ verify:
# TESTS: Same as WHAT.
# TESTS: Same as WHAT.
# GOFLAGS: Extra flags to pass to 'go' when building.
# GOFLAGS: Extra flags to pass to 'go' when building.
# GOLDFLAGS: Extra linking flags to pass to 'go' when building.
# GOLDFLAGS: Extra linking flags to pass to 'go' when building.
# GOGCFLAGS: Additional go compile flags passed to 'go' when building.
#
#
# Example:
# Example:
# make check
# make check
...
...
docs/devel/development.md
View file @
6ca905ac
...
@@ -75,8 +75,14 @@ binaries):
...
@@ -75,8 +75,14 @@ binaries):
make
make
```
```
You may pass build options and packages to the script as necessary. To build
You may pass build options and packages to the script as necessary. For example,
binaries for all platforms:
to build with optimizations disabled for enabling use of source debug tools:
```
sh
make
GOGCFLAGS
=
"-N -l"
```
To build binaries for all platforms:
```
sh
```
sh
make cross
make cross
...
...
hack/lib/golang.sh
View file @
6ca905ac
...
@@ -426,6 +426,7 @@ kube::golang::build_kube_toolchain() {
...
@@ -426,6 +426,7 @@ kube::golang::build_kube_toolchain() {
kube::log::status
"Building the toolchain targets:"
"
${
binaries
[@]
}
"
kube::log::status
"Building the toolchain targets:"
"
${
binaries
[@]
}
"
go
install
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
go
install
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-gcflags
"
${
gogcflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
"
${
binaries
[@]
:+
${
binaries
[@]
}}
"
"
${
binaries
[@]
:+
${
binaries
[@]
}}
"
}
}
...
@@ -482,6 +483,7 @@ kube::golang::build_binaries_for_platform() {
...
@@ -482,6 +483,7 @@ kube::golang::build_binaries_for_platform() {
local
outfile
=
$(
kube::golang::output_filename_for_binary
"
${
binary
}
"
"
${
platform
}
"
)
local
outfile
=
$(
kube::golang::output_filename_for_binary
"
${
binary
}
"
"
${
platform
}
"
)
CGO_ENABLED
=
0 go build
-o
"
${
outfile
}
"
\
CGO_ENABLED
=
0 go build
-o
"
${
outfile
}
"
\
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-gcflags
"
${
gogcflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
"
${
binary
}
"
"
${
binary
}
"
kube::log::progress
"*"
kube::log::progress
"*"
...
@@ -490,6 +492,7 @@ kube::golang::build_binaries_for_platform() {
...
@@ -490,6 +492,7 @@ kube::golang::build_binaries_for_platform() {
local
outfile
=
$(
kube::golang::output_filename_for_binary
"
${
binary
}
"
"
${
platform
}
"
)
local
outfile
=
$(
kube::golang::output_filename_for_binary
"
${
binary
}
"
"
${
platform
}
"
)
go build
-o
"
${
outfile
}
"
\
go build
-o
"
${
outfile
}
"
\
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-gcflags
"
${
gogcflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
"
${
binary
}
"
"
${
binary
}
"
kube::log::progress
"*"
kube::log::progress
"*"
...
@@ -499,11 +502,13 @@ kube::golang::build_binaries_for_platform() {
...
@@ -499,11 +502,13 @@ kube::golang::build_binaries_for_platform() {
# Use go install.
# Use go install.
if
[[
"
${#
nonstatics
[@]
}
"
!=
0
]]
;
then
if
[[
"
${#
nonstatics
[@]
}
"
!=
0
]]
;
then
go
install
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
go
install
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-gcflags
"
${
gogcflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
"
${
nonstatics
[@]
:+
${
nonstatics
[@]
}}
"
"
${
nonstatics
[@]
:+
${
nonstatics
[@]
}}
"
fi
fi
if
[[
"
${#
statics
[@]
}
"
!=
0
]]
;
then
if
[[
"
${#
statics
[@]
}
"
!=
0
]]
;
then
CGO_ENABLED
=
0 go
install
-installsuffix
cgo
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
CGO_ENABLED
=
0 go
install
-installsuffix
cgo
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-gcflags
"
${
gogcflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
"
${
statics
[@]
:+
${
statics
[@]
}}
"
"
${
statics
[@]
:+
${
statics
[@]
}}
"
fi
fi
...
@@ -536,12 +541,14 @@ kube::golang::build_binaries_for_platform() {
...
@@ -536,12 +541,14 @@ kube::golang::build_binaries_for_platform() {
# returns true (always stale). And that's why we need to install the
# returns true (always stale). And that's why we need to install the
# test package.
# test package.
go
install
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
go
install
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-gcflags
"
${
gogcflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
"
${
testpkg
}
"
"
${
testpkg
}
"
mkdir
-p
"
$(
dirname
${
outfile
})
"
mkdir
-p
"
$(
dirname
${
outfile
})
"
go
test
-c
\
go
test
-c
\
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-gcflags
"
${
gogcflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
-o
"
${
outfile
}
"
\
-o
"
${
outfile
}
"
\
"
${
testpkg
}
"
"
${
testpkg
}
"
...
@@ -595,9 +602,10 @@ kube::golang::build_binaries() {
...
@@ -595,9 +602,10 @@ kube::golang::build_binaries() {
host_platform
=
$(
kube::golang::host_platform
)
host_platform
=
$(
kube::golang::host_platform
)
# Use eval to preserve embedded quoted strings.
# Use eval to preserve embedded quoted strings.
local
goflags goldflags
local
goflags goldflags
gogcflags
eval
"goflags=(
${
KUBE_GOFLAGS
:-}
)"
eval
"goflags=(
${
KUBE_GOFLAGS
:-}
)"
goldflags
=
"
${
KUBE_GOLDFLAGS
:-}
$(
kube::version::ldflags
)
"
goldflags
=
"
${
KUBE_GOLDFLAGS
:-}
$(
kube::version::ldflags
)
"
gogcflags
=
"
${
KUBE_GOGCFLAGS
:-}
"
local
use_go_build
local
use_go_build
local
-a
targets
=()
local
-a
targets
=()
...
...
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