-
-
Notifications
You must be signed in to change notification settings - Fork 238
/
Makefile
134 lines (114 loc) · 3.68 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Copyright (c) 2013-2016, Loïc Hoguin <[email protected]>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
WITHOUT ?=
BUILD_CONFIG_FILE ?= $(CURDIR)/build.config
ifeq ($(strip $(WITHOUT)),)
BUILD_CONFIG = $(shell sed "s/\#.*//" $(BUILD_CONFIG_FILE))
else
empty := $(subst ,, )
BUILD_CONFIG = $(shell sed "s/\#.*//" $(BUILD_CONFIG_FILE) \
| grep -v "^$(subst $(empty),\|^,$(WITHOUT))")
endif
ERLANG_MK ?= erlang.mk
ERLANG_MK_VERSION = $(shell git describe --dirty --tags --always)
.PHONY: all check
all:
# Temporarily force the printing of the CHANGELOG.
# The required variable hadn't been introduced yet.
#ifdef UPGRADE
@cat CHANGELOG.asciidoc
#endif
@export LC_COLLATE=C; \
awk 'FNR==1 && NR!=1{print ""}1' $(patsubst %,%.mk,$(BUILD_CONFIG)) \
| sed 's/^ERLANG_MK_VERSION =.*/ERLANG_MK_VERSION = $(ERLANG_MK_VERSION)/' \
| sed 's:^ERLANG_MK_WITHOUT =.*:ERLANG_MK_WITHOUT = $(WITHOUT):' > $(ERLANG_MK)
lint: all
$(MAKE) -f erlang.mk --warn-undefined-variables
ifdef p
# Remove p from the list of variables since that conflicts with bootstrapping.
MAKEOVERRIDES := $(filter-out p=$p,$(MAKEOVERRIDES))
check:
$(MAKE) -C test pkg-$p KEEP_BUILDS=1
else
ifdef hp
check:
$(MAKE) -C test hexpm-pkg-$(hp) KEEP_BUILDS=1 HEXPM=1
else
ifdef c
check:
$(MAKE) -C test $c c=
else
check:
$(MAKE) -C test
endif
endif
endif
packages:
$(MAKE) -C test packages
hexpm-packages:
$(MAKE) -C test hexpm-packages HEXPM=1
summary:
@mkdir -p test/logs/
@touch test/logs/latest.log test/packages/errors.log
-@sort test/packages/errors.log | diff test/logs/latest.log -
@sort test/packages/errors.log > test/logs/latest.log
@cp test/logs/latest.log "test/logs/$(shell date '+%F_%T%z')"
search:
@$(MAKE) --no-print-directory \
-f core/core.mk $(addprefix -f,$(wildcard index/*.mk)) -f core/index.mk \
search
clean:
$(MAKE) -C test clean
rm -rf doc/guide.pdf doc/html
git checkout erlang.mk
docs:
$(MAKE) -f core/core.mk -f core/docs.mk -f plugins/asciidoc.mk asciidoc DEPS=asciideck
up:
git clone [email protected]:ninenines/erlang.mk.git gh-pages
cd gh-pages && git checkout gh-pages
cd gh-pages && make
cd gh-pages && git push origin gh-pages
rm -rf gh-pages
ifdef file
up-relx:
git clone [email protected]:ninenines/erlang.mk.git gh-pages
cd gh-pages && git checkout gh-pages
cp $(file) gh-pages/res/
cd gh-pages && git add .
cd gh-pages && git commit -m "Publish new Relx version"
cd gh-pages && git push origin gh-pages
rm -rf gh-pages
else
up-relx:
@echo Missing parameter: url
endif
ifdef p
XDG_DATA_HOME ?= $(HOME)/.local/share
INSTALL_DIR ?= $(XDG_DATA_HOME)/erlang.mk/lib
install: check
for dep in `ls test/packages/$p_pkg/deps/`; do \
rm -rf $(INSTALL_DIR)/$$dep; \
mkdir -p $(INSTALL_DIR)/$$dep; \
cp -r test/packages/$p_pkg/deps/$$dep/ebin $(INSTALL_DIR)/$$dep/; \
if [ -d test/packages/$p_pkg/deps/$$dep/priv ]; then \
cp -r test/packages/$p_pkg/deps/$$dep/priv $(INSTALL_DIR)/$$dep/; \
fi; \
done
else
install:
@echo "Usage: $(MAKE) install p=<package name>"
endif
ifneq ($(strip $(LATEST_ERLANG_OTP)),)
include core/kerl.mk
endif