aboutsummaryrefslogblamecommitdiff
path: root/Makefile
blob: bd97388764df14bb67e1ee00acf8e52f2d8e5623 (plain) (tree)


















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

CFLAGS := -Wall -Wextra -g -O2
CFLAGS_recurse2 := -lpthread

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

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

libbt.so: bt.c
	$(CC) -o $@ $^ -shared -fPIC -static-libgcc -ldl $(FLAGS)

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