1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#!/bin/bash
# The next line finds the path. \
MFPATH=$(cd `dirname $0`; /bin/pwd)/`basename $0`
# The next line restarts with make. \
exec make -f $MFPATH MAKEFILE=$MFPATH "$@"
#############################################
# From here on, this file is parsed by make.
#############################################
# $Id#
EXT=gwlnk
TEMPLATE=/etc/gopherweblink-template.m4
# Run gopherweblink RECURSE=yes if you want to enable recursion.
# RECURSE=yes
####
SRCS := $(wildcard *.$(EXT))
HTML := $(patsubst %.$(EXT),%.html,$(SRCS))
# We do this for the info so it won't complain if there's no .info.
INFOSRC := $(wildcard .info)
INFOLNKS := $(patsubst .info,.infolinks,$(INFOSRC))
DIRS := $(shell if [ "$(RECURSE)" = "yes" ]; then find . -type d -maxdepth 1 | grep -v '^\.$$'; fi)
all: $(HTML) $(INFOLNKS) subdirs $(DIRS)
%.html: %.gwlnk $(TEMPLATE)
cat $< $(TEMPLATE) | m4 -P > $@
.PHONY: subdirs $(DIRS)
.infolinks: .info $(MAKEFILE)
perl -x/ $(MAKEFILE) < $< > $@
subdirs: $(DIRS)
$(DIRS):
$(MAKE) -C $@ -f $(MAKEFILE)
ifeq "BLACK" "WHITE"
#!/usr/bin/perl [fodder for -x]
$number = 0;
while (defined($line = <STDIN>)) {
chomp $line;
$number++;
print <<"EOF";
Name=$line
Type=i
Path=fake
Numb=$number
EOF
}
__END__
endif
|