-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
55 lines (44 loc) · 1.2 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
VERSION=1.14.2
CFLAGS+=-Wall -Wextra -O2
# If creating a reproducible build, force the buildtime to the hardcoded date.
# See https://reproducible-builds.org/specs/source-date-epoch/
ifneq ($(SOURCE_DATE_EPOCH),)
BUILD_TIME=$(SOURCE_DATE_EPOCH)
else
BUILD_TIME=$(shell date +%s)
endif
# _GNU_SOURCE is for asprintf
EXTRA_CFLAGS= -D_GNU_SOURCE -DPROGRAM_VERSION=$(VERSION) -DBUILD_TIME=$(BUILD_TIME)
ifeq ($(shell uname),Darwin)
EXTRA_CFLAGS+=-Isrc/compat
EXTRA_SRC=src/compat/compat.c
endif
erlinit: $(wildcard src/*.c) $(EXTRA_SRC)
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $^
fixture:
$(MAKE) -C tests/fixture
test: check
check:
# Ensure that erlinit is built the reproducible way for the tests
$(RM) erlinit
SOURCE_DATE_EPOCH=1568377824 $(MAKE) do_check
do_check: erlinit fixture
tests/run_tests.sh
format:
astyle \
--style=kr \
--indent=spaces=4 \
--align-pointer=name \
--align-reference=name \
--convert-tabs \
--attach-namespaces \
--max-code-length=100 \
--max-instatement-indent=120 \
--pad-header \
--pad-oper \
src/*.[ch]
clean:
$(RM) erlinit
$(RM) -r tests/work
$(MAKE) -C tests/fixture clean
.PHONY: test clean check fixture do_check