summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.in67
-rwxr-xr-xconfigure190
-rw-r--r--man/Makefile.in60
-rw-r--r--src/Makefile.in66
4 files changed, 383 insertions, 0 deletions
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..fb32e7f
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,67 @@
+# cgol
+# Makefile.in
+# Input Makefile for configure.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+SHELL = @shell@
+INSTALL = @install@
+MAKE = @make@
+CC = @cc@
+
+SRCDIR = @srcdir@
+PREFIX = @prefix@
+BINDIR = @bindir@
+MANDIR = @mandir@
+MAKE = @make@
+
+.SUFFIXES:
+
+.PHONY: all
+all:
+ @printf 'Making executable files...\n'
+ @cd src && $(MAKE) all
+ @printf 'Making manual pages...\n'
+ @cd man && $(MAKE) all
+
+.PHONY: clean
+clean:
+ @printf 'Cleaning executable files...\n'
+ @cd src && $(MAKE) clean
+ @printf 'Cleaning manual pages...\n'
+ @cd man && $(MAKE) clean
+
+.PHONY: install
+install: all
+ @printf 'Generating installation configuration...\n'
+ @if [ -n '$(DESTDIR)' ]; then \
+ destdir='$(DESTDIR)'; \
+ else \
+ destdir=/; \
+ fi; \
+ mkdir -p "$${destdir}"; \
+ echo "DESTDIR=$$(cd "$${destdir}" && pwd)" > install.config
+ @printf 'Installing executable files...\n'
+ @cd src && $(MAKE) $$(cat ../install.config) install
+ @printf 'Installing manual pages...\n'
+ @cd man && $(MAKE) $$(cat ../install.config) install
+
+.PHONY: uninstall
+uninstall:
+ @printf 'Uninstalling executable files...\n'
+ @cd src && $(MAKE) $$(cat ../install.config) uninstall
+ @printf 'Uninstalling manual pages...\n'
+ @cd man && $(MAKE) $$(cat ../install.config) uninstall
diff --git a/configure b/configure
new file mode 100755
index 0000000..f92417f
--- /dev/null
+++ b/configure
@@ -0,0 +1,190 @@
+#! /bin/sh
+#
+# cgol
+# configure
+# Configuration script to generate Makefile.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+PACKAGE='cgol'
+VERSION='0.1.2'
+
+print_usage()
+{
+ printf 'Usage: %s [OPTION]...\n' "$1"
+}
+
+print_help()
+{
+ cat <<EOF
+\`configure' configures ${PACKAGE} ${VERSION} to adapt to ONE kind of system.
+
+$(print_usage "${1}")
+
+Configuration:
+ -h, --help display this help and exit
+ -V, --version display version information and exit
+ -q, --quiet do not print \`checking ...' messages
+ --srcdir=SRCDIR find the scripts in SRCDIR
+ default: configure dir
+
+Installation directories:
+ --prefix=PREFIX install files under PREFIX
+ default: /usr/local
+ --bindir=BINDIR install scripts in BINDIR
+ default: PREFIX/bin
+ --mandir=MANDIR install manual pages in MANDIR
+ default: PREFIX/share/man
+EOF
+}
+
+print_version()
+{
+ cat <<EOF
+${PACKAGE} ${VERSION} configure
+Not generated by GNU Autoconf
+
+Copyright (C) 2011-2012 Patrick "P. J." McDermott
+License: GNU GPL version 3 or later <http://www.gnu.org/licenses/gpl.html>.
+This configure script is free software: you can redistribute and/or modify it.
+There is NO WARRANTY, to the extent permitted by law.
+EOF
+}
+
+opts=$(getopt -n "${0}" -o 'hVq' -l 'help,version,quiet' \
+ -l 'srcdir:,prefix:,bindir:,mandir:' -- "${@}")
+if [ ${?} -ne 0 ]; then
+ print_usage "${0}" >&2
+ exit 1;
+fi
+eval set -- "${opts}"
+while true; do
+ case "${1}" in
+ -h|--help)
+ print_help "${0}"
+ exit 0
+ ;;
+ -V|--version)
+ print_version
+ exit 0
+ ;;
+ -q|--quiet)
+ QUIET=true
+ shift
+ ;;
+ --srcdir)
+ SRCDIR="${2}"
+ shift 2
+ ;;
+ --prefix)
+ PREFIX="${2}"
+ shift 2
+ ;;
+ --bindir)
+ # Leave PREFIX unexpanded for now, in case it isn't set yet.
+ BINDIR="\${PREFIX}/${2}"
+ shift 2
+ ;;
+ --mandir)
+ # Leave PREFIX unexpanded for now, in case it isn't set yet.
+ MANDIR="\${PREFIX}/${2}"
+ shift 2
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ print_usage "${0}" >&2
+ exit 1
+ ;;
+ esac
+done
+
+if [ -z "${QUIET}" ]; then
+ QUIET=false
+fi
+
+if [ -z "${SRCDIR}" ]; then
+ SRCDIR=$(dirname "${0}")
+fi
+# Make SRCDIR an absolute path if it isn't already.
+SRCDIR=$(cd ${SRCDIR} && pwd)
+if [ -z "${PREFIX}" ]; then
+ PREFIX=/usr/local
+fi
+if [ -z "${BINDIR}" ]; then
+ BINDIR=${PREFIX}/bin
+fi
+if [ -z "${MANDIR}" ]; then
+ MANDIR=${PREFIX}/man
+fi
+# Expand PREFIX if it's there.
+eval "BINDIR=${BINDIR}"
+eval "MANDIR=${MANDIR}"
+
+find_dependency()
+{
+ dep=${1}
+ var=${2}
+ shift 2
+
+ ${QUIET} || printf 'checking for %s... ' "${dep}"
+
+ while [ ${#} -gt 0 ]; do
+ if [ -f "${1}/${dep}" ]; then
+ ${QUIET} || printf '%s/%s\n' "${1}" "${dep}"
+ eval "${var}=${1}/${dep}"
+ return 0
+ fi
+ shift
+ done
+
+ ${QUIET} || printf 'not found\n'
+ missing_dependencies=true
+ return 1
+}
+
+missing_dependencies=false
+
+find_dependency sh SHELL /bin
+find_dependency install INSTALL /usr/bin
+find_dependency make MAKE /usr/bin
+find_dependency cc CC /usr/bin
+
+if ${missing_dependencies}; then
+ printf '\nSome dependencies could not be found.\n'
+ printf 'Please make sure all dependencies are installed and try again.\n\n'
+ exit 1
+fi
+
+sed_script="
+s&@shell@&${SHELL}&
+s&@install@&${INSTALL} -c&
+s&@make@&${MAKE}&
+s&@cc@&${CC}&
+s&@srcdir@&${SRCDIR}&
+s&@prefix@&${PREFIX}&
+s&@bindir@&${BINDIR}&
+s&@mandir@&${MANDIR}&"
+
+# Replace configuration variables in Makefile.in
+mkdir -p src man
+sed "$sed_script" ${SRCDIR}/Makefile.in > Makefile
+sed "$sed_script" ${SRCDIR}/src/Makefile.in > src/Makefile
+sed "$sed_script" ${SRCDIR}/man/Makefile.in > man/Makefile
+
+printf '\nConfiguration complete!\n\n'
diff --git a/man/Makefile.in b/man/Makefile.in
new file mode 100644
index 0000000..2efaae6
--- /dev/null
+++ b/man/Makefile.in
@@ -0,0 +1,60 @@
+# opkhelper
+# Makefile.in
+# Input Makefile for configure.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+SHELL = @shell@
+INSTALL = @install@
+MAKE = @make@
+
+SRCDIR = @srcdir@
+PREFIX = @prefix@
+MANDIR = @mandir@
+
+.SUFFIXES:
+
+OBJS =
+
+.PHONY: all
+all: $(OBJS)
+
+$(OBJS):
+ @printf ' CP man/%s\n' '$@'
+ @cp $(SRCDIR)/man/$@ $@
+
+.PHONY: clean
+clean:
+ @for obj in $(OBJS); do \
+ printf ' RM man/%s\n' "$${obj}"; \
+ rm -f $${obj}; \
+ done
+
+.PHONY: install
+install: all
+ @for obj in $(OBJS); do \
+ printf ' INSTALL man/%s\n' "$${obj}"; \
+ section=$$(echo "$${obj}" | sed 's/^.*[.]\([0-9]\)$$/\1/'); \
+ $(INSTALL) -D $${obj} "$(DESTDIR)/$(MANDIR)/man$${section}/$${obj}"; \
+ done
+
+.PHONY: uninstall
+uninstall:
+ @for obj in $(OBJS); do \
+ printf ' RM %s\n' "$${obj}"; \
+ section=$$(echo "$${obj}" | sed 's/^.*[.]\([0-9]\)$$/\1/'); \
+ rm -f "$(DESTDIR)/$(MANDIR)/man$${section}/$${obj}"; \
+ done
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..8caec8f
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,66 @@
+# opkhelper
+# Makefile.in
+# Input Makefile for configure.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+SHELL = @shell@
+INSTALL = @install@
+MAKE = @make@
+CC = @cc@
+CFLAGS = -c -Wall -g
+LDFLAGS =
+
+SRCDIR = @srcdir@
+PREFIX = @prefix@
+BINDIR = @bindir@
+
+.SUFFIXES:
+.SUFFIXES: .c .o
+
+SRCS = cgol.c
+OBJS = $(SRCS:.c=.o)
+LIBS = -lcurses
+
+.PHONY: all
+all: cgol
+
+cgol: $(OBJS)
+ @printf ' LD cgol\n'
+ @$(CC) $(LDFLAGS) -o'../$@' $(LIBS) $(OBJS)
+
+$(OBJS):
+ @printf ' CC %s\n' '$@'
+ @$(CC) $(CFLAGS) -o'$@' $(SRCDIR)/src/$*.c
+
+.PHONY: clean
+clean:
+ @for obj in $(OBJS); do \
+ printf ' RM src/%s\n' "$${obj}"; \
+ rm -f $${obj}; \
+ done
+ @printf ' RM cgol\n'
+ @rm -f cgol
+
+.PHONY: install
+install: all
+ @printf ' INSTALL cgol\n'
+ @$(INSTALL) -D ../cgol '$(DESTDIR)/$(BINDIR)/cgol'
+
+.PHONY: uninstall
+uninstall:
+ @printf ' RM cgol\n'
+ @rm -f '$(DESTDIR)/$(BINDIR)/cgol'