aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile34
-rw-r--r--Makefile.debian32
-rw-r--r--Makefile.freebsd57
-rw-r--r--Makefile.silent (renamed from Makefile.at)0
-rw-r--r--debian.doc/debian.txt (renamed from debian.txt)0
-rw-r--r--debian.in/debian.control.in (renamed from debian.control.in)0
-rw-r--r--debian.in/debian.pkg (renamed from debian.pkg)0
-rwxr-xr-xdebian.sh/debian.control.sh (renamed from debian.control.sh)0
-rw-r--r--freebsd.doc/freebsd.txt (renamed from freebsd.txt)0
-rw-r--r--freebsd.in/freebsd.local.217.pkg-descr (renamed from freebsd.local.217.pkg-descr)0
-rw-r--r--freebsd.in/freebsd.local.Makefile (renamed from freebsd.local.Makefile)0
-rw-r--r--freebsd.in/freebsd.local.Makefile.inc (renamed from freebsd.local.Makefile.inc)0
-rw-r--r--freebsd.in/freebsd.makefile.in (renamed from freebsd.makefile.in)0
-rw-r--r--freebsd.in/freebsd.pkg (renamed from freebsd.pkg)0
-rw-r--r--freebsd.in/freebsd.ports.find.c (renamed from freebsd.ports.find.c)0
-rwxr-xr-xfreebsd.sh/freebsd.install.sh (renamed from freebsd.install.sh)4
-rwxr-xr-xfreebsd.sh/freebsd.makefile.sh (renamed from freebsd.makefile.sh)0
-rwxr-xr-xfreebsd.sh/freebsd.ports.sh (renamed from freebsd.ports.sh)5
-rw-r--r--packages.mk45
-rwxr-xr-xpackages.sh5
21 files changed, 123 insertions, 61 deletions
diff --git a/.gitignore b/.gitignore
index 10847dc..d1039cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,4 @@
*.ports
*.control
*.makefile
-/freebsd.ports.find
+/freebsd.sh/freebsd.ports.find
diff --git a/Makefile b/Makefile
deleted file mode 100644
index a0b249d..0000000
--- a/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-# vim: set ts=8 sts=8 sw=8 ft=make:
-
-.POSIX:
-.PHONY: all clean clean-exe clean-doc distclean debian freebsd readme
-.SUFFIXES: .pkg .list .txt .html
-
-V=0
-CC=c99
-
-RM_IF_FAIL= || { rm -f "$@" && false; }
-
-include Makefile.at
-
-all: readme debian freebsd
-readme: README.html
-
-.pkg.list: packages.h packages.sh
- $(AT_CPP)./packages.sh `echo "$<" | cut -d . -f 1` | sort | uniq > "$@" $(RM_IF_FAIL)
-
-.txt.html:
- -$(AT_DOC)asciidoc -b html -o "$@" "$<"
-
-include Makefile.debian
-include Makefile.freebsd
-
-clean:
- rm -f *.control *.makefile *.ports *.list
- rm -rf *.out
-clean-exe:
- rm -f freebsd.ports.find
-clean-doc:
- rm -f *.html
-
-distclean: clean clean-exe clean-doc
diff --git a/Makefile.debian b/Makefile.debian
index ced82c4..070203d 100644
--- a/Makefile.debian
+++ b/Makefile.debian
@@ -1,12 +1,26 @@
# vim: set ts=8 sts=8 sw=8 ft=make:
# Create .deb meta-package for Debian
-DEBIAN_OUTPUT= debian.out/217-meta.deb
-DEBIAN_OUTPUT_TMPDIR= debian.out/217-meta
-debian: debian.html $(DEBIAN_OUTPUT)
-$(DEBIAN_OUTPUT): debian.control
- $(AT_MKDIR)mkdir -p $(DEBIAN_OUTPUT_TMPDIR)/DEBIAN
- $(AT_COPY)cp -pf debian.control $(DEBIAN_OUTPUT_TMPDIR)/DEBIAN/control
- $(AT_PKG)dpkg-deb --build $(DEBIAN_OUTPUT_TMPDIR) $(DEBIAN_OUTPUT)
-debian.control: debian.control.in debian.control.sh debian.list
- $(AT_GEN)./debian.control.sh debian.control.in debian.list > "$@" $(RM_IF_FAIL)
+PLATFORM= debian
+OUTPUT_DOC= $(PLATFORM_DOC)/debian.html
+OUTPUT_PKG= $(PLATFORM_OUT)/217-meta.deb
+OUTPUT_TMPDIR= $(PLATFORM_OUT)/217-meta
+
+CLEAN_DOC_FILES= $(OUTPUT_DOC)
+
+include packages.mk
+
+debian: $(OUTPUT_DOC) $(OUTPUT_PKG)
+
+# debian.control.in + debian.list --(debian.control.sh)-> debian.control
+CONTROL_SH= $(PLATFORM_SH)/debian.control.sh
+CONTROL_IN= $(PLATFORM_IN)/debian.control.in
+CONTROL_OUT= $(PLATFORM_OUT)/debian.control
+$(CONTROL_OUT): $(CONTROL_SH) $(CONTROL_IN) $(PKGLIST_OUT)
+ $(AT_GEN)./$(CONTROL_SH) $(CONTROL_IN) $(PKGLIST_OUT) > $(CONTROL_OUT) $(RM_IF_FAIL)
+
+# debian.control -> 217-meta.deb
+$(OUTPUT_PKG): $(CONTROL_OUT)
+ -$(AT_MKDIR)mkdir -p $(OUTPUT_TMPDIR)/DEBIAN
+ $(AT_COPY)cp -pf $(CONTROL_OUT) $(OUTPUT_TMPDIR)/DEBIAN/control
+ $(AT_PKG)dpkg-deb --build $(OUTPUT_TMPDIR) $(OUTPUT_PKG)
diff --git a/Makefile.freebsd b/Makefile.freebsd
index b1d2bfd..c563e71 100644
--- a/Makefile.freebsd
+++ b/Makefile.freebsd
@@ -1,18 +1,51 @@
# vim: set ts=8 sts=8 sw=8 ft=make:
# Create meta-ports for FreeBSD
-FREEBSD_OUTPUT= freebsd.out/217
-freebsd: freebsd.html $(FREEBSD_OUTPUT)
-$(FREEBSD_OUTPUT): freebsd.makefile
- $(AT_MKDIR)mkdir -p freebsd.out/217
- $(AT_COPY)cp -pf freebsd.makefile freebsd.out/217/Makefile
- $(AT_COPY)cp -pf freebsd.local.217.pkg-descr freebsd.out/217/pkg-descr
-freebsd.makefile: freebsd.makefile.in freebsd.makefile.sh freebsd.ports
- $(AT_GEN)./freebsd.makefile.sh freebsd.makefile.in freebsd.ports > "$@" $(RM_IF_FAIL)
-freebsd.ports: freebsd.list freebsd.ports.sh freebsd.ports.find
- $(AT_GEN)./freebsd.ports.sh freebsd.list > "$@" $(RM_IF_FAIL)
-freebsd.ports.find: freebsd.ports.find.c
- $(AT_CC)$(CC) -DHASH_TABLE_SIZE=50000 "$<" -o "$@"
+PLATFORM= freebsd
+OUTPUT_DOC= $(PLATFORM_DOC)/freebsd.html
+OUTPUT_PKG= $(PLATFORM_OUT)/217/Makefile
+OUTPUT_PKGDESC=$(PLATFORM_OUT)/217/pkg-descr
+OUTPUT_PKGDIR= $(PLATFORM_OUT)/217
+
+CLEAN_DOC_FILES= $(OUTPUT_DOC)
+CLEAN_EXE_FILES= $(PORTS_FIND_BIN)
+
+include packages.mk
+
+
+PKGDESC_IN= $(PLATFORM_IN)/freebsd.local.217.pkg-descr
+
+freebsd: $(OUTPUT_DOC) $(OUTPUT_PKG) $(OUTPUT_PKGDESC)
+
+# freebsd.ports.find.c -> freebsd.ports.find
+PORTS_FIND_C= $(PLATFORM_IN)/freebsd.ports.find.c
+PORTS_FIND_BIN=$(PLATFORM_SH)/freebsd.ports.find
+$(PORTS_FIND_BIN): $(PORTS_FIND_C)
+ $(AT_CC)$(CC) -DHASH_TABLE_SIZE=50000 $(PORTS_FIND_C) -o $(PORTS_FIND_BIN)
+
+# freebsd.list --(freebsd.ports.sh + freebsd.ports.find)-> freebsd.ports
+PORTS_SH= $(PLATFORM_SH)/freebsd.ports.sh
+PORTS_OUT= $(PLATFORM_OUT)/freebsd.ports
+$(PORTS_OUT): $(PORTS_SH) $(PKGLIST_OUT) $(PORTS_FIND_BIN)
+ $(AT_GEN)./$(PORTS_SH) $(PKGLIST_OUT) > $(PORTS_OUT) $(RM_IF_FAIL)
+
+# freebsd.makefile.in + freebsd.ports --(freebsd.makefile.sh)-> freebsd.makefile
+MAKEFILE_SH= $(PLATFORM_SH)/freebsd.makefile.sh
+MAKEFILE_IN= $(PLATFORM_IN)/freebsd.makefile.in
+MAKEFILE_OUT= $(PLATFORM_OUT)/freebsd.makefile
+$(MAKEFILE_OUT): $(MAKEFILE_SH) $(MAKEFILE_IN) $(PORTS_OUT)
+ $(AT_GEN)./$(MAKEFILE_SH) $(MAKEFILE_IN) $(PORTS_OUT) > $(MAKEFILE_OUT) $(RM_IF_FAIL)
+
+# freebsd.makefile -> 217/Makefile
+$(OUTPUT_PKG): $(MAKEFILE_OUT)
+ -$(AT_MKDIR)mkdir -p $(OUTPUT_PKGDIR)
+ $(AT_COPY)cp -pf $(MAKEFILE_OUT) $(OUTPUT_PKG)
+
+# freebsd.local.217.pkg-descr -> 217/pkg-descr
+$(OUTPUT_PKGDESC): $(PKGDESC_IN)
+ -$(AT_MKDIR)mkdir -p $(OUTPUT_PKGDIR)
+ $(AT_COPY)cp -pf $(PKGDESC_IN) $(OUTPUT_PKGDESC)
+
# Install meta-ports for FreeBSD
freebsd-install: freebsd
diff --git a/Makefile.at b/Makefile.silent
index ce48330..ce48330 100644
--- a/Makefile.at
+++ b/Makefile.silent
diff --git a/debian.txt b/debian.doc/debian.txt
index 43ac595..43ac595 100644
--- a/debian.txt
+++ b/debian.doc/debian.txt
diff --git a/debian.control.in b/debian.in/debian.control.in
index dc83f67..dc83f67 100644
--- a/debian.control.in
+++ b/debian.in/debian.control.in
diff --git a/debian.pkg b/debian.in/debian.pkg
index 9564f58..9564f58 100644
--- a/debian.pkg
+++ b/debian.in/debian.pkg
diff --git a/debian.control.sh b/debian.sh/debian.control.sh
index 01a176f..01a176f 100755
--- a/debian.control.sh
+++ b/debian.sh/debian.control.sh
diff --git a/freebsd.txt b/freebsd.doc/freebsd.txt
index d98c8b3..d98c8b3 100644
--- a/freebsd.txt
+++ b/freebsd.doc/freebsd.txt
diff --git a/freebsd.local.217.pkg-descr b/freebsd.in/freebsd.local.217.pkg-descr
index 94d04ce..94d04ce 100644
--- a/freebsd.local.217.pkg-descr
+++ b/freebsd.in/freebsd.local.217.pkg-descr
diff --git a/freebsd.local.Makefile b/freebsd.in/freebsd.local.Makefile
index 6f4b770..6f4b770 100644
--- a/freebsd.local.Makefile
+++ b/freebsd.in/freebsd.local.Makefile
diff --git a/freebsd.local.Makefile.inc b/freebsd.in/freebsd.local.Makefile.inc
index 69842a0..69842a0 100644
--- a/freebsd.local.Makefile.inc
+++ b/freebsd.in/freebsd.local.Makefile.inc
diff --git a/freebsd.makefile.in b/freebsd.in/freebsd.makefile.in
index eb11c14..eb11c14 100644
--- a/freebsd.makefile.in
+++ b/freebsd.in/freebsd.makefile.in
diff --git a/freebsd.pkg b/freebsd.in/freebsd.pkg
index 5eb67de..5eb67de 100644
--- a/freebsd.pkg
+++ b/freebsd.in/freebsd.pkg
diff --git a/freebsd.ports.find.c b/freebsd.in/freebsd.ports.find.c
index 309ea89..309ea89 100644
--- a/freebsd.ports.find.c
+++ b/freebsd.in/freebsd.ports.find.c
diff --git a/freebsd.install.sh b/freebsd.sh/freebsd.install.sh
index a55e1bd..6d496e7 100755
--- a/freebsd.install.sh
+++ b/freebsd.sh/freebsd.install.sh
@@ -14,8 +14,8 @@ msg_and_mkdir () {
[ '!' -d "${PORTSDIR}/local" ] && \
msg_and_mkdir "${PORTSDIR}/local"
[ '!' -f "${PORTSDIR}/local/Makefile" ] && \
- msg_and_copy "freebsd.local.Makefile" "${PORTSDIR}/local/Makefile"
+ msg_and_copy "freebsd.in/freebsd.local.Makefile" "${PORTSDIR}/local/Makefile"
[ '!' -f "${PORTSDIR}/local/Makefile.inc" ] && \
- msg_and_copy "freebsd.local.Makefile.inc" "${PORTSDIR}/local/Makefile.inc"
+ msg_and_copy "freebsd.in/freebsd.local.Makefile.inc" "${PORTSDIR}/local/Makefile.inc"
msg_and_copy "freebsd.out/217" "${PORTSDIR}/local"
diff --git a/freebsd.makefile.sh b/freebsd.sh/freebsd.makefile.sh
index 4a1c23a..4a1c23a 100755
--- a/freebsd.makefile.sh
+++ b/freebsd.sh/freebsd.makefile.sh
diff --git a/freebsd.ports.sh b/freebsd.sh/freebsd.ports.sh
index c7c5679..1fa4b5d 100755
--- a/freebsd.ports.sh
+++ b/freebsd.sh/freebsd.ports.sh
@@ -9,12 +9,15 @@ msg () {
: ${PORTSDIR:="/usr/ports"}
index="${PORTSDIR}/INDEX-${FREEBSD_VERSION}"
+shdir="$(dirname "$0")"
+: ${shdir:="."}
+
msg "==> FreeBSD version is ${FREEBSD_VERSION}"
msg "==> FreeBSD ports tree is ${PORTSDIR}"
msg "==> FreeBSD ports index file is ${index}"
msg "==> Running freebsd.ports.find"
-if ./freebsd.ports.find "$1" "${index}"; then
+if "${shdir}/freebsd.ports.find" "$1" "${index}"; then
msg "==> Done!"
else
msg "==> Failed"
diff --git a/packages.mk b/packages.mk
new file mode 100644
index 0000000..3ca60bf
--- /dev/null
+++ b/packages.mk
@@ -0,0 +1,45 @@
+# vim: set ts=8 sts=8 sw=8 ft=make:
+
+.POSIX:
+.PHONY: all clean clean-exe clean-doc distclean $(PLATFORM)
+.SUFFIXES: .txt .html
+
+V= 0
+CC= c99
+ASCIIDOC= asciidoc
+
+RM_IF_FAIL= || { rm -f "$@" && false; }
+
+PLATFORM_SH= $(PLATFORM).sh
+PLATFORM_IN= $(PLATFORM).in
+PLATFORM_OUT= $(PLATFORM).out
+PLATFORM_DOC= $(PLATFORM).doc
+
+PKGLIST_IN= $(PLATFORM_IN)/$(PLATFORM).pkg
+PKGLIST_OUT= $(PLATFORM_OUT)/$(PLATFORM).list
+
+# Include silent rules
+include Makefile.silent
+
+# Do platform-independent tasks
+all: README.html $(PLATFORM)
+
+# Generate top-level directory documentation
+.txt.html:
+ -$(AT_DOC)$(ASCIIDOC) -b html -o "$@" "$<"
+
+# Generate package list
+$(PKGLIST_OUT): $(PKGLIST_IN) packages.h packages.sh
+ -$(AT_MKDIR)mkdir -p $(PLATFORM_OUT)
+ $(AT_CPP)CPPFLAGS="-I. -I$(PLATFORM_IN)" ./packages.sh $(PLATFORM) \
+ | sort | uniq > $(PKGLIST_OUT) $(RM_IF_FAIL)
+
+# Clean files
+clean:
+ rm -rf *.out $(CLEAN_FILES)
+clean-exe:
+ rm -f $(CLEAN_EXE_FILES)
+clean-doc:
+ rm -f *.html $(CLEAN_DOC_FILES)
+
+distclean: clean clean-exe clean-doc
diff --git a/packages.sh b/packages.sh
index 272367c..c797a87 100755
--- a/packages.sh
+++ b/packages.sh
@@ -4,13 +4,14 @@ toupper () {
echo "$1" | tr '[:lower:]' '[:upper:]'
}
-[ -z "${CPP}" ] && CPP="cpp"
[ -z "$1" ] && echo "Usage: $0 os_type cpp_args" && exit 1
[ -z "$2" ] && default="yes"
ostype="`toupper "$1"`"
shift
+: ${CPP:="cpp"}
+: ${CPPFLAGS:="-I."}
if [ "$default" = "yes" ]; then
selarg="-UWSPKG_NO_DEFAULT "
else
@@ -21,5 +22,5 @@ else
done
fi
-${CPP} -D"$ostype" $selarg packages.h | \
+${CPP} ${CPPFLAGS} -D"$ostype" $selarg packages.h | \
sed -e '/^#/d' -e '/^ *$/d' | tr ' ' '\n' | sed '/^ *$/d'