aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 71b1824fcd9a85d8a8719c2ff5f10391cfd06501 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
libbt.so: bt.c
	$(CC) -o $@ $^ -shared -fPIC -static-libgcc -ldl $(CFLAGS)

run: $(patsubst example/%.c, out/%, $(wildcard example/*.c))
run: $(patsubst example/%.c, run/%, $(wildcard example/*.c))

CFLAGS := -Wall -Wextra -g
CFLAGS_recurse1 := -Wno-infinite-recursion
CFLAGS_recurse2 := -lpthread -Wno-infinite-recursion

run/%:
	LD_PRELOAD=$(PWD)/libbt.so out/$* || test $$? -eq 42 && exit 0

out/%: example/%.c libbt.so
	@mkdir -p out
	$(CC) -o $@ $< -rdynamic $(CFLAGS) $(CFLAGS_$*)

clean:
	$(RM) -r out
	$(RM) libbt.so