Commit 7eb8daaa authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

Much better Makefile coupled with shell script

parent edf4bdf8
...@@ -3,23 +3,18 @@ OK_COLOR=\x1b[32;01m ...@@ -3,23 +3,18 @@ OK_COLOR=\x1b[32;01m
ERROR_COLOR=\x1b[31;01m ERROR_COLOR=\x1b[31;01m
WARN_COLOR=\x1b[33;01m WARN_COLOR=\x1b[33;01m
export ROOTDIR=$(CURDIR)
all: all:
@mkdir -p bin/ @mkdir -p bin/
go get -d -v ./... @echo "$(OK_COLOR)==> Installing dependencies$(NO_COLOR)"
@echo "$(OK_COLOR)--> Compiling Packer...$(NO_COLOR)" @go get -d -v ./...
go build -v -o bin/packer @echo "$(OK_COLOR)==> Building$(NO_COLOR)"
@echo "$(OK_COLOR)--> Compiling Builder: Amazon EBS...$(NO_COLOR)" @./build.sh
$(MAKE) -C plugin/builder-amazon-ebs
@echo "$(OK_COLOR)--> Compiling Command: Build...$(NO_COLOR)"
$(MAKE) -C plugin/command-build
format: format:
go fmt ./... go fmt ./...
test: test:
@echo "$(OK_COLOR)--> Testing Packer...$(NO_COLOR)" @echo "$(OK_COLOR)==> Testing Packer...$(NO_COLOR)"
@go list -f '{{range .TestImports}}{{.}}\ @go list -f '{{range .TestImports}}{{.}}\
{{end}}' ./... | xargs -n1 go get -d {{end}}' ./... | xargs -n1 go get -d
go test ./... go test ./...
......
#!/bin/sh
set -e
NO_COLOR="\x1b[0m"
OK_COLOR="\x1b[32;01m"
ERROR_COLOR="\x1b[31;01m"
WARN_COLOR="\x1b[33;01m"
# Compile the main Packer app
echo "${OK_COLOR}--> Compiling Packer${NO_COLOR}"
go build -v -o bin/packer .
# Go over each plugin and build it
for PLUGIN in $(find ./plugin -type d -mindepth 1 -maxdepth 1); do
PLUGIN_NAME=$(basename ${PLUGIN})
echo "${OK_COLOR}--> Compiling Plugin: ${PLUGIN_NAME}${NO_COLOR}"
go build -v -o bin/packer-${PLUGIN_NAME} ${PLUGIN}
done
PLUGIN_NAME=packer-builder-amazon-ebs
plugin:
go get -d -v ./...
go build -v -o $(ROOTDIR)/bin/$(PLUGIN_NAME)
format:
go fmt ./...
test:
@go list -f '{{range .TestImports}}{{.}}\
{{end}}' ./... | xargs -n1 go get -d
go test ./...
.PHONY: all format test
plugin:
go get -d -v ./...
go build -v -o $(ROOTDIR)/bin/packer-command-build
format:
go fmt ./...
test:
@go list -f '{{range .TestImports}}{{.}}\
{{end}}' ./... | xargs -n1 go get -d
go test ./...
.PHONY: all format test
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment