Breaking Makefile into platform specific files
Fixed #1270 Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
This commit is contained in:
parent
89da512692
commit
1c989588c0
27
Makefile
27
Makefile
@ -19,21 +19,11 @@ endif
|
||||
WHALE = "🇩"
|
||||
ONI = "👹"
|
||||
FIX_PATH = $1
|
||||
ifeq ("$(OS)", "Windows_NT")
|
||||
WHALE="+"
|
||||
ONI="-"
|
||||
FIX_PATH = $(subst /,\,$1)
|
||||
endif
|
||||
|
||||
RELEASE=containerd-$(VERSION:v%=%).${GOOS}-${GOARCH}
|
||||
|
||||
PKG=github.com/containerd/containerd
|
||||
|
||||
# on SunOS default to gnu utilities for things like grep, sed, etc.
|
||||
ifeq ($(shell uname -s),SunOS)
|
||||
export PATH := /usr/gnu/bin:$(PATH)
|
||||
endif
|
||||
|
||||
# Project packages.
|
||||
PACKAGES=$(shell go list ./... | grep -v /vendor/)
|
||||
INTEGRATION_PACKAGE=${PKG}
|
||||
@ -49,24 +39,17 @@ TEST_REQUIRES_ROOT_PACKAGES=$(filter \
|
||||
|
||||
# Project binaries.
|
||||
COMMANDS=ctr containerd containerd-stress
|
||||
ifneq ("$(GOOS)", "windows")
|
||||
COMMANDS += containerd-shim
|
||||
endif
|
||||
BINARIES=$(addprefix bin/,$(COMMANDS))
|
||||
ifeq ("$(GOOS)", "windows")
|
||||
BINARY_SUFFIX=".exe"
|
||||
endif
|
||||
|
||||
GO_TAGS=$(if $(BUILDTAGS),-tags "$(BUILDTAGS)",)
|
||||
GO_LDFLAGS=-ldflags "-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PKG) $(EXTRA_LDFLAGS)"
|
||||
|
||||
# go test -race is only supported on the patforms listed below.
|
||||
TESTFLAGS_RACE=
|
||||
ifeq ($(filter \
|
||||
linux/amd64 freebsd/amd64 darwin/amd64 windows/amd64, \
|
||||
$(GOOS)/$(GOARCH)),$(GOOS)/$(GOARCH))
|
||||
TESTFLAGS_RACE= -race
|
||||
endif
|
||||
|
||||
#Detect the target os
|
||||
include Makefile.OS
|
||||
#include platform specific makefile
|
||||
include Makefile.$(target_os)
|
||||
|
||||
# Flags passed to `go test`
|
||||
TESTFLAGS ?= -v $(TESTFLAGS_RACE)
|
||||
|
19
Makefile.OS
Normal file
19
Makefile.OS
Normal file
@ -0,0 +1,19 @@
|
||||
#Detect the OS, and return installos value same as GOOS
|
||||
target_os =
|
||||
ifeq ($(OS),Windows_NT)
|
||||
target_os = windows
|
||||
else
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
target_os = linux
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
target_os = darwin
|
||||
endif
|
||||
ifeq ($(UNAME_S),FreeBSD)
|
||||
target_os = freebsd
|
||||
endif
|
||||
ifeq ($(UNAME_S),SunOS)
|
||||
target_os = solaris
|
||||
endif
|
||||
endif
|
5
Makefile.darwin
Normal file
5
Makefile.darwin
Normal file
@ -0,0 +1,5 @@
|
||||
#darwin specific settings
|
||||
COMMANDS += containerd-shim
|
||||
|
||||
# supports go test -race
|
||||
TESTFLAGS_RACE= -race
|
5
Makefile.freebsd
Normal file
5
Makefile.freebsd
Normal file
@ -0,0 +1,5 @@
|
||||
#freebsd specific settings
|
||||
COMMANDS += containerd-shim
|
||||
|
||||
# supports go test -race
|
||||
TESTFLAGS_RACE= -race
|
5
Makefile.linux
Normal file
5
Makefile.linux
Normal file
@ -0,0 +1,5 @@
|
||||
#linux specific settings
|
||||
COMMANDS += containerd-shim
|
||||
|
||||
# supports go test -race
|
||||
TESTFLAGS_RACE= -race
|
6
Makefile.solaris
Normal file
6
Makefile.solaris
Normal file
@ -0,0 +1,6 @@
|
||||
#solaris specific settings
|
||||
|
||||
# on SunOS default to gnu utilities for things like grep, sed, etc.
|
||||
export PATH := /usr/gnu/bin:$(PATH)
|
||||
|
||||
COMMANDS += containerd-shim
|
9
Makefile.windows
Normal file
9
Makefile.windows
Normal file
@ -0,0 +1,9 @@
|
||||
#Windows specific settings.
|
||||
WHALE = "+"
|
||||
ONI = "-"
|
||||
FIX_PATH = $(subst /,\,$1)
|
||||
|
||||
BINARY_SUFFIX=".exe"
|
||||
|
||||
# supports go test -race
|
||||
TESTFLAGS_RACE= -race
|
Loading…
Reference in New Issue
Block a user