[master] 151c79d Add alternate build-system prototype
Poul-Henning Kamp
phk at FreeBSD.org
Fri Dec 20 11:22:17 CET 2013
commit 151c79d20616fd727b375e52ac678a9b5ef061bd
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Dec 20 09:57:07 2013 +0000
Add alternate build-system prototype
diff --git a/Makefile.inc.phk b/Makefile.inc.phk
new file mode 100644
index 0000000..24756e0
--- /dev/null
+++ b/Makefile.inc.phk
@@ -0,0 +1,243 @@
+
+.PHONY: default
+default: all
+
+WARNS ?= 1
+
+.PHONY: depend all clean install test
+depend all clean install test:
+ @$(MAKE) --no-print-directory -f Makefile.phk TGT=$@ real-$@ \
+ $(shell env CC=$(CC) WARNS=$(WARNS) sh ${TOPDIR}/config.phk $(TOPDIR) $(CURDIR) )
+
+CFLAGS += $(CF_CFLAGS) $(CF_CWFLAGS)
+CFLAGS += -I$(CURDIR)
+CFLAGS += -I$(TOPDIR)
+CFLAGS += -I$(TOPDIR)/include
+CFLAGS += -I$(TOPDIR)/lib/libvgz
+CFLAGS += -I/usr/local/include
+
+SHLIB_LDFLAGS += -shared -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel
+VMOD_LDFLAGS += ${SHLIB_LDFLAGS}
+
+#######################################################################
+
+INSTALL_BASE ?= $(TOPDIR)/_install
+
+#######################################################################
+
+LIB_VARNISH = -L $(TOPDIR)/lib/libvarnish -lvarnish
+LIB_VARNISHAPI = $(TOPDIR)/lib/libvarnishapi/libvarnishapi.a
+LIB_VARNISHTOOLS = -L $(TOPDIR)/lib/libvarnishtools -lvarnishtools
+LIB_VCC = -L $(TOPDIR)/lib/libvcc -lvcc
+LIB_VGZ = -L $(TOPDIR)/lib/libvgz -lvgz
+LIB_PCRE = -L /usr/local/lib -lpcre
+LIB_EXECINFO = -lexecinfo
+LIB_CURSES = -lcurses
+LIB_READLINE = -lreadline
+
+#######################################################################
+ifdef USE_THREADS
+CFLAGS += -pthread -D_THREAD_SAFE -g -O2
+PROG_LDFLAGS += -pthread -D_THREAD_SAFE -g -O2
+endif
+
+ifdef USE_DLOPEN
+PROG_LDFLAGS += -Wl,-E
+endif
+
+#######################################################################
+ifdef SUBDIRS
+ifeq "$(findstring k,$(MAKEFLAGS))" ""
+ EOPT=set -e
+else
+ EOPT=set +e
+endif
+define run-subdirs
+ $(EOPT) ; for dir in $(SUBDIRS); do \
+ echo "->> $$dir $(@:real-%=%)" ; \
+ $(MAKE) -C $$dir -f Makefile.phk $(@:real-%=%) ; \
+ done
+endef
+else
+define run-subdirs
+endef
+endif
+
+#######################################################################
+ifdef NOWORK
+ifdef SUBDIRS
+
+.PHONY: subdirs $(SUBDIRS)
+
+subdirs: $(SUBDIRS)
+
+$(SUBDIRS):
+ $(MAKE) -C $@ -f Makefile.phk $(@:real-%=%)
+
+TODO += subdirs
+endif
+endif
+
+#######################################################################
+.SUFFIXES: .So
+.c.So:
+ ${CC} $(CFLAGS) -fPIC -c $< -o $@
+
+
+#######################################################################
+
+TODO_DEPEND += $(MADE_FILES)
+TODO_ALL += $(MADE_FILES)
+CLEAN_FILES += $(MADE_FILES)
+
+MADE_SRC = $(filter %.c, $(MADE_FILES))
+
+#######################################################################
+ifdef PROG_SRC
+PROGNAME = $(notdir $(CURDIR))
+MANNAME=$(PROGNAME).1
+TODO_DEPEND += _.depprog
+TODO_ALL += $(PROGNAME)
+TODO_INSTALL += prog_install
+PROG_SRC += $(MADE_SRC)
+PROG_OBJ = $(notdir $(PROG_SRC:.c=.o))
+CLEAN_FILES += $(PROGNAME) $(PROG_OBJ) _.depprog $(MANNAME)
+
+_.depprog: ${PROG_SRC} ${MADE_FILES}
+ $(CC) $(CFLAGS) -MM $^ > _.depprog
+
+ifeq ($(TGT), all)
+include _.depprog
+endif
+
+$(PROGNAME): $(PROG_OBJ)
+ $(CC) $(PROG_LDFLAGS) -o $(PROGNAME) $^ $(LD_ADD)
+
+.PHONY: prog_install
+prog_install: $(PROGNAME)
+ @cp $(PROGNAME) $(INSTALL_BASE)/bin/
+ @[ ! -f $(MANNAME) ] || cp $(MANNAME) $(INSTALL_BASE)/man/
+
+endif
+
+#######################################################################
+ifdef SHLIB_SRC
+SHLIBNAME = $(notdir $(CURDIR))
+TODO_ALL += $(SHLIBNAME).so
+TODO_DEPEND += _.depshlib
+TODO_INSTALL += shlib_install
+SHLIB_SRC += $(MADE_SRC)
+SHLIB_OBJ = $(notdir $(SHLIB_SRC:.c=.So))
+CLEAN_FILES += $(SHLIB_OBJ) $(SHLIBNAME).so _.depshlib
+
+_.depshlib: ${SHLIB_SRC} ${MADE_FILES}
+ $(CC) $(CFLAGS) -MM $^ |sed 's/o:/So:/' > _.depshlib
+
+ifeq ($(TGT), all)
+include _.depshlib
+endif
+
+$(SHLIBNAME).so: $(SHLIB_OBJ)
+ $(CC) $(SHLIB_LDFLAGS) -o $(SHLIBNAME).so $^
+
+.PHONY: shlib_install
+shlib_install: $(SHLIBNAME).so
+ @cp $(SHLIBNAME).so $(INSTALL_BASE)/lib/
+
+endif
+
+#######################################################################
+ifdef LIB_SRC
+LIBNAME = $(notdir $(CURDIR))
+TODO_ALL += $(LIBNAME).a
+TODO_DEPEND += _.deplib
+LIB_SRC += $(MADE_SRC)
+LIB_OBJ = $(notdir $(LIB_SRC:.c=.o))
+CLEAN_FILES += $(LIB_OBJ) $(LIBNAME).a _.deplib
+
+_.deplib: ${LIB_SRC} ${MADE_FILES}
+ $(CC) $(CFLAGS) -MM $^ > _.deplib
+
+ifeq ($(TGT), all)
+include _.deplib
+endif
+
+$(LIBNAME).a: $(LIB_OBJ)
+ $(AR) -rc $(LIBNAME).a $^
+ ranlib $(LIBNAME).a
+
+endif
+
+#######################################################################
+ifdef VMOD_SRC
+#VMODNAME = $(subst libvmod_,,$(notdir $(CURDIR)))
+VMODNAME = $(notdir $(CURDIR))
+TODO_ALL += vcc_if.h vcc_if.c $(VMODNAME).so
+TODO_DEPEND += _.depvmod
+TODO_INSTALL += vmod_install
+VMOD_SRC += $(MADE_SRC)
+VMOD_SRC += vcc_if.c
+VMOD_OBJ = $(notdir $(VMOD_SRC:.c=.So))
+CLEAN_FILES += $(VMOD_OBJ) vcc_if.c vcc_if.h $(VMODNAME).so _.depvmod
+
+CFLAGS += -I$(TOPDIR)/bin/varnishd
+
+_.depvmod: ${VMOD_SRC} ${MADE_FILES}
+ $(CC) $(CFLAGS) -MM $^ |sed 's/o:/So:/' > _.depvmod
+
+ifeq ($(TGT), all)
+include _.depvmod
+endif
+
+vcc_if.c vcc_if.h: vmod.vcc $(TOPDIR)/lib/libvcc/vmodtool.py
+ ${PYTHON} $(TOPDIR)/lib/libvcc/vmodtool.py
+
+$(VMODNAME).so: $(VMOD_OBJ)
+ $(CC) $(VMOD_LDFLAGS) -o $(VMODNAME).so $^
+
+.PHONY: vmod_install
+vmod_install: $(VMODNAME).so
+ @cp $(VMODNAME).so $(INSTALL_BASE)/libexec/
+
+endif
+
+#######################################################################
+ifdef RST_MAN
+ifdef HAVE_RST2HTML
+TODO_ALL += ${MANNAME}
+
+${MANNAME}: ${RST_MAN}
+ rst2man ${RST_MAN} $(MANNAME)
+
+endif
+endif
+
+#######################################################################
+
+.PHONY: real-depend
+real-depend: $(TODO) $(TODO_DEPEND)
+ @$(run-subdirs)
+ @true
+
+.PHONY: real-all
+real-all: $(TODO) $(TODO_ALL)
+ @$(run-subdirs)
+ @true
+
+.PHONY: real-clean
+real-clean: $(TODO) $(TODO_CLEAN)
+ @$(run-subdirs)
+ @[ "x$(CLEAN_FILES)" = "x" ] || rm -f $(CLEAN_FILES)
+
+.PHONY: real-install
+real-install: $(TODO_INSTALL)
+ @$(run-subdirs)
+ @true
+
+.PHONY: real-test
+real-test: $(TODO_TEST)
+ @$(run-subdirs)
+ @true
+
+#######################################################################
+
diff --git a/Makefile.phk b/Makefile.phk
new file mode 100644
index 0000000..237992c
--- /dev/null
+++ b/Makefile.phk
@@ -0,0 +1,15 @@
+SUBDIRS = lib bin doc
+
+CLEAN_FILES += config.h include/vcs_version. include/vmod_abi.h _.cache
+
+TODO_INSTALL += top_install
+
+TOPDIR = $(CURDIR)
+include $(TOPDIR)/Makefile.inc.phk
+
+.PHONY: top_install
+top_install:
+ @for d in man doc etc bin lib libexec ; do \
+ mkdir -p $(INSTALL_BASE)/$$d ; \
+ done
+
diff --git a/bin/Makefile.phk b/bin/Makefile.phk
new file mode 100644
index 0000000..933c9d8
--- /dev/null
+++ b/bin/Makefile.phk
@@ -0,0 +1,12 @@
+SUBDIRS += varnishadm
+SUBDIRS += varnishd
+SUBDIRS += varnishlog
+SUBDIRS += varnishncsa
+# varnishreplay
+SUBDIRS += varnishtest
+SUBDIRS += varnishstat
+# SUBDIRS += varnishhist
+# SUBDIRS += varnishtop
+
+TOPDIR = $(CURDIR)/..
+include $(TOPDIR)/Makefile.inc.phk
diff --git a/bin/varnishadm/Makefile.phk b/bin/varnishadm/Makefile.phk
new file mode 100644
index 0000000..6d6cb2a
--- /dev/null
+++ b/bin/varnishadm/Makefile.phk
@@ -0,0 +1,12 @@
+PROG_SRC = varnishadm.c
+
+LD_ADD += ${LIB_VARNISHAPI}
+LD_ADD += ${LIB_VARNISH}
+LD_ADD += ${LIB_PCRE}
+LD_ADD += ${LIB_READLINE}
+LD_ADD += -lm
+
+RST_MAN += $(TOPDIR)/doc/sphinx/reference/varnishadm.rst
+
+TOPDIR = $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
diff --git a/bin/varnishd/Makefile.phk b/bin/varnishd/Makefile.phk
new file mode 100644
index 0000000..30c1a89
--- /dev/null
+++ b/bin/varnishd/Makefile.phk
@@ -0,0 +1,121 @@
+VPATH += cache common mgt waiter storage hash
+
+PROG_SRC += cache/cache_acceptor.c
+PROG_SRC += cache/cache_backend.c
+PROG_SRC += cache/cache_backend_cfg.c
+PROG_SRC += cache/cache_backend_poll.c
+PROG_SRC += cache/cache_ban.c
+PROG_SRC += cache/cache_busyobj.c
+PROG_SRC += cache/cache_cli.c
+PROG_SRC += cache/cache_dir.c
+PROG_SRC += cache/cache_esi_deliver.c
+PROG_SRC += cache/cache_esi_fetch.c
+PROG_SRC += cache/cache_esi_parse.c
+PROG_SRC += cache/cache_expire.c
+PROG_SRC += cache/cache_fetch.c
+PROG_SRC += cache/cache_fetch_proc.c
+PROG_SRC += cache/cache_gzip.c
+PROG_SRC += cache/cache_hash.c
+PROG_SRC += cache/cache_http.c
+PROG_SRC += cache/cache_http1_deliver.c
+PROG_SRC += cache/cache_http1_fetch.c
+PROG_SRC += cache/cache_http1_fsm.c
+PROG_SRC += cache/cache_http1_proto.c
+PROG_SRC += cache/cache_lck.c
+PROG_SRC += cache/cache_main.c
+PROG_SRC += cache/cache_mempool.c
+PROG_SRC += cache/cache_obj.c
+PROG_SRC += cache/cache_panic.c
+PROG_SRC += cache/cache_pipe.c
+PROG_SRC += cache/cache_pool.c
+PROG_SRC += cache/cache_req_fsm.c
+PROG_SRC += cache/cache_rfc2616.c
+PROG_SRC += cache/cache_session.c
+PROG_SRC += cache/cache_shmlog.c
+PROG_SRC += cache/cache_vary.c
+PROG_SRC += cache/cache_vcl.c
+PROG_SRC += cache/cache_vrt.c
+PROG_SRC += cache/cache_vrt_re.c
+PROG_SRC += cache/cache_vrt_var.c
+PROG_SRC += cache/cache_vrt_vmod.c
+PROG_SRC += cache/cache_wrk.c
+PROG_SRC += cache/cache_wrw.c
+PROG_SRC += cache/cache_ws.c
+
+PROG_SRC += common/common_vsc.c
+PROG_SRC += common/common_vsm.c
+
+PROG_SRC += hash/hash_classic.c
+PROG_SRC += hash/hash_critbit.c
+PROG_SRC += hash/hash_mgt.c
+PROG_SRC += hash/hash_simple_list.c
+
+PROG_SRC += mgt/mgt_child.c
+PROG_SRC += mgt/mgt_cli.c
+PROG_SRC += mgt/mgt_main.c
+PROG_SRC += mgt/mgt_param.c
+PROG_SRC += mgt/mgt_param_bits.c
+PROG_SRC += mgt/mgt_param_tbl.c
+PROG_SRC += mgt/mgt_param_tweak.c
+PROG_SRC += mgt/mgt_pool.c
+PROG_SRC += mgt/mgt_sandbox.c
+PROG_SRC += mgt/mgt_sandbox_solaris.c
+PROG_SRC += mgt/mgt_shmem.c
+PROG_SRC += mgt/mgt_vcc.c
+
+PROG_SRC += storage/stevedore.c
+PROG_SRC += storage/stevedore_mgt.c
+PROG_SRC += storage/stevedore_utils.c
+PROG_SRC += storage/storage_file.c
+PROG_SRC += storage/storage_malloc.c
+PROG_SRC += storage/storage_persistent.c
+PROG_SRC += storage/storage_persistent_mgt.c
+PROG_SRC += storage/storage_persistent_silo.c
+PROG_SRC += storage/storage_persistent_subr.c
+PROG_SRC += storage/storage_synth.c
+PROG_SRC += storage/storage_umem.c
+
+PROG_SRC += waiter/cache_waiter.c
+PROG_SRC += waiter/cache_waiter_epoll.c
+PROG_SRC += waiter/cache_waiter_kqueue.c
+PROG_SRC += waiter/cache_waiter_poll.c
+PROG_SRC += waiter/cache_waiter_ports.c
+PROG_SRC += waiter/mgt_waiter.c
+
+USE_THREADS = YES
+USE_DLOPEN = YES
+
+LD_ADD += ${LIB_VARNISH}
+LD_ADD += ${LIB_VCC}
+LD_ADD += ${LIB_PCRE}
+LD_ADD += ${LIB_EXECINFO}
+LD_ADD += ${LIB_VGZ}
+LD_ADD += -lm
+
+RST_MAN += $(TOPDIR)/doc/sphinx/reference/varnishd.rst
+
+MADE_FILES += default_vcl.h
+
+TODO_INSTALL += install_etc
+
+TOPDIR = $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
+
+#
+# Turn the default.vcl file into a C-string we can include in the program.
+#
+default_vcl.h: default.vcl
+ echo '/*' > $@
+ echo ' * NB: This file is machine generated, DO NOT EDIT!' >> $@
+ echo ' *' >> $@
+ echo ' * Edit default.vcl instead and run make' >> $@
+ echo ' *' >> $@
+ echo ' */' >> $@
+ echo '' >> $@
+ sed -e 's/"/\\"/g' \
+ -e 's/$$/\\n"/' \
+ -e 's/^/ "/' default.vcl >> $@
+
+.PHONY: install_etc
+install_etc: default_vcl.h
+ @cp default_vcl.h $(INSTALL_BASE)/etc/
diff --git a/bin/varnishhist/Makefile.phk b/bin/varnishhist/Makefile.phk
new file mode 100644
index 0000000..145414d
--- /dev/null
+++ b/bin/varnishhist/Makefile.phk
@@ -0,0 +1,7 @@
+PROG_SRC = varnishhist.c
+
+LD_ADD += ${LIB_VARNISH}
+LD_ADD += ${LIB_VARNISHAPI}
+
+TOPDIR = $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
diff --git a/bin/varnishlog/Makefile.phk b/bin/varnishlog/Makefile.phk
new file mode 100644
index 0000000..5f0de52
--- /dev/null
+++ b/bin/varnishlog/Makefile.phk
@@ -0,0 +1,15 @@
+PROG_SRC = varnishlog.c
+PROG_SRC = varnishlog_options.c
+
+LD_ADD += ${LIB_VARNISHTOOLS}
+LD_ADD += ${LIB_VARNISHAPI}
+LD_ADD += ${LIB_VARNISH}
+LD_ADD += ${LIB_PCRE}
+LD_ADD += -lm
+
+TODO_ALL += build_man
+
+TOPDIR = $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
+
+.PHONY: build_man
diff --git a/bin/varnishncsa/Makefile.phk b/bin/varnishncsa/Makefile.phk
new file mode 100644
index 0000000..10fd638
--- /dev/null
+++ b/bin/varnishncsa/Makefile.phk
@@ -0,0 +1,16 @@
+PROG_SRC += base64.c
+PROG_SRC += varnishncsa.c
+PROG_SRC += varnishncsa_options.c
+
+LD_ADD += ${LIB_VARNISHTOOLS}
+LD_ADD += ${LIB_VARNISHAPI}
+LD_ADD += ${LIB_VARNISH}
+LD_ADD += ${LIB_PCRE}
+LD_ADD += -lm
+
+TODO_ALL += build_man
+
+TOPDIR = $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
+
+.PHONY: build_man
diff --git a/bin/varnishreplay/Makefile.phk b/bin/varnishreplay/Makefile.phk
new file mode 100644
index 0000000..d69f03e
--- /dev/null
+++ b/bin/varnishreplay/Makefile.phk
@@ -0,0 +1,7 @@
+PROG_SRC = varnishreplay.c
+
+LD_ADD += ${LIB_VARNISH}
+LD_ADD += ${LIB_VARNISHAPI}
+
+TOPDIR = $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
diff --git a/bin/varnishstat/Makefile.phk b/bin/varnishstat/Makefile.phk
new file mode 100644
index 0000000..3a89de7
--- /dev/null
+++ b/bin/varnishstat/Makefile.phk
@@ -0,0 +1,13 @@
+PROG_SRC += varnishstat.c
+PROG_SRC += varnishstat_curses.c
+
+LD_ADD += ${LIB_VARNISHAPI}
+LD_ADD += ${LIB_VARNISH}
+LD_ADD += ${LIB_PCRE}
+LD_ADD += ${LIB_CURSES}
+LD_ADD += -lm
+
+RST_MAN += $(TOPDIR)/doc/sphinx/reference/varnishstat.rst
+
+TOPDIR = $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
diff --git a/bin/varnishtest/Makefile.phk b/bin/varnishtest/Makefile.phk
new file mode 100644
index 0000000..748977e
--- /dev/null
+++ b/bin/varnishtest/Makefile.phk
@@ -0,0 +1,29 @@
+PROG_SRC += vtc.c
+PROG_SRC += vtc_client.c
+PROG_SRC += vtc_http.c
+PROG_SRC += vtc_log.c
+PROG_SRC += vtc_logexp.c
+PROG_SRC += vtc_main.c
+PROG_SRC += vtc_sema.c
+PROG_SRC += vtc_server.c
+PROG_SRC += vtc_varnish.c
+
+LD_ADD += ${LIB_VARNISHAPI}
+LD_ADD += ${LIB_VARNISH}
+LD_ADD += ${LIB_PCRE}
+LD_ADD += ${LIB_VGZ}
+LD_ADD += -lm
+
+USE_THREADS = yes
+
+RST_MAN += $(TOPDIR)/doc/sphinx/reference/varnishtest.rst
+
+TODO_TEST += all_tests
+
+TOPDIR = $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
+
+.PHONY: all_tests
+
+all_tests:
+ ./varnishtest -i -j 4 tests/*.vtc
diff --git a/bin/varnishtop/Makefile.phk b/bin/varnishtop/Makefile.phk
new file mode 100644
index 0000000..1b922f3
--- /dev/null
+++ b/bin/varnishtop/Makefile.phk
@@ -0,0 +1,9 @@
+PROG_SRC = varnishtop.c
+
+LD_ADD += ${LIB_VARNISH}
+LD_ADD += ${LIB_VARNISHAPI}
+LD_ADD += ${LIB_PCRE}
+LD_ADD += ${LIB_CURSES}
+
+TOPDIR = $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
diff --git a/config.phk b/config.phk
new file mode 100644
index 0000000..89ed5f9
--- /dev/null
+++ b/config.phk
@@ -0,0 +1,249 @@
+#!/bin/sh
+
+set -e
+
+#######################################################################
+# Adminstrative settings
+
+ADM_PROJECT=varnish
+ADM_VERSION=trunk
+
+CONFIG_H=phk_hack/config.h
+
+#######################################################################
+# We always rebuild the config when make is run in the toplevel directory
+# Otherwise, we try to use a cached config, if we have one.
+#
+# We know we're in the toplevel directory, because we get passed
+# TOPDIR and CURDIR as arguments
+
+if [ "x$1" = "x" -o "x$2" = "x" ] ; then
+ echo "Missing arguments, assuming topdir" 1>&2
+ set `pwd` `pwd`
+fi
+
+if [ "x$1" = "x$2" ] ; then
+ rm -f _.cache
+elif [ "x$1" != "x" -a -d $1 ] ; then
+ cd $1
+fi
+
+#######################################################################
+# autocrap co-existence
+# We put our config.h somewhere else and delete autocraps.
+# Autocrap regenerates its own config.h and doesn't know about ours
+
+mkdir -p phk_hack
+rm -f config.h
+
+#######################################################################
+
+
+if [ -f _.cache -a -f ${CONFIG_H} ] ; then
+ cat _.cache
+ exit 0
+fi
+
+echo "Building Config" 1>&2
+
+#######################################################################
+# Look for #include files for HAVE_ etc.
+
+if true ; then
+ rm -f ${CONFIG_H}_
+ echo '' > ${CONFIG_H}_
+
+ for i in \
+ curses.h \
+ endian.h \
+ execinfo.h \
+ ncurses.h \
+ ncurses/curses.h \
+ ncursesw.h \
+ ncursesw/curses.h \
+ priv.h \
+ pthread_np.h \
+ readline/history.h \
+ readline/readline.h \
+ sys/endian.h \
+ sys/filio.h \
+ sys/mount.h \
+ sys/statvfs.h \
+ sys/vfs.h \
+ umem.h
+ do
+ if [ -f /usr/include/$i ] ; then
+ n=`echo $i | tr '[a-z/.]' '[A-Z__]'`
+ echo "#define HAVE_$n 1" >> ${CONFIG_H}_
+ fi
+ done
+ echo "#define PACKAGE_TARNAME \"${ADM_PROJECT}\"" >> ${CONFIG_H}_
+ echo "#define PACKAGE_VERSION \"${ADM_VERSION}\"" >> ${CONFIG_H}_
+
+ echo '
+ #define VARNISH_STATE_DIR "/tmp/phk/"
+ ' >> ${CONFIG_H}_
+ if [ ! -f ${CONFIG_H} ] ; then
+ mv ${CONFIG_H}_ ${CONFIG_H}
+ elif ! cmp -s ${CONFIG_H} ${CONFIG_H}_ ; then
+ mv ${CONFIG_H}_ ${CONFIG_H}
+ else
+ rm -f ${CONFIG_H}_
+ fi
+fi
+
+#######################################################################
+# Create files depending on VCS (git) output
+
+VCSF=include/vcs_version.h
+VMAV=include/vmod_abi.h
+
+if [ -d ./.git ] ; then
+ V=`git show -s --pretty=format:%h`
+else
+ V="NOGIT"
+fi
+(
+echo "/* $V */"
+echo "/*"
+echo " * NB: This file is machine generated, DO NOT EDIT!"
+echo " *"
+echo " * make(1) updates this when necessary"
+echo " *"
+echo " */"
+echo "#define VCS_Version \"$V\""
+) > ${VCSF}_
+if [ ! -f ${VCSF} ] ; then
+ mv ${VCSF}_ ${VCSF}
+ rm -f ${VMAV}
+elif ! cmp -s ${VCSF}_ ${VCSF} ; then
+ mv ${VCSF}_ ${VCSF}
+ rm -f ${VMAV}
+else
+ rm ${VCSF}_
+fi
+
+if [ ! -f ${VMAV} ] ; then
+ echo "#define VMOD_ABI_Version \"Varnish trunk $V\"" > ${VMAV}
+fi
+
+#######################################################################
+# Ask the compiler about stuff
+
+ask_compiler() {
+ a=`echo "$2" |
+ ${CC-cc} -E - -DWARNS=${WARNS-1} |
+ sed -e '/^#/d' -e '/^$/d' -e 's/"//g' -e 's/~/"/g' `
+ echo "$1='" $a "'" >> _.cache
+}
+
+# Warning flags
+ask_compiler CF_CWFLAGS '
+ #if WARNS >= 1
+ "-Wall"
+ "-Werror"
+ #endif
+ #if WARNS >= 2
+ "-W"
+ "-fstack-protector"
+ "-Wno-format-y2k"
+ "-Wno-unused-parameter"
+ "-Wstrict-prototypes"
+ "-Wmissing-prototypes"
+ "-Wpointer-arith"
+ "-Wreturn-type"
+ "-Wcast-qual"
+ "-Wwrite-strings"
+ "-Wswitch"
+ "-Wshadow"
+ "-Wunused-parameter"
+ "-Wcast-align"
+ "-Wchar-subscripts"
+ "-Winline"
+ "-Wnested-externs"
+ "-Wno-pointer-sign"
+ "-Wno-empty-body"
+ "-Wextra"
+ "-Wno-missing-field-initializers"
+ "-Wno-sign-compare"
+ #if defined(__clang__)
+ "-Wmissing-variable-declarations"
+ "-Wno-string-plus-int"
+ #endif
+ #endif
+ '
+
+# Configuration options
+ask_compiler CF_CFLAGS '
+ #if defined(__SVR4) && defined(sun)
+ // Solaris and OmniOS
+ "-DHAVE_GETHRTIME"
+ "-DHAVE_PORT_CREATE"
+ "-DHAVE_SETPPRIV"
+ #endif
+
+ #if !defined(__APPLE__)
+ "-DHAVE_DAEMON"
+ #endif
+
+ // Where does this not work ?
+ "-DSO_SNDTIMEO_WORKS"
+ "-DSO_RCVTIMEO_WORKS"
+ "-DHAVE_TCP_KEEP"
+
+ "-DVCC_CC=~\~exec $(CC) -D_THREAD_SAFE -std=gnu99 -g -O2 -Wall -Werror -pthread -fpic -shared -Wl,-x -o %o %s\~~"
+
+ "-DVCC_WARNS=~\~$(CF_CWFLAGS)\~~"
+
+ "-I$(TOPDIR)/phk_hack"
+
+ '
+
+#######################################################################
+# Find a Python interpreter
+#
+
+for i in 3.2 2.7 "" 2.5 2.6 3.0 3.1
+do
+ if python$i < /dev/null > /dev/null 2>&1 ; then
+ echo PYTHON=python$i >> _.cache
+ break
+ fi
+done
+
+#######################################################################
+# Find a rst2* tools
+#
+
+if echo | rst2html > /dev/null 2>&1 ; then
+ echo "HAVE_RST2HTML=1" >> _.cache
+fi
+
+cat _.cache
+exit 0
+
+
+# HAVE_ACCEPT_FILTERS +
+# HAVE_BACKTRACE +
+# HAVE_CLOCK_GETTIME +
+# HAVE_DAEMON +
+# HAVE_DLADDR +
+# HAVE_KQUEUE +
+# HAVE_NANOSLEEP +
+# HAVE_PTHREAD_SET_NAME_NP +
+# HAVE_SETPROCTITLE +
+# HAVE_SRANDOMDEV +
+# HAVE_TCP_KEEP +
+# HAVE_TIMEGM +
+# PACKAGE_TARNAME +
+# PACKAGE_VERSION +
+# SO_RCVTIMEO_WORKS +
+# SO_SNDTIMEO_WORKS +
+# VCC_CC +
+# HAVE_EPOLL_CTL -
+# HAVE_LIBUMEM -
+# USE_PCRE_JIT -
+# _FILE_OFFSET_BITS -
+#
+# #echo 'CF_CFLAGS="-Wall"'
+
diff --git a/doc/Makefile.phk b/doc/Makefile.phk
new file mode 100644
index 0000000..fe6059e
--- /dev/null
+++ b/doc/Makefile.phk
@@ -0,0 +1,7 @@
+
+ifdef HAVE_RST2HTML
+SUBDIRS += sphinx
+endif
+
+TOPDIR = ..
+include $(TOPDIR)/Makefile.inc.phk
diff --git a/doc/sphinx/Makefile.phk b/doc/sphinx/Makefile.phk
new file mode 100644
index 0000000..b14e6cb
--- /dev/null
+++ b/doc/sphinx/Makefile.phk
@@ -0,0 +1,190 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = =build
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(CURDIR)
+
+.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
+
+all: conf.py html
+
+conf.py: conf.py.in
+ cp conf.py.in conf.py
+
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+
+.PHONY: depend install test
+depend install test:
+ @true
+
+clean:
+ -rm -rf $(BUILDDIR)/* conf.py
+
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Varnish.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Varnish.qhc"
+
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+ "run these through (pdf)latex."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
+
+EXTRA_DIST = \
+ conf.py \
+ index.rst \
+ glossary/index.rst \
+ installation/bugs.rst \
+ installation/help.rst \
+ installation/index.rst \
+ installation/install.rst \
+ installation/prerequisites.rst \
+ installation/platformnotes.rst \
+ phk/autocrap.rst \
+ phk/backends.rst \
+ phk/barriers.rst \
+ phk/gzip.rst \
+ phk/index.rst \
+ phk/ipv6suckage.rst \
+ phk/platforms.rst \
+ phk/sphinx.rst \
+ phk/ssl.rst \
+ phk/thoughts.rst \
+ phk/three-zero.rst \
+ phk/vcl_expr.rst \
+ phk/wanton_destruction.rst \
+ reference/index.rst \
+ reference/params.rst \
+ reference/varnishadm.rst \
+ reference/varnish-cli.rst \
+ reference/varnishd.rst \
+ reference/varnishhist.rst \
+ reference/varnishlog.rst \
+ reference/varnishncsa.rst \
+ reference/varnishreplay.rst \
+ reference/varnishsizes.rst \
+ reference/varnishstat.rst \
+ reference/varnishtest.rst \
+ reference/varnishtop.rst \
+ reference/vcl.rst \
+ reference/vmod.rst \
+ reference/vmod_std.rst \
+ reference/vsm.rst \
+ reference/vsl-query.rst \
+ reference/vsl.rst \
+ tutorial/index.rst \
+ tutorial/introduction.rst \
+ tutorial/starting_varnish.rst \
+ tutorial/putting_varnish_on_port_80.rst \
+ tutorial/backend_servers.rst \
+ tutorial/now_what.rst \
+ users-guide/command-line.rst \
+ users-guide/compression.rst \
+ users-guide/cookies.rst \
+ users-guide/devicedetection.rst \
+ users-guide/esi.rst \
+ users-guide/increasing-your-hitrate.rst \
+ users-guide/index.rst \
+ users-guide/intro.rst \
+ users-guide/operation-cli.rst \
+ users-guide/operation-logging.rst \
+ users-guide/operation.rst \
+ users-guide/operation-statistics.rst \
+ users-guide/params.rst \
+ users-guide/performance.rst \
+ users-guide/purging.rst \
+ users-guide/report.rst \
+ users-guide/running.rst \
+ users-guide/sizing-your-cache.rst \
+ users-guide/storage-backends.rst \
+ users-guide/troubleshooting.rst \
+ users-guide/vary.rst \
+ users-guide/vcl-actions.rst \
+ users-guide/vcl-backends.rst \
+ users-guide/vcl-examples.rst \
+ users-guide/vcl-hashing.rst \
+ users-guide/vcl-inline-c.rst \
+ users-guide/vcl.rst \
+ users-guide/vcl-saint-and-grace.rst \
+ users-guide/vcl-syntax.rst \
+ users-guide/vcl-variables.rst \
+ users-guide/websockets.rst
+
+
+dist-hook:
+ $(MAKE) html
+ cp -r $(BUILDDIR) $(distdir)
+
+distclean-local:
+ rm -rf $(BUILDDIR)
+
+# XXX: doesn't work...
+#reference/params.rst: $(top_builddir)/bin/varnishd/varnishd
+# $(top_builddir)/bin/varnishd/varnishd -x dumprstparam > reference/params.rst
diff --git a/lib/Makefile.phk b/lib/Makefile.phk
new file mode 100644
index 0000000..6eba2c8
--- /dev/null
+++ b/lib/Makefile.phk
@@ -0,0 +1,6 @@
+SUBDIRS = libvcc libvarnish libvarnishapi libvarnishtools libvcc
+SUBDIRS += libvgz
+SUBDIRS += libvmod_debug libvmod_directors libvmod_std
+
+TOPDIR = $(CURDIR)/..
+include $(TOPDIR)/Makefile.inc.phk
diff --git a/lib/libvarnish/Makefile.phk b/lib/libvarnish/Makefile.phk
new file mode 100644
index 0000000..53f4cfe
--- /dev/null
+++ b/lib/libvarnish/Makefile.phk
@@ -0,0 +1,29 @@
+
+LIB_SRC += binary_heap.c
+LIB_SRC += cli_auth.c
+LIB_SRC += cli_common.c
+LIB_SRC += cli_serve.c
+LIB_SRC += flopen.c
+LIB_SRC += vas.c
+LIB_SRC += vav.c
+LIB_SRC += vct.c
+LIB_SRC += version.c
+LIB_SRC += vev.c
+LIB_SRC += vfil.c
+LIB_SRC += vin.c
+LIB_SRC += vlu.c
+LIB_SRC += vmb.c
+LIB_SRC += vnum.c
+LIB_SRC += vpf.c
+LIB_SRC += vre.c
+LIB_SRC += vsa.c
+LIB_SRC += vsb.c
+LIB_SRC += vsha256.c
+LIB_SRC += vss.c
+LIB_SRC += vsub.c
+LIB_SRC += vtcp.c
+LIB_SRC += vtim.c
+
+TOPDIR= $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
+
diff --git a/lib/libvarnishapi/Makefile.phk b/lib/libvarnishapi/Makefile.phk
new file mode 100644
index 0000000..8e86df4
--- /dev/null
+++ b/lib/libvarnishapi/Makefile.phk
@@ -0,0 +1,37 @@
+
+LIB_SRC += vsc.c
+LIB_SRC += vsl.c
+LIB_SRC += vsl2rst.c
+LIB_SRC += vsl_arg.c
+LIB_SRC += vsl_cursor.c
+LIB_SRC += vsl_dispatch.c
+LIB_SRC += vsl_query.c
+LIB_SRC += vsm.c
+LIB_SRC += vxp.c
+LIB_SRC += vxp_fixed_token.c
+LIB_SRC += vxp_lexer.c
+LIB_SRC += vxp_parse.c
+
+
+# We add more stuff to the SHLIB version to make it self-contained
+SHLIB_SRC = $(LIB_SRC)
+VPATH += ../libvarnish
+SHLIB_SRC += vre.c
+SHLIB_SRC += vsb.c
+SHLIB_SRC += vas.c
+SHLIB_SRC += vav.c
+SHLIB_SRC += vin.c
+SHLIB_SRC += vtim.c
+
+#LIB_SRC += vsl_glob_test.c
+#LIB_SRC += vxp_test.c
+
+MADE_FILES += vxp_fixed_token.c vxp_tokens.h
+
+TOPDIR= $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
+
+$(MADE_FILES): generate.py
+ python generate.py
+
+
diff --git a/lib/libvarnishtools/Makefile.phk b/lib/libvarnishtools/Makefile.phk
new file mode 100644
index 0000000..366a04d
--- /dev/null
+++ b/lib/libvarnishtools/Makefile.phk
@@ -0,0 +1,7 @@
+
+LIB_SRC += opt2rst.c
+LIB_SRC += vut.c
+
+TOPDIR= $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
+
diff --git a/lib/libvcc/Makefile.phk b/lib/libvcc/Makefile.phk
new file mode 100644
index 0000000..131f850
--- /dev/null
+++ b/lib/libvcc/Makefile.phk
@@ -0,0 +1,26 @@
+
+LIB_SRC += vcc_acl.c
+LIB_SRC += vcc_action.c
+LIB_SRC += vcc_backend.c
+LIB_SRC += vcc_backend_util.c
+LIB_SRC += vcc_compile.c
+LIB_SRC += vcc_expr.c
+LIB_SRC += vcc_parse.c
+LIB_SRC += vcc_storage.c
+LIB_SRC += vcc_symb.c
+LIB_SRC += vcc_token.c
+LIB_SRC += vcc_utils.c
+LIB_SRC += vcc_var.c
+LIB_SRC += vcc_vmod.c
+LIB_SRC += vcc_xref.c
+
+MADE_FILES += vcc_fixed_token.c vcc_obj.c vcc_token_defs.h
+
+CLEAN_FILES += $(MADE_FILES)
+
+TOPDIR= $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
+
+$(MADE_FILES): generate.py
+ $(PYTHON) generate.py
+
diff --git a/lib/libvgz/Makefile.phk b/lib/libvgz/Makefile.phk
new file mode 100644
index 0000000..b938312
--- /dev/null
+++ b/lib/libvgz/Makefile.phk
@@ -0,0 +1,17 @@
+LIB_SRC += adler32.c
+LIB_SRC += compress.c
+LIB_SRC += crc32.c
+LIB_SRC += deflate.c
+LIB_SRC += infback.c
+LIB_SRC += inffast.c
+LIB_SRC += inflate.c
+LIB_SRC += inftrees.c
+LIB_SRC += trees.c
+LIB_SRC += uncompr.c
+LIB_SRC += zutil.c
+
+CFLAGS += -DZLIB_CONST -D_LARGEFILE64_SOURCE=1
+
+TOPDIR= $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
+
diff --git a/lib/libvmod_debug/Makefile.phk b/lib/libvmod_debug/Makefile.phk
new file mode 100644
index 0000000..98e52e7
--- /dev/null
+++ b/lib/libvmod_debug/Makefile.phk
@@ -0,0 +1,7 @@
+
+VMOD_SRC += vmod_debug.c
+VMOD_SRC += vmod_debug_obj.c
+
+TOPDIR= $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
+
diff --git a/lib/libvmod_directors/Makefile.phk b/lib/libvmod_directors/Makefile.phk
new file mode 100644
index 0000000..424a275
--- /dev/null
+++ b/lib/libvmod_directors/Makefile.phk
@@ -0,0 +1,10 @@
+
+VMOD_SRC += fall_back.c
+VMOD_SRC += hash.c
+VMOD_SRC += random.c
+VMOD_SRC += round_robin.c
+VMOD_SRC += vdir.c
+
+TOPDIR= $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
+
diff --git a/lib/libvmod_std/Makefile.phk b/lib/libvmod_std/Makefile.phk
new file mode 100644
index 0000000..ca093a0
--- /dev/null
+++ b/lib/libvmod_std/Makefile.phk
@@ -0,0 +1,8 @@
+
+VMOD_SRC += vmod_std.c
+VMOD_SRC += vmod_std_conversions.c
+VMOD_SRC += vmod_std_fileread.c
+
+TOPDIR= $(CURDIR)/../..
+include $(TOPDIR)/Makefile.inc.phk
+
More information about the varnish-commit
mailing list