NAME=asm_adsp219x
R2_PLUGINS=$(shell r2 -H R2_USER_PLUGINS)
R2_INCDIR=$(shell r2 -H R2_INCDIR)
R2_LIBDIR=$(shell r2 -H R2_LIBDIR)

all: $(NAME).so

$(NAME).so: $(NAME).c
	gcc -shared -Wall -O2 -fPIC \
		-I$(R2_INCDIR) -I$(R2_INCDIR)/sdb \
		-L$(R2_LIBDIR) \
		$(NAME).c -o $@ -lr_arch -lr_util

install: $(NAME).so
	mkdir -p $(R2_PLUGINS)
	cp -f $(NAME).so $(R2_PLUGINS)/

uninstall:
	rm -f $(R2_PLUGINS)/$(NAME).so

clean:
	rm -f $(NAME).so

.PHONY: all install uninstall clean
