@@ -22,14 +22,44 @@ MAN_PAGES = $(shell ls $(MAN_DIR)/*.8)
2222MAN_PAGES_BASE = $(notdir $(MAN_PAGES ) )
2323MAN_INSTALL_PATH := ${PREFIX}/share/man/man8/
2424
25+ RELEASE_DIR := $(CURDIR ) /release
26+
2527VERSION := ${shell cat ./VERSION}
2628
29+ SHELL ?= $(shell command -v bash 2>/dev/null)
30+
2731all : $(RUNC_LINK )
2832 go build -i -ldflags " -X main.gitCommit=${COMMIT} -X main.version=${VERSION} " -tags " $( BUILDTAGS) " -o runc .
2933
3034static : $(RUNC_LINK )
3135 CGO_ENABLED=1 go build -i -tags " $( BUILDTAGS) cgo static_build" -ldflags " -w -extldflags -static -X main.gitCommit=${COMMIT} -X main.version=${VERSION} " -o runc .
3236
37+ release : $(RUNC_LINK )
38+ @flag_list=(seccomp selinux apparmor static); \
39+ unset expression; \
40+ for flag in " $$ {flag_list[@]}" ; do \
41+ expression+=" ' '{'',$$ {flag}}" ; \
42+ done ; \
43+ eval profile_list=(" $$ expression" ); \
44+ for profile in " $$ {profile_list[@]}" ; do \
45+ output=${RELEASE_DIR} /runc; \
46+ for flag in $$ profile; do \
47+ output+=." $$ flag" ; \
48+ done ; \
49+ tags=" $$ profile" ; \
50+ ldflags=" -X main.gitCommit=${COMMIT} -X main.version=${VERSION} " ; \
51+ CGO_ENABLED=; \
52+ [[ " $$ profile" =~ static ]] && { \
53+ tags=" $$ {tags/static/static_build}" ; \
54+ tags+=" cgo" ; \
55+ ldflags+=" -w -extldflags -static" ; \
56+ CGO_ENABLED=1; \
57+ }; \
58+ echo " Building target: $$ output" ; \
59+ rm -rf " ${GOPATH} /pkg" ; \
60+ go build -i -ldflags " $$ ldflags" -tags " $$ tags" -o " $$ output" . ; \
61+ done
62+
3363$(RUNC_LINK ) :
3464 ln -sfn $(CURDIR ) $(RUNC_LINK )
3565
@@ -89,6 +119,7 @@ clean:
89119 rm -f runc
90120 rm -f $(RUNC_LINK )
91121 rm -rf $(GOPATH ) /pkg
122+ rm -rf $(RELEASE_DIR )
92123
93124validate :
94125 script/validate-gofmt
0 commit comments