This repository has been archived by the owner on Oct 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
84 lines (64 loc) · 2.31 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
## vim: foldmarker={{{,}}} foldlevel=0 foldmethod=marker spell:
## This makefile uses :: to define targets so that the targets can be extended.
## https://stackoverflow.com/questions/1644920/override-target-in-makefile-to-add-more-commands/1645332#1645332
## Variables {{{
SHELL := /bin/bash
LOGSTASH_PLUGIN ?= /usr/share/logstash/bin/logstash-plugin
RSYNC_DEPLOY_OPTIONS ?= --copy-links --recursive --verbose --prune-empty-dirs --filter='. logstash-config-integration-testing/rsync_deploy_filter'
## }}}
.PHONY: FORCE_MAKE
.PHONY: default
default: list
## list targets (help) {{{
.PHONY: list
# https://stackoverflow.com/a/26339924/2429985
list:
@echo "This Makefile has the following targets:"
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^(:?[^[:alnum:]]|FORCE_MAKE$$)' -e '^$@$$' | sed 's/^/ /'
## }}}
# This commands needs to be run from inside of logstash-config-integration-testing/.
.PHONY: setup
setup: project_template/
mkdir --parents ../input/ ../conf.d/
cp --recursive --interactive $</.gitignore $</* ../
ln --relative --symbolic --force ./conf.d/* ../conf.d/
.PHONY: run-tests
run-tests:: ./logstash-config-integration-testing/run_tests
"$<"
.PHONY: run-bulk-tests
run-bulk-tests:: ./logstash-config-integration-testing/run_tests
"$<" '.' 'bulk'
.PHONY: check
check:: check-integration-testing
.PHONY: check-integration-testing
check-integration-testing::
if ! git diff --quiet -- output/; then echo "Please ensure that ./output/ is clean in git." 1>&2; exit 3; fi
$(MAKE) run-tests
git diff --quiet -- output/
# git add output/
$(MAKE) run-bulk-tests
.PHONY: install-deps
install-deps::
## `$(LOGSTASH_PLUGIN) install` needs a little bit of encouragement using `yes`.
yes | $(LOGSTASH_PLUGIN) install logstash-filter-translate
.PHONY: live
live::
.PHONY: install
install: live
.PHONY: push
push: live
.PHONY: prepare-local-restore
prepare-local-restore:: ./deploy
rm -rf ls_etc_local_restore/conf.d/ ls_etc_local_restore/includes/ ls_etc_local_restore/patterns/
"./$<" ls_etc_local_restore
$(MAKE) run-tests
## }}}
## development {{{
.PHONY: clean
clean::
find . -name '*.py[co]' -delete
rm -rf *.egg *.egg-info output*/*
.PHONY: distclean
distclean:: clean
rm -rf output*
## }}}