summaryrefslogtreecommitdiff
path: root/Makefile
blob: d6f48b788d26b72d9a8beed5699e27b908176e99 (plain)
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

SHELL = /bin/bash

GITHUB_ORG = digitalocean

# Origin does not point to https://github.com/digitalocean/prometheus-client-c.git in TravisCI so we must add a new
# remote for fetching. Fetch master, diff on the filenames and look for C files. If no changes to C files are made, skip
# the build.
CHANGED_FILES = $(shell git remote add ci https://github.com/${GITHUB_ORG}/prometheus-client-c.git > /dev/null 2>&1; git fetch ci master > /dev/null 2>&1; git diff --name-only ci/master | egrep -v '.*\.md$$')

ifneq ($(shell echo "x${CHANGED_FILES}x" | sed 's/\n\t //'), xx)
default: build_and_test
else
default: build_and_test
# default: changed_files
	# @echo -e "\033[1;32mNothing to build\033[0m"
endif

build_and_test: changed_files clean build test package smoke
.PHONY: build_and_test

all: build_and_test docs
.PHONY: all

clean:
	./auto clean

build: clean
	./auto build 
.PHONY: build

test: build
	./auto test
.PHONY: test

package: test
	./auto package
.PHONY: smoke

docs: smoke
	./auto build -e auto -a docs
.PHONY: package

changed_files:
	@echo "Changed C files: ${CHANGED_FILES}"
.PHONY: changed_files

smoke: package
	./auto build -e auto -a smoke
.PHONY: smoke