NAME = postscriptbarcode

RUBY_MAKEFILE_IN  = extconf.rb
RUBY_MAKEFILE     = Makefile
RUBY_OUT = $(NAME).so

EXAMPLE = example.rb

cleanlist += $(RUBY_MAKEFILE)

.PHONY: all swig-ruby test install uninstall clean

all: swig-ruby

swig-ruby: $(RUBY_OUT)

$(RUBY_OUT): $(RUBY_MAKEFILE)
	make -f $<

$(RUBY_MAKEFILE): $(RUBY_MAKEFILE_IN)
	ruby $<

test: swig-ruby
	LD_LIBRARY_PATH=../../c:$(LD_LIBRARY_PATH) ruby -I . $(EXAMPLE)

install: $(RUBY_MAKEFILE) $(RUBY_OUT)
	make -f $< install

uninstall: $(RUBY_MAKEFILE)
	make -f $< uninstall

clean:
	-make -f $(RUBY_MAKEFILE) clean
	$(RM) $(cleanlist)

