-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|