<?php

function phpmake_makefile_top_rules()
{
 echo "# Generated from Makefile.php by phpmake v" . PHPMAKE_VERSION . "\n";
 echo "# PHPMAKE_LIBPATH = " . getenv("PHPMAKE_LIBPATH") . "\n";
 echo "# Project = " . getenv("PHPMAKE_PROJECT") . "\n";
 echo "\n";
/*
 * Generate the default rules and settings to be located
 * in the beginning of Makefile
 */

 echo "\n";
 echo "# ** Start of phpmake definitions\n";
 echo ".SUFFIXES: .PHc .PHh .PHinc .inc\t# PHP source files\n";
 echo "PHP=php\n";
 echo "PHPMAKE_PROJECT=" . getenv("PHPMAKE_PROJECT") . "\n";
 echo "PHPMAKE_LIBPATH=" . getenv("PHPMAKE_LIBPATH") . "\n";
 echo "# ** End of phpmake definitions\n";
}

function phpmake_makefile_rules()
{
 echo "\n";
 echo "# ** Start of phpmake generated rules\n";
 echo "\n";
 echo ".PHc.c:\n";
 echo "\t" . 'PHPMAKE_PROJECT=$(PHPMAKE_PROJECT) PHPMAKE_LIBPATH=$(PHPMAKE_LIBPATH) $(PHP) $< > $@' . "\n";
 echo "\n";
 echo ".PHh.h:\n";
 echo "\t" . 'PHPMAKE_PROJECT=$(PHPMAKE_PROJECT) PHPMAKE_LIBPATH=$(PHPMAKE_LIBPATH) $(PHP) $< > $@' . "\n";
 echo "\n";
 echo ".PHinc.inc:\n";
 echo "\t" . 'PHPMAKE_PROJECT=$(PHPMAKE_PROJECT) PHPMAKE_LIBPATH=$(PHPMAKE_LIBPATH) $(PHP) $< > $@' . "\n";
 echo "\n";
 echo "# ** End of phpmake generated rules\n";
 echo "\n";
}

function phpmake_print_subdirs($subdirs)
{
	echo "SUBDIRS=";

	foreach($subdirs as $d)
	{
		echo $d . " ";
        }

	echo "\t# Automatically generated by phpmake\n";
}

function phpmake_init_c()
{
 echo "// Generated by phpmake v" . PHPMAKE_VERSION . "\n";
 echo "// PHPMAKE_LIBPATH = " . getenv("PHPMAKE_LIBPATH") . "\n";
 echo "// Project = " . getenv("PHPMAKE_PROJECT") . "\n";
 echo "\n";
}

?>
