Skip to content

Commit

Permalink
Add Makefile and ARM support (#178)
Browse files Browse the repository at this point in the history
* Add Makefile and ARM support

Signed-off-by: Drasko DRASKOVIC <[email protected]>

* Add Docker build

Signed-off-by: Drasko DRASKOVIC <[email protected]>
  • Loading branch information
drasko authored and mijicd committed Mar 13, 2018
1 parent ccd8965 commit 5cb169f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
48 changes: 48 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
BUILD_DIR=build
SERVICES=manager http normalizer coap
DOCKERS=$(addprefix docker_,$(SERVICES))

all: $(SERVICES)
.PHONY: all $(SERVICES) docker

define compile_service
GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) go build -ldflags "-s -w" -o ${BUILD_DIR}/mainflux-$(1) cmd/$(1)/main.go
endef

define make_docker
docker build --build-arg SVC_NAME=$(subst docker_,,$(1)) --tag=mainflux/$(subst docker_,,$(1)) -f docker/Dockerfile .
endef

manager:
$(call compile_service,$(@))

http:
$(call compile_service,$(@))

normalizer:
$(call compile_service,$(@))

coap:
$(call compile_service,$(@))

clean:
rm -rf ${BUILD_DIR}

install:
cp ${BUILD_DIR}/* $(GOBIN)

# Docker
docker_manager:
$(call make_docker,$(@))

docker_http:
$(call make_docker,$(@))

docker_normalizer:
$(call make_docker,$(@))

docker_coap:
$(call make_docker,$(@))

docker: $(DOCKERS)

0 comments on commit 5cb169f

Please sign in to comment.