forked from genuinetools/img
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (31 loc) · 1.24 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Setup name variables for the package/tool
NAME := img
PKG := github.com/genuinetools/$(NAME)
CGO_ENABLED := 1
# Set any default go build tags
BUILDTAGS ?= seccomp osusergo dfrunmount dfsecrets dfssh
include basic.mk
.PHONY: prebuild
prebuild: runc
RUNCBUILDDIR=$(BUILDDIR)/src/github.com/opencontainers/runc
RUNCCOMMIT=56aca5aa50d07548d5db8fd33e9dc562f70f3208
$(RUNCBUILDDIR):
git clone -c advice.detachedHead=false https://github.com/opencontainers/runc.git "$@"
$(BUILDDIR)/bin/runc: $(RUNCBUILDDIR)
( cd $(RUNCBUILDDIR) ; git checkout $(RUNCCOMMIT) )
$(MAKE) -C "$(RUNCBUILDDIR)" static BUILDTAGS="seccomp apparmor"
mkdir -p $(BUILDDIR)/bin
mv $(RUNCBUILDDIR)/runc $(BUILDDIR)/bin/runc
internal/binutils/runc.go: $(BUILDDIR)/bin/runc
go-bindata -tags \!noembed -pkg binutils -prefix "$(BUILDDIR)/bin" -o $(CURDIR)/internal/binutils/runc.go $(BUILDDIR)/bin
gofmt -s -w $(CURDIR)/internal/binutils/runc.go
.PHONY: runc
ifneq (,$(findstring noembed,$(BUILDTAGS)))
runc: ## No-op when not embedding runc.
else
runc: internal/binutils/runc.go ## Builds runc locally so it can be embedded in the resulting binary.
$(RM) -r $(RUNCBUILDDIR)
runc-install: $(RUNCBUILDDIR)/runc
sudo cp $(RUNCBUILDDIR)/runc /usr/bin/runc
$(RM) -r $(RUNCBUILDDIR)
endif