Permalink
Browse files

Added bin/ support

  • Loading branch information...
1 parent 7c63a3c commit 3ca992a13e775789797469aee79a84752bb4324c @tadzik tadzik committed with Aug 11, 2010
Showing with 17 additions and 2 deletions.
  1. +17 −2 bin/ufo
View
19 bin/ufo
@@ -12,9 +12,11 @@ BLIB = blib
P6LIB = $(PWD)/$(BLIB)/lib:$(PWD)/lib:$(PERL6LIB)
$sources
+$scripts
PIRS = $(patsubst %.pm6,%.pir,$(SOURCES:%.pm=%.pir))
BLIB_PIRS = $(PIRS:%=$(BLIB)/%)
INSTALL_SOURCES = $(SOURCES:%=$(PREFIX)/%)
+INSTALL_SCRIPTS = $(SCRIPTS:%=$(PREFIX)/%)
INSTALL_PIRS = $(PIRS:%=$(PREFIX)/%)
TESTS = $(shell if [ -d 't' ]; then find t -name '*.t'; fi)
@@ -39,7 +41,7 @@ test:: build
$(TESTS):: build
env PERL6LIB=$(P6LIB) prove -v -e '$(PERL6)' -r --nocolor $@
-install:: build $(INSTALL_SOURCES) $(INSTALL_PIRS)
+install:: build $(INSTALL_SOURCES) $(INSTALL_PIRS) $(INSTALL_SCRIPTS)
$(PREFIX)/%.pm:: %.pm
mkdir -p `dirname '$@'`
@@ -53,6 +55,10 @@ $(PREFIX)/%.pir:: blib/%.pir
mkdir -p `dirname '$@'`
install $< $@
+$(PREFIX)/bin/%:: bin/%
+ mkdir -p `dirname '$@'`
+ install $< $@
+
clean::
rm -fr $(BLIB)
@@ -69,17 +75,26 @@ sub MAIN($filename = 'Makefile', Bool :$alpha) {
}
my $sources = get_sources();
+ my $scripts = get_scripts();
my $makefile = $filename eq '-' ?? $*OUT !! open $filename, :w;
$makefile.print(
makefile_template()\
.subst(/^\n/, '')\
.subst('$binary', $binary)\
- .subst('$sources', $sources)
+ .subst('$sources', $sources)\
+ .subst('$scripts', $scripts)
);
}
+sub get_scripts() {
+ if 'lib'.IO ~~ :d {
+ return 'SCRIPTS=' ~ qx[echo bin/*].chomp;
+ }
+ return Nil;
+}
+
sub get_sources() {
if 'lib'.IO !~~ :e {
note "lib/ doesn't exist. Nothing to do.";

0 comments on commit 3ca992a

Please sign in to comment.