Permalink
Browse files

Adding build system

  • Loading branch information...
1 parent e294529 commit f4154557feaa06aa553eed82b189ea439e442162 @kthakore kthakore committed Aug 22, 2010
Showing with 4,148 additions and 0 deletions.
  1. +50 −0 Makefile
  2. +26 −0 bin/ascii-to-pod.pl
  3. +10 −0 bin/book-to-html
  4. +37 −0 bin/book-to-latex
  5. +3,561 −0 lib/Makefile
  6. +4 −0 lib/Makefile.ini
  7. +156 −0 lib/SDLManualLatex.pm
  8. +304 −0 lib/book.sty
View
@@ -0,0 +1,50 @@
+PERL = perl
+
+ifeq "$(PAPER)" ""
+ PAPER = $(shell paperconf)
+endif
+
+ifneq "$(TEST)" ""
+ BOOK = build/test.$(PAPER)
+ CHAPTERS = $(wildcard test/*.pod)
+else
+ BOOK = build/SDL_Manual.$(PAPER)
+ CHAPTERS = \
+ src/preface.pod \
+ src/first.pod \
+ src/drawing.pod \
+ src/events.pod \
+ src/game.pod \
+ src/pong.pod \
+ src/tetris.pod \
+ src/music.pod \
+ src/CPAN.pod \
+ src/profiling.pod \
+ src/XS_effects.pod \
+ src/PDL_OpenGL.pod
+endif
+
+default: prepare pdf clean
+
+prepare: clean
+ mkdir build
+
+html: prepare $(CHAPTERS) bin/book-to-html
+ $(PERL) bin/book-to-html $(CHAPTERS) > $(BOOK).html
+
+pdf: tex lib/Makefile
+ #cp src/mmd-table.svg build/mmd-table.svg
+ cd build && make -I ../lib -f ../lib/Makefile
+
+tex: prepare $(CHAPTERS) lib/SDLManualLatex.pm lib/book.sty bin/book-to-latex
+ $(PERL) -Ilib bin/book-to-latex --paper $(PAPER) $(CHAPTERS) > $(BOOK).tex
+
+release: pdf
+ cp $(BOOK).pdf build/book-$$(date +"%Y-%m").$(PAPER).pdf
+
+clean:
+ rm -rf build/
+
+.PHONY: clean
+
+# vim: set noexpandtab
View
@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+use 5.010;
+use utf8;
+use open IO => ':encoding(utf8)';;
+
+use Data::Dumper;
+$Data::Dumper::Useqq = 1;
+
+say "=begin table\n";
+while (<>) {
+ chomp;
+ s/^\s+//;
+ next unless length $_;
+ my @row = split /\s{2,}/, $_;
+ say "=headrow\n" if $. == 1;
+
+ say "=row\n";
+
+ for my $c (@row) {
+ say "=cell $c\n";
+ }
+
+ say "=bodyrows\n" if $. == 1;
+}
+say "=end table";
View
@@ -0,0 +1,10 @@
+#!perl -w
+use strict;
+use Pod::PseudoPod::HTML;
+
+for (@ARGV) {
+ my $parser = Pod::PseudoPod::HTML->new();
+ $parser->output_fh( *STDOUT );
+ $parser->codes_in_verbatim(1);
+ $parser->parse_file( $_ );
+}
View
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use feature ':5.10';
+use Getopt::Long;
+use SDLManualLatex;
+use Template;
+
+main();
+
+sub main {
+ my $paper;
+ GetOptions(
+
+ # Should be one of: a4, letter.
+ 'paper:s' => \$paper,
+ ) or die;
+
+ my $output;
+ for (@ARGV) {
+ my $parser = SDLManualLatex->new();
+ $parser->emit_environments( sidebar => "sidebar" );
+ $parser->codes_in_verbatim(1);
+ $parser->output_string( \$output );
+ $parser->parse_file($_);
+ }
+
+ my $tt = Template->new( { INCLUDE_PATH => 'lib', } );
+
+ print $tt->process(
+ 'book.sty', {
+ content => $output,
+ paper => $paper,
+ } );
+
+} ## end sub main
+
Oops, something went wrong.

0 comments on commit f415455

Please sign in to comment.