--- /dev/null
+#!/bin/sh
+
+for i in "$@"; do
+ echo $i
+ NAME=$(echo $i | sed "s/[\/\.]/_/g;s/^/HEADER_SUPERTUX_/" | tr [a-z] [A-Z])
+ sed -i "s/^#ifndef .*_H_\$/#ifndef $NAME/" $i;
+ sed -i "s/^#define .*_H_\$/#define $NAME/" $i;
+done
+
+# EOF #
--- /dev/null
+#!/usr/bin/ruby -w
+
+def write_file_without_lines(source, lines, without_lines)
+ out = File.new(source, 'w')
+ lines.each_with_index { |v, i|
+ if without_lines.member? i then
+ out.print "//", v
+ else
+ out.print v
+ end
+ }
+ out.close()
+end
+
+def optimize(source, target)
+ lines = File.new(source).readlines()
+ includes = []
+ lines.each_with_index { |v, i|
+ if v =~ /^#include/ then
+ # puts v
+ includes << i
+ end
+ }
+
+ unneeded_includes = []
+
+ includes.each{|i|
+ # puts i
+ write_file_without_lines(source, lines, [i])
+
+ ret = system("scons", "-u", target)
+ if ret then
+ puts "INCUNNEEDED #{source} #{lines[i].chop}"
+ unneeded_includes << i
+ end
+ }
+
+ write_file_without_lines(source, lines, unneeded_includes)
+end
+
+ARGV.each{ |filename|
+ source = filename
+ target = "build/#{filename.gsub(/\..pp$/, '.o')}"
+ puts "#{source} => #{target}"
+
+ optimize(source, target)
+}
+
+# EOF #