1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
ifeq ($(VENDORINSTALL),)
PREFIX = /usr/local
RUBYLIB = $(shell ruby -e 'puts RbConfig::CONFIG["sitedir"]')
else
PREFIX = /usr
RUBYLIB = $(shell ruby -e 'puts RbConfig::CONFIG["vendordir"]')
endif
RUBY_INSTALL_NAME = $(shell ruby -e 'puts RbConfig::CONFIG["ruby_install_name"]')
BINSTUBS := $(shell dpkg -L ruby | grep /usr/bin/ | xargs -n 1 basename)
BINSTUBS := $(subst ruby,,$(BINSTUBS))
BINARIES = ruby $(BINSTUBS)
EXTRA_BINARIES = rake
MANPAGES = ruby-standalone.1.gz
GENERATED = ruby-standalone debian_ruby_standalone_config.rb
include buildflags.mk
CFLAGS += -std=c11 -Wall
all: $(BINARIES) $(GENERATED) $(MANPAGES) $(EXTRA_BINARIES)
$(MANPAGES): %.1.gz: %.1
$(RM) $@
(cat $< | gzip - > $@) || ($(RM) $@; false)
buildflags.mk:
dpkg-buildflags --export=make > $@
$(BINSTUBS):
@printf "#!/usr/bin/env ruby\nload '/usr/bin/$@'\n" > $@ || ($(RM) $@; false)
chmod +x $@
$(GENERATED): % : %.in
sed -e 's#@@prefix@@#$(PREFIX)#g' $< > $@ || ($(RM) $@; false)
if [ "$$(basename $@ .rb)" = "$@" ]; then chmod +x $@; fi
ruby-standalone.1: README.md
pandoc --standalone --to man \
-V title:ruby-standalone \
-V section:1 \
-V footer:ruby-standalone \
-V header:'User commands' \
-V date:"$(shell LANG=C date -d "$(dpkg-parsechangelog -SDate)" '+%B %Y')" \
-o $@ $<
sed -i -e '2 s/\.SH\s*/\.SH NAME\n/' $@
install: all
install -d $(DESTDIR)$(PREFIX)/bin
install -d $(DESTDIR)$(PREFIX)/lib/ruby-standalone/bin
install -d $(DESTDIR)$(RUBYLIB)
install -d $(DESTDIR)$(PREFIX)/share/man/man1
install -m 0755 $(BINARIES) $(EXTRA_BINARIES) $(DESTDIR)$(PREFIX)/lib/ruby-standalone/bin
ln -sfT ruby $(DESTDIR)$(PREFIX)/lib/ruby-standalone/bin/$(RUBY_INSTALL_NAME)
install -m 0755 ruby-standalone $(DESTDIR)/$(PREFIX)/bin
install -m 0644 debian_ruby_standalone.rb $(DESTDIR)$(RUBYLIB)
install -m 0644 debian_ruby_standalone_config.rb $(DESTDIR)$(RUBYLIB)
install -m 0644 $(MANPAGES) $(DESTDIR)$(PREFIX)/share/man/man1
distclean clean:
$(RM) $(BINARIES) $(MANPAGES) ruby-standalone buildflags.mk *.1
test: all
if [ -x /usr/bin/ruby -a -x /usr/bin/shunit2 ]; then ./run-tests; fi
|