Skip to content

Commit

Permalink
Merge pull request #5162 from hashicorp/f-extract-lxc
Browse files Browse the repository at this point in the history
Extract LXC from nomad
  • Loading branch information
notnoop authored Jan 9, 2019
2 parents d1fbd73 + d19245f commit d0efb37
Show file tree
Hide file tree
Showing 26 changed files with 6 additions and 5,603 deletions.
22 changes: 3 additions & 19 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,9 @@ ifeq (,$(findstring $(THIS_OS),Darwin Linux FreeBSD))
$(error Building Nomad is currently only supported on Darwin and Linux.)
endif

# On Linux we build for Linux, Windows, and potentially Linux+LXC
# On Linux we build for Linux and Windows
ifeq (Linux,$(THIS_OS))

# Detect if we have LXC on the path
ifeq (0,$(shell pkg-config --exists lxc; echo $$?))
HAS_LXC="true"
endif

ifeq ($(TRAVIS),true)
$(info Running in Travis, verbose mode is disabled)
else
Expand All @@ -38,9 +33,6 @@ ALL_TARGETS += linux_386 \
windows_386 \
windows_amd64

ifeq ("true",$(HAS_LXC))
ALL_TARGETS += linux_amd64-lxc
endif
endif

# On MacOS, we only build for MacOS
Expand Down Expand Up @@ -122,14 +114,6 @@ pkg/windows_amd64/nomad: $(SOURCE_FILES) ## Build Nomad for windows/amd64
-tags "$(GO_TAGS)" \
-o "$@.exe"

pkg/linux_amd64-lxc/nomad: $(SOURCE_FILES) ## Build Nomad+LXC for linux/amd64
@echo "==> Building $@ with tags $(GO_TAGS)..."
@CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
go build \
-ldflags $(GO_LDFLAGS) \
-tags "$(GO_TAGS) lxc" \
-o "$@"

# Define package targets for each of the build targets we actually have on this system
define makePackageTarget

Expand Down Expand Up @@ -222,7 +206,7 @@ changelogfmt:
dev: GOOS=$(shell go env GOOS)
dev: GOARCH=$(shell go env GOARCH)
dev: GOPATH=$(shell go env GOPATH)
dev: DEV_TARGET=pkg/$(GOOS)_$(GOARCH)$(if $(HAS_LXC),-lxc)/nomad
dev: DEV_TARGET=pkg/$(GOOS)_$(GOARCH)/nomad
dev: vendorfmt changelogfmt ## Build for the current development platform
@echo "==> Removing old development build..."
@rm -f $(PROJECT_ROOT)/$(DEV_TARGET)
Expand Down Expand Up @@ -268,7 +252,7 @@ test-nomad: dev ## Run Nomad test suites
$(if $(ENABLE_RACE),-race) $(if $(VERBOSE),-v) \
-cover \
-timeout=15m \
-tags="$(if $(HAS_LXC),lxc)" ./... $(if $(VERBOSE), >test.log ; echo $$? > exit-code)
./... $(if $(VERBOSE), >test.log ; echo $$? > exit-code)
@if [ $(VERBOSE) ] ; then \
bash -C "$(PROJECT_ROOT)/scripts/test_check.sh" ; \
fi
Expand Down
Loading

0 comments on commit d0efb37

Please sign in to comment.