Skip to content

Commit

Permalink
Fix Makefile, add build instructions in README, closes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
macno committed Apr 17, 2019
1 parent 91271ae commit d19c1ab
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
22 changes: 16 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ PKG = github.com/theoapp/$(PACKAGE_NAME)
COMMON_PACKAGE_NAMESPACE=$(PKG)/common

#BUILD_PLATFORMS ?= -os '!netbsd' -os '!openbsd' -os '!windows'
BUILD_PLATFORMS ?= -os 'linux'
BUILD_PLATFORMS ?= -os 'linux' -os 'netbsd' -os 'openbsd'
BUILD_ARCHS ?= -arch 'amd64' -arch 'arm'
BUILD_DIR := $(CURDIR)
TARGET_DIR := $(BUILD_DIR)/out
VENDOR_DIR := $(BUILD_DIR)/vendor

ORIGINAL_GOPATH = $(shell echo $$GOPATH)
LOCAL_GOPATH := $(CURDIR)/.gopath
Expand Down Expand Up @@ -53,20 +54,25 @@ all: deps build
help:
@echo Help
# Commands:
# make all => deps build
# make build - builds ${NAME} for ${BUILD_PLATFORMS} platforms
# make build_current => builds ${NAME} for current platform
# make version - show information about current version
#
#
# Deployment commands:
# make deps - install all dependencies
# make clean - clean up

version:
@echo Current version: $(VERSION)

deps: $(DEP)
@cd $(PKG_BUILD_DIR) && $(DEP) ensure -v

deps: $(DEVELOPMENT_TOOLS)
release_deps: $(DEVELOPMENT_TOOLS)
@cd $(PKG_BUILD_DIR) && $(DEP) ensure -v

build: deps
build: release_deps
# Building $(NAME) in version $(VERSION) for $(BUILD_PLATFORMS)
gox $(BUILD_PLATFORMS) \
$(BUILD_ARCHS) \
Expand All @@ -75,7 +81,7 @@ build: deps
$(PKG)


build_simple: dep_check
build_current: deps
# Building $(NAME) in version $(VERSION) for current platform
go build \
-ldflags "$(GO_LDFLAGS)" \
Expand Down Expand Up @@ -118,6 +124,10 @@ release: build
clean:
-$(RM) -rf $(LOCAL_GOPATH)
-$(RM) -rf $(TARGET_DIR)
-$(RM) -rf $(VENDOR_DIR)

clean_target:
-$(RM) -rf $(TARGET_DIR)
-$(RM) -rf $(TARGET_DIR)

clean_vendor:
-$(RM) -rf $(VENDOR_DIR)
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,19 @@ theo-agent is the command line program used to fetch `authorized_keys` from [the
### Documentation

Available at [theoapp.readthedocs.io](https://theoapp.readthedocs.io/en/latest/)


### Build
To build from sources, after cloning the git repo, execute:

```
make build_current
```

To build theo-agent for the platform you are on

```
make build
```

To build theo-agent for all the supported platforms

0 comments on commit d19c1ab

Please sign in to comment.