| 1 |
<?php |
| 2 |
// Pass path to root as the first argument |
| 3 |
$PHPDIR = isset($argv[1]) ? $argv[1] : '.'; |
| 4 |
|
| 5 |
// Include common modules |
| 6 |
require_once("${PHPDIR}/inc/menu.php"); |
| 7 |
require_once("${PHPDIR}/inc/plugins.php"); |
| 8 |
|
| 9 |
// Include configuration |
| 10 |
require_once("${PHPDIR}/config/plugins.php"); |
| 11 |
sort_plugins(); |
| 12 |
|
| 13 |
require_once("${PHPDIR}/config/menu.php"); |
| 14 |
|
| 15 |
// Generate list of files |
| 16 |
$ITEMS = array(); |
| 17 |
$HTML_FILES = array('$(HTMLDIR)/index.html'); |
| 18 |
$HTML_DIRS = array(); |
| 19 |
raw_menu_list($ITEMS); |
| 20 |
foreach ($ITEMS as &$item) |
| 21 |
{ |
| 22 |
$item['dir'] = 'html' . ((isset($item['parent'])) ? "/" . $item['parent'] : ""); |
| 23 |
$item['html'] = $item['dir'] . '/' . $item['id'] . ".html"; |
| 24 |
|
| 25 |
$HTML_DIRS[$item['dir']] = "$(HTMLDIR)/" . $item['dir']; |
| 26 |
array_push($HTML_FILES, "$(HTMLDIR)/" . $item['html']); |
| 27 |
} |
| 28 |
?> |
| 29 |
# Auto generated makefile, do not edit |
| 30 |
|
| 31 |
ifneq ($(VERBOSE),1) |
| 32 |
.SILENT: |
| 33 |
endif |
| 34 |
|
| 35 |
FILE = $(@:$(HTMLDIR)/%.html=%.html) |
| 36 |
PAGE = $(patsubst %.html,%,$(notdir $(@))) |
| 37 |
DIR = $(@:$(HTMLDIR)/%=%) |
| 38 |
HTMLDIR := \ |
| 39 |
$(BUILDDIR)/html |
| 40 |
DIRS := \ |
| 41 |
<?php print(implode(" \\\n\t\t", $HTML_DIRS) . "\n") ?> |
| 42 |
FILES := \ |
| 43 |
<?php print(implode(" \\\n\t\t", $HTML_FILES) . "\n") ?> |
| 44 |
|
| 45 |
.PHONY: all |
| 46 |
.DEFAULT_GOAL = all |
| 47 |
|
| 48 |
all: $(FILES) |
| 49 |
|
| 50 |
# Common rules |
| 51 |
$(DIRS): |
| 52 |
@echo " mkdir $(DIR)" |
| 53 |
mkdir -p $(@) |
| 54 |
|
| 55 |
$(FILES): $(DIRS) |
| 56 |
@echo " $(PHP) $(FILE)" |
| 57 |
$(PHP) -f index.php $(PAGE) >$(@) |