
SHELL=/bin/sh

# Path to ruby interpreter
RUBY=@RUBY@

# Any extra options from configure script to pass to 'setup.rb config'
RUBY_CONFIG_OPTS=@RUBY_CONFIG_OPTS@

# gem install expects to find these 2 lines
RUBYLIBDIR    = $(sitelibdir)$(target_prefix)
RUBYARCHDIR   = $(sitearchdir)$(target_prefix)


all: .config
	$(RUBY) setup.rb setup

install:
	$(RUBY) setup.rb install

clean: .config
	$(RUBY) setup.rb clean

distclean: .config
	$(RUBY) setup.rb clean
	rm -f Makefile ext/RMagick/extconf.rb metaconfig
	rm -f ext/RMagick/Makefile config.cache config.log
	rm -rf autom4te.cache

uninstall: .config
	$(RUBY) uninstall.rb $(RUBY_CONFIG_OPTS)

.config: metaconfig
	if test -n "$(RUBYLIBDIR)"; then \
		RUBYLIBDIR=--rbdir="$(RUBYLIBDIR)"; \
	fi; \
	if test -n "$(RUBYARCHDIR)"; then \
		RUBYARCHDIR=--sodir="$(RUBYARCHDIR)"; \
	fi; \
	$(RUBY) setup.rb config $$RUBYLIBDIR $$RUBYARCHDIR $(RUBY_CONFIG_OPTS)

