Skip to content

Commit

Permalink
Standardize on parens in Makefile, use CURDIR rather than $(shell pwd) (
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebakken authored and ruflin committed May 22, 2017
1 parent e39b347 commit 2c96a9c
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

BUILD_DIR=build
COVERAGE_DIR=${BUILD_DIR}/coverage
COVERAGE_DIR=$(BUILD_DIR)/coverage
BEATS=packetbeat filebeat winlogbeat metricbeat heartbeat
PROJECTS=libbeat ${BEATS}
PROJECTS=libbeat $(BEATS)
PROJECTS_ENV=libbeat filebeat metricbeat
SNAPSHOT?=yes
PYTHON_ENV?=${BUILD_DIR}/python-env
PYTHON_ENV?=$(BUILD_DIR)/python-env
VIRTUALENV_PARAMS?=
FIND=find . -type f -not -path "*/vendor/*" -not -path "*/build/*" -not -path "*/.git/*"
GOLINT=golint
Expand Down Expand Up @@ -36,15 +36,15 @@ unit:

.PHONY: coverage-report
coverage-report:
mkdir -p ${COVERAGE_DIR}
mkdir -p $(COVERAGE_DIR)
# Writes atomic mode on top of file
echo 'mode: atomic' > ./${COVERAGE_DIR}/full.cov
echo 'mode: atomic' > ./$(COVERAGE_DIR)/full.cov
# Collects all coverage files and skips top line with mode
-tail -q -n +2 ./filebeat/${COVERAGE_DIR}/*.cov >> ./${COVERAGE_DIR}/full.cov
-tail -q -n +2 ./packetbeat/${COVERAGE_DIR}/*.cov >> ./${COVERAGE_DIR}/full.cov
-tail -q -n +2 ./winlogbeat/${COVERAGE_DIR}/*.cov >> ./${COVERAGE_DIR}/full.cov
-tail -q -n +2 ./libbeat/${COVERAGE_DIR}/*.cov >> ./${COVERAGE_DIR}/full.cov
go tool cover -html=./${COVERAGE_DIR}/full.cov -o ${COVERAGE_DIR}/full.html
-tail -q -n +2 ./filebeat/$(COVERAGE_DIR)/*.cov >> ./$(COVERAGE_DIR)/full.cov
-tail -q -n +2 ./packetbeat/$(COVERAGE_DIR)/*.cov >> ./$(COVERAGE_DIR)/full.cov
-tail -q -n +2 ./winlogbeat/$(COVERAGE_DIR)/*.cov >> ./$(COVERAGE_DIR)/full.cov
-tail -q -n +2 ./libbeat/$(COVERAGE_DIR)/*.cov >> ./$(COVERAGE_DIR)/full.cov
go tool cover -html=./$(COVERAGE_DIR)/full.cov -o $(COVERAGE_DIR)/full.html

.PHONY: update
update: notice
Expand All @@ -66,7 +66,7 @@ clean-vendor:
check: python-env
$(foreach var,$(PROJECTS),$(MAKE) -C $(var) check || exit 1;)
# Checks also python files which are not part of the beats
${FIND} -name *.py -exec autopep8 -d --max-line-length 120 {} \; | (! grep . -q) || (echo "Code differs from autopep8's style" && false)
$(FIND) -name *.py -exec autopep8 -d --max-line-length 120 {} \; | (! grep . -q) || (echo "Code differs from autopep8's style" && false)
# Validate that all updates were committed
$(MAKE) update
git diff | cat
Expand All @@ -83,7 +83,7 @@ misspell:
fmt: python-env
$(foreach var,$(PROJECTS),$(MAKE) -C $(var) fmt || exit 1;)
# Cleans also python files which are not part of the beats
. ${PYTHON_ENV}/bin/activate && find . -type f -name *.py -not -path "*/vendor/*" -not -path "*/build/*" -not -path "*/.git/*" -exec autopep8 --in-place --max-line-length 120 {} \;
. $(PYTHON_ENV)/bin/activate && find . -type f -name *.py -not -path "*/vendor/*" -not -path "*/build/*" -not -path "*/.git/*" -exec autopep8 --in-place --max-line-length 120 {} \;

.PHONY: lint
lint:
Expand All @@ -99,7 +99,7 @@ beats-dashboards:
# Builds the documents for each beat
.PHONY: docs
docs:
sh libbeat/scripts/build_docs.sh ${PROJECTS}
sh libbeat/scripts/build_docs.sh $(PROJECTS)

.PHONY: package
package: update beats-dashboards
Expand All @@ -108,15 +108,15 @@ package: update beats-dashboards
# build the dashboards package
echo "Start building the dashboards package"
mkdir -p build/upload/
BUILD_DIR=${shell pwd}/build SNAPSHOT=$(SNAPSHOT) $(MAKE) -C dev-tools/packer package-dashboards ${shell pwd}/build/upload/build_id.txt
BUILD_DIR=$(CURDIR)/build SNAPSHOT=$(SNAPSHOT) $(MAKE) -C dev-tools/packer package-dashboards $(CURDIR)/build/upload/build_id.txt
mv build/upload build/dashboards-upload

# Copy build files over to top build directory
mkdir -p build/upload/
$(foreach var,$(BEATS),cp -r $(var)/build/upload/ build/upload/$(var) || exit 1;)
cp -r build/dashboards-upload build/upload/dashboards
# Run tests on the generated packages.
go test ./dev-tools/package_test.go -files "${shell pwd}/build/upload/*/*"
go test ./dev-tools/package_test.go -files "$(CURDIR)/build/upload/*/*"

# Upload nightly builds to S3
.PHONY: upload-nightlies-s3
Expand All @@ -142,5 +142,5 @@ notice:
# Sets up the virtual python environment
.PHONY: python-env
python-env:
@test -d ${PYTHON_ENV} || virtualenv ${VIRTUALENV_PARAMS} ${PYTHON_ENV}
@. ${PYTHON_ENV}/bin/activate && pip install -q --upgrade pip autopep8
@test -d $(PYTHON_ENV) || virtualenv $(VIRTUALENV_PARAMS) $(PYTHON_ENV)
@. $(PYTHON_ENV)/bin/activate && pip install -q --upgrade pip autopep8

0 comments on commit 2c96a9c

Please sign in to comment.