-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
94 lines (77 loc) · 1.73 KB
/
makefile
File metadata and controls
94 lines (77 loc) · 1.73 KB
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
# Installation paths
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
# Binary name
NAME = builder
# Compiler settings (requires R)
CC = $(shell R CMD config CC)
CFLAGS = $(shell R CMD config --cppflags)
LDFLAGS = $(shell R CMD config --ldflags)
EXTRAFLAGS = -Wall -Iinclude
RELEASEFLAGS = -O2 -s
DEBUGFLAGS = -g
# Source files
FILES = src/main.c \
src/r.c \
src/for.c \
src/parser.c \
src/file.c \
src/define.c \
src/include.c \
src/fstring.c \
src/deconstruct.c \
src/test.c \
src/preflight.c \
src/plugins.c \
src/const.c \
src/deadcode.c \
src/error.c \
src/sourcemap.c \
src/watch.c \
src/depends.c \
src/create.c \
src/assert.c \
src/buffer.c \
src/foreach.c \
src/config.c
# Development commands
CMD = ./bin/$(NAME) \
-input srcr \
-profile dev \
-DDEBUG -DTEST '"a string"' -DXXX 42 \
-import builder.r::generate.rh \
-plugin builder.air::plugin \
-strip \
-prepend test \
-sourcemap
CMD_DEBUG = ./bin/$(NAME)-debug \
-input srcr \
-DDEBUG -DTEST '"a string"' -DXXX 42 \
-import builder.r::generate.rh \
-plugin builder.air::plugin \
-strip \
-prepend test \
-sourcemap
.PHONY: all build build-debug clean install uninstall dev debug site
all: build
build: $(FILES) | bin
$(CC) $(CFLAGS) $(EXTRAFLAGS) $(RELEASEFLAGS) $^ -o bin/$(NAME) $(LDFLAGS)
build-debug: $(FILES) | bin
$(CC) $(CFLAGS) $(EXTRAFLAGS) $(DEBUGFLAGS) $^ -o bin/$(NAME)-debug $(LDFLAGS)
bin:
mkdir -p bin
clean:
rm -f bin/$(NAME) bin/$(NAME)-debug
install: build
install -d $(DESTDIR)$(BINDIR)
install -m 755 bin/$(NAME) $(DESTDIR)$(BINDIR)/$(NAME)
uninstall:
rm -f $(DESTDIR)$(BINDIR)/$(NAME)
dev: build
time $(CMD)
dryrun: build
$(CMD) -dry-run -diff
debug: build-debug
valgrind --leak-check=full $(CMD_DEBUG)
site:
./docs/build.sh