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
6bd78995
Commit
6bd78995
authored
Aug 06, 2015
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12317 from crawford/linker
Plumb linker flags through from the Makefile
parents
7c9bbef9
79f14822
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
Makefile
Makefile
+6
-0
golang.sh
hack/lib/golang.sh
+7
-10
No files found.
Makefile
View file @
6bd78995
...
@@ -12,6 +12,9 @@ GODEPS_PKG_DIR = Godeps/_workspace/pkg
...
@@ -12,6 +12,9 @@ GODEPS_PKG_DIR = Godeps/_workspace/pkg
KUBE_GOFLAGS
=
$(GOFLAGS)
KUBE_GOFLAGS
=
$(GOFLAGS)
export
KUBE_GOFLAGS
export
KUBE_GOFLAGS
KUBE_GOLDFLAGS
=
$(GOLDFLAGS)
export
KUBE_GOLDFLAGS
# Build code.
# Build code.
#
#
# Args:
# Args:
...
@@ -19,6 +22,7 @@ export KUBE_GOFLAGS
...
@@ -19,6 +22,7 @@ export KUBE_GOFLAGS
# 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.
#
#
# Example:
# Example:
# make
# make
...
@@ -35,6 +39,7 @@ all:
...
@@ -35,6 +39,7 @@ all:
# directories will be run. If not specified, "everything" will be tested.
# directories will be run. If not specified, "everything" will be tested.
# 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.
#
#
# Example:
# Example:
# make check
# make check
...
@@ -78,6 +83,7 @@ clean:
...
@@ -78,6 +83,7 @@ clean:
# vetted.
# vetted.
# 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.
#
#
# Example:
# Example:
# make vet
# make vet
...
...
hack/lib/golang.sh
View file @
6bd78995
...
@@ -369,7 +369,7 @@ kube::golang::build_binaries_for_platform() {
...
@@ -369,7 +369,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
[@]
}}
"
\
-ldflags
"
${
version_
ldflags
}
"
\
-ldflags
"
${
go
ldflags
}
"
\
"
${
binary
}
"
"
${
binary
}
"
kube::log::progress
"*"
kube::log::progress
"*"
done
done
...
@@ -377,7 +377,7 @@ kube::golang::build_binaries_for_platform() {
...
@@ -377,7 +377,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
[@]
}}
"
\
-ldflags
"
${
version_
ldflags
}
"
\
-ldflags
"
${
go
ldflags
}
"
\
"
${
binary
}
"
"
${
binary
}
"
kube::log::progress
"*"
kube::log::progress
"*"
done
done
...
@@ -386,12 +386,12 @@ kube::golang::build_binaries_for_platform() {
...
@@ -386,12 +386,12 @@ 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
[@]
}}
"
\
-ldflags
"
${
version_
ldflags
}
"
\
-ldflags
"
${
go
ldflags
}
"
\
"
${
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
[@]
}}
"
\
-ldflags
"
${
version_
ldflags
}
"
\
-ldflags
"
${
go
ldflags
}
"
\
"
${
statics
[@]
:+
${
statics
[@]
}}
"
"
${
statics
[@]
:+
${
statics
[@]
}}
"
fi
fi
fi
fi
...
@@ -405,7 +405,7 @@ kube::golang::build_binaries_for_platform() {
...
@@ -405,7 +405,7 @@ kube::golang::build_binaries_for_platform() {
pushd
"
$(
dirname
${
outfile
})
"
>
/dev/null
pushd
"
$(
dirname
${
outfile
})
"
>
/dev/null
go
test
-c
\
go
test
-c
\
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
version_
ldflags
}
"
\
-ldflags
"
${
go
ldflags
}
"
\
"
$(
dirname
${
test
})
"
"
$(
dirname
${
test
})
"
popd
>
/dev/null
popd
>
/dev/null
done
done
...
@@ -447,16 +447,13 @@ kube::golang::build_binaries() {
...
@@ -447,16 +447,13 @@ kube::golang::build_binaries() {
# Check for `go` binary and set ${GOPATH}.
# Check for `go` binary and set ${GOPATH}.
kube::golang::setup_env
kube::golang::setup_env
# Fetch the version.
local
version_ldflags
version_ldflags
=
$(
kube::version::ldflags
)
local
host_platform
local
host_platform
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
local
goflags
goldflags
eval
"goflags=(
${
KUBE_GOFLAGS
:-}
)"
eval
"goflags=(
${
KUBE_GOFLAGS
:-}
)"
goldflags
=
"
${
KUBE_GOLDFLAGS
:-}
$(
kube::version::ldflags
)
"
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