Skip to content

Instantly share code, notes, and snippets.

@schwern
Created April 19, 2010 15:15
Show Gist options
  • Select an option

  • Save schwern/371143 to your computer and use it in GitHub Desktop.

Select an option

Save schwern/371143 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
# The idea here is to take the benefits of make (highly visible code,
# excellent dependency tracking) and combine them with Module::Build
# (portable, OO overrides).
# This is all valid Perl code (with a small source filter)
# To use, you run the schmakefile directly.
# perl schmake
# perl schmake test
# perl schmake install
# Some calculated data may be cached to improve performance.
# Minimal source filter. Turns this into an anon subclass and turms
# "target : dep" into methods.
use Schmake;
# ******Features to consider******
# Equivalent to make -n
# Ignore return status (is eval enough?)
# Don't echo this line (possibly default)
# Kill the target if a command fails
# Equivalent to $? and $* and the like
# Introspection of the dependency tree
# Self-hosting
# Makefile.PL and Build.PL and autoconf emulation
# Better user diagnostics for things like missing deps
# Module::Install style declarations of metadata
name "Foo::Bar";
perl_version "5.10.1";
requires "perl5i";
external_dep "..."; # libraries, binaries, databases
# Execute before the default install
install :< dep1 dep2
...
# Execute after the default install target
install :: conf/my.conf conf/other.conf
install($_, { type => "config" }) for @_;
say <<END;
Write it from here.
END
run(...a shell command...);
# Execute this after the default install as well
install :: sbin/foo sbin/bar
install($_, { type => "sbin" }) for @_;
# Completely override the default install target
install : dep1 dep2
...
# Perfectly valid Perl code
say "This is the end";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment