about summary refs log tree commit diff
path: root/Makefile
blob: 809ace3b9fd06c2e98bf427a412982739f3c98f7 (plain) (blame)
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
.POSIX:
.PHONY: all clean check install uninstall

CXXFLAGS += -g -std=c++23 -Wextra -Werror
LDLIBS += -lcommon -ldyninstAPI -linstructionAPI -lparseAPI # dyninst

PREFIX ?= /usr/local
BIN_PREFIX ::= $(DESTDIR)$(PREFIX)/bin/taosc-
DATA_DIR ::= $(DESTDIR)$(PREFIX)/share/taosc

BIN ::= collect-values fix measure-stack scout sort-inputs synth trace-call
DATA ::= collect cover jump patch

all: $(BIN) $(DATA)

clean:
	rm -f $(BIN) $(DATA)

fix: fix.m4
	m4 -D DATA_DIR=$(DATA_DIR) $< > $@

measure-stack: measure-stack.o helpers.o
	$(CXX) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@

scout: scout.o helpers.o
	$(CXX) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@

trace-call: trace-call.o helpers.o
	$(CXX) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@

%: %.zig
	zig build-exe -O ReleaseSafe $<

%: %.c
	e9compile $<

check: synth.zig
	zig test $<

install: $(BIN:%=$(BIN_PREFIX)%) $(DATA:%=$(DATA_DIR)/%)

$(BIN_PREFIX)%: %
	install -Dm 755 $< $@

$(DATA_DIR)/%: %
	install -Dm 644 $< $@

uninstall:
	rm -f $(BIN:%=$(BIN_PREFIX)%) $(DATA:%=$(DATA_DIR)/%)
	rmdir $(DATA_DIR)