Makefile.in   [plain text]


# Top-level Makefile(.in) for distcc

# Copyright (C) 2002, 2003, 2004 by Martin Pool

# Note that distcc no longer uses automake, but this file is still
# structured in a somewhat similar way.

# Remember that a CVS checkout of this project contains some
# directories that will not be present in a tarball distribution,
# including web/.  So, those directories must not be built by regular
# commands (make all, make clean, make distclean), only by
# maintainer-* or explicit invocations.

## VARIABLES

PACKAGE = @PACKAGE_NAME@
VERSION = @PACKAGE_VERSION@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
SHELL = @SHELL@

# These autoconf variables may contain recursive Make expansions, and
# so they have to be done here rather than written into config.h.

CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
CC = @CC@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@ ${DIR_DEFS} -Isrc -I$(srcdir)/lzo

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@

bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
docdir = @docdir@
pkgdatadir = $(datadir)/@PACKAGE_NAME@

# These must be done from here, not from autoconf, because they can 
# contain variable expansions written in Make syntax.  Ew.
DIR_DEFS = -DSYSCONFDIR="\"${sysconfdir}\"" -DPKGDATADIR="\"${pkgdatadir}\""

# arguments to pkgconfig
GNOME_PACKAGES = @GNOME_PACKAGES@
GNOME_CFLAGS = @GNOME_CFLAGS@
GNOME_LIBS = @GNOME_LIBS@

LIBS = @LIBS@ /usr/lib/libcrypto.dylib

DESTDIR =

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ 
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@

# You might need to override this depending on the name under which
# Python is installed here.
PYTHON = @PYTHON@

dist_files =							\
	src/config.h.in						\
	$(dist_lzo)						\
	$(dist_contrib)						\
	$(dist_patches)						\
	$(dist_common)						\
	$(MEN)							\
	$(pkgdoc_DOCS)						\
	$(example_DOCS)						\
	$(popt_EXTRA) $(popt_SRC) $(popt_HEADERS)		\
	$(SRC) $(HEADERS)					\
	$(test_SOURCE)						\
	$(bench_PY)						\
	$(dist_extra)						\
	$(gnome_data)

dist_lzo = lzo/minilzo.c lzo/minilzo.h lzo/lzoconf.h lzo/.stamp-conf.in

dist_contrib = contrib/distcc-absolutify	\
	contrib/distcc.sh			\
	contrib/distccd-init			\
	contrib/dmake				\
	contrib/make-j				\
	contrib/netpwd				\
	contrib/stage-cc-wrapper.patch		\
	contrib/redhat/init			\
	contrib/redhat/logrotate		\
	contrib/redhat/sysconfig		\
	contrib/redhat/xinetd

bench_PY = bench/Build.py bench/Project.py bench/ProjectDefs.py \
	bench/Summary.py bench/actions.py bench/benchmark.py	\
	bench/buildutil.py bench/compiler.py bench/statistics.py

pkgdoc_DOCS = AUTHORS COPYING NEWS README			\
	INSTALL						        \
	TODO							\
	doc/protocol-1.txt doc/status-1.txt			\
	doc/protocol-2.txt					\
	doc/reporting-bugs.txt					\
	survey.txt

example_DOCS = \
	doc/example/init doc/example/init-suse			\
	doc/example/logrotate					\
	doc/example/xinetd					\

# These are included in the distribution but not installed into the
# doc dir.
dist_extra =							\
	README.packaging ChangeLog ChangeLog.old

latte_HTML = web/binaries.html					\
	web/compared.html web/doc.html web/download.html	\
	web/cvs.html web/faq.html web/index.html		\
	web/links.html web/news.html				\
	web/problems.html					\
	web/results.html					\
	web/scenarios.html web/security.html			\
	web/old-news.html

mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
man1dir = $(mandir)/man1
man8dir = $(mandir)/man8

test_SOURCE = test/comfychair.py				\
	test/testdistcc.py			

dist_common = Makefile.in install-sh configure configure.ac \
	config.guess config.sub mkinstalldirs autogen.sh

# It seems a bit unnecessary to ship patches in the released tarballs.
# People who are so keen as to apply unsupported patches ought to use
# CVS, or at least get them from the list.
dist_patches = 

TAR = tar
GZIP = gzip
GZIP_OPT = -9v

BZIP2 = bzip2

distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)

distdir = $(PACKAGE_TARNAME)-$(VERSION)
tarball = $(PACKAGE_TARNAME)-$(VERSION).tar
tarball_bz2 = $(tarball).bz2
tarball_sig = $(tarball_bz2).asc
distnews = $(PACKAGE_TARNAME)-$(VERSION).NEWS

common_obj = src/arg.o src/argutil.o					\
	src/cleanup.o src/compress.o					\
	src/trace.o src/util.o src/io.o src/exec.o			\
	src/rpc.o src/tempfile.o src/bulk.o src/help.o src/filename.o	\
	src/lock.o							\
	src/netutil.o							\
	src/pump.o							\
	src/sendfile.o							\
	src/safeguard.o src/snprintf.o src/timeval.o			\
	src/ncpus.o							\
	lzo/minilzo.o \
    src/versinfo.o src/cpp_dialect.o src/indirect_client.o src/indirect_server.o

distcc_obj = src/backoff.o						\
	src/climasq.o src/clinet.o src/clirpc.o				\
	src/compile.o src/cpp.o						\
	src/distcc.o							\
	src/hosts.o src/hostfile.o					\
	src/implicit.o src/loadfile.o					\
	src/remote.o							\
	src/ssh.o src/state.o src/strip.o				\
	src/timefile.o src/traceenv.o					\
	src/where.o							\
	$(common_obj)

distccd_obj = src/access.o						\
	src/daemon.o  src/dopt.o src/dparent.o src/dsignal.o		\
	src/prefork.o							\
	src/serve.o src/setuid.o src/srvnet.o src/srvrpc.o src/state.o	\
	$(common_obj) @BUILD_POPT@

# Objects that need to be linked in to build monitors
mon_obj =								\
	src/cleanup.o							\
	src/filename.o							\
	src/io.o							\
	src/mon.o							\
	src/netutil.o							\
	src/rpc.o							\
	src/snprintf.o src/state.o 					\
	src/tempfile.o src/trace.o src/traceenv.o			\
	src/util.o \
    src/cpp_dialect.o


gnome_obj = src/history.o src/mon-gnome.o				\
	src/renderer.o

h_exten_obj = src/h_exten.o $(common_obj)
h_issource_obj = src/h_issource.o $(common_obj) 
h_scanargs_obj = src/h_scanargs.o $(common_obj) src/implicit.o
h_hosts_obj = src/h_hosts.o $(common_obj) src/hostfile.o src/hosts.o	\
	src/loadfile.o
h_argvtostr_obj = src/h_argvtostr.o $(common_obj)
h_strip_obj = src/h_strip.o $(common_obj) src/strip.o
h_parsemask_obj = src/h_parsemask.o $(common_obj) src/access.o
h_sa2str_obj = src/h_sa2str.o $(common_obj) src/srvnet.o src/access.o
h_ccvers_obj = src/h_ccvers.o $(common_obj) 

# All source files, for the purposes of building the distribution
SRC =	src/access.c src/arg.c src/argutil.c				\
	src/backoff.c src/bulk.c					\
	src/cleanup.c							\
	src/climasq.c src/clinet.c src/clirpc.c src/compile.c		\
	src/compress.c src/cpp.c					\
	src/daemon.c src/distcc.c src/dsignal.c				\
	src/dopt.c src/dparent.c src/exec.c src/filename.c		\
	src/h_argvtostr.c						\
	src/h_exten.c src/h_hosts.c src/h_issource.c src/h_parsemask.c	\
	src/h_sa2str.c src/h_scanargs.c src/h_strip.c			\
	src/help.c src/history.c src/hosts.c src/hostfile.c		\
	src/implicit.c src/io.c						\
	src/loadfile.c src/lock.c 					\
	src/mon.c src/mon-notify.c src/mon-text.c			\
	src/mon-gnome.c							\
	src/ncpus.c src/netutil.c					\
	src/prefork.c src/pump.c					\
	src/remote.c src/renderer.c src/rpc.c				\
	src/safeguard.c src/sendfile.c src/setuid.c src/serve.c		\
	src/snprintf.c src/state.c					\
	src/srvnet.c src/srvrpc.c src/ssh.c src/strip.c			\
	src/tempfile.c src/timefile.c                     		\
	src/timeval.c src/traceenv.c					\
	src/trace.c src/util.c src/where.c				


HEADERS = src/access.h							\
	src/bulk.h							\
	src/clinet.h src/compile.h					\
	src/daemon.h							\
	src/distcc.h src/dopt.h src/exitcode.h				\
	src/hosts.h src/implicit.h					\
	src/mon.h							\
	src/netutil.h							\
	src/renderer.h src/rpc.h					\
	src/snprintf.h src/state.h		 			\
	src/timefile.h src/timeval.h src/trace.h			\
	src/types.h							\
	src/util.h							\
	src/exec.h src/lock.h src/where.h src/srvnet.h

man1_MEN = man/distcc.1 man/distccd.1 man/distccmon-text.1 
man_HTML = man/distcc_1.html man/distccd_1.html man/distccmon_text_1.html
MEN = $(man1_MEN) 

gnome_data = gnome/distccmon-gnome-icon.png	\
	gnome/distccmon-gnome.desktop

popt_OBJS=popt/findme.o  popt/popt.o  popt/poptconfig.o \
	popt/popthelp.o popt/poptparse.o

popt_SRC=popt/findme.c  popt/popt.c  popt/poptconfig.c			 \
	popt/popthelp.c popt/poptparse.c

popt_HEADERS = popt/findme.h popt/popt.h popt/poptint.h popt/system.h

popt_EXTRA = popt/README.popt popt/.stamp-conf.in


# You might think that distccd ought to be in sbin, because it's a
# daemon.  It is a grey area.  However, the Linux Filesystem Hierarchy
# Standard (FHS 2.2) says that sbin is for programs "used exclusively
# by the system administrator".  

# distccd will often be used by non-root users, and when we support
# ssh it will be somewhat important that it be found in their default
# path.  Therefore on balance it seems better to put it in bin/.  

# Package maintainers can override this if absolutely necessary, but I
# would prefer that they do not. -- mbp

bin_PROGRAMS = \
	distcc@EXEEXT@ \
	distccd@EXEEXT@ \
	distccmon-text@EXEEXT@ \
	@GNOME_BIN@ 

check_PROGRAMS = \
	h_argvtostr@EXEEXT@ \
	h_exten@EXEEXT@ \
	h_hosts@EXEEXT@ \
	h_issource@EXEEXT@ \
	h_parsemask@EXEEXT@ \
	h_sa2str@EXEEXT@ \
	h_scanargs@EXEEXT@ \
	h_strip@EXEEXT@

## OVERALL targets

## IMPLICIT BUILD rules

.SUFFIXES: .html .latte .o .c

.latte.html:
	-rm -f $@
	if ! latte-html -l web/style.latte -o $@ $<; then rm $@; exit 1 ; fi

.c.o: 
	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< 

## OVERALL targets

## NOTE: "all" must be the first (default) rule, aside from patterns.

# We don't build the web pages by default, because many people will
# not have the tools to do it.  Just use all-web if you want it.
all: $(bin_PROGRAMS)

all-web: all-latte
all-latte: $(latte_HTML)


## BUILD targets

distcc@EXEEXT@: $(distcc_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(distcc_obj) $(LIBS)

distccd@EXEEXT@: $(distccd_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(distccd_obj) $(LIBS)	

distccmon-text@EXEEXT@: $(mon_obj) src/mon-text.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(mon_obj) src/mon-text.o $(LIBS)

h_exten@EXEEXT@: $(h_exten_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_exten_obj) $(LIBS)

h_issource@EXEEXT@: $(h_issource_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_issource_obj) $(LIBS)

h_sa2str@EXEEXT@: $(h_sa2str_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_sa2str_obj) $(LIBS)

h_scanargs@EXEEXT@: $(h_scanargs_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_scanargs_obj) $(LIBS)

h_hosts@EXEEXT@: $(h_hosts_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_hosts_obj) $(LIBS)

h_argvtostr@EXEEXT@: $(h_argvtostr_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_argvtostr_obj) $(LIBS)

h_parsemask@EXEEXT@: $(h_parsemask_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_parsemask_obj) $(LIBS)

h_strip@EXEEXT@: $(h_strip_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_strip_obj) $(LIBS)

h_ccvers@EXEEXT@: $(h_ccvers_obj)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(h_ccvers_obj) $(LIBS)

src/mon-gnome.o: src/mon-gnome.c
	$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) \
		$(GNOME_CFLAGS) \
		$(srcdir)/src/mon-gnome.c

src/renderer.o: src/renderer.c
	$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS)			\
		$(GNOME_CFLAGS) \
		$(srcdir)/src/renderer.c

distccmon-gnome@EXEEXT@: $(mon_obj) $(gnome_obj)
	$(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LIBS)	\
		$(GNOME_CFLAGS) $(GNOME_LIBS)			\
		$(mon_obj) $(gnome_obj)


## Dist targets

# The sub-targets copy (and if necessary, build) various files that
# have to go into the tarball.  They also create necessary directories
# -- bear in mind that they might be run in parallel.

# This looks a bit gross to me, but it's not as bad as it might be :-/

dist: 
	-rm -fr $(distdir)
	$(MAKE) dist-files 
	$(TAR) cfh $(tarball) $(distdir)
	$(BZIP2) -vf $(tarball)
	rm -r $(distdir)
	cp NEWS $(distnews)

distcheck: dist
	rm -rf '+distcheck'
	mkdir '+distcheck'
	cd '+distcheck' && bunzip2 < ../$(tarball_bz2) | $(TAR) xv && \
	cd $(distdir) && ./configure --prefix=`pwd`/prefix && \
	$(MAKE) && $(MAKE) install && $(MAKE) maintainer-check && \
	$(MAKE) clean
	rm -rf '+distcheck'

dist-sign:
	gpg -a --detach-sign $(tarball_bz2)

# the sort function removes duplicates
dist-files: $(dist_files)
	for f in $(dist_files); do mkdir -p $(distdir)/`dirname $$f` || exit 1; \
	cp -a $(srcdir)/$$f $(distdir)/$$f || exit 1; done

## BUILD (web) targets
$(latte_HTML): web/style.latte

## BUILD manual targets
man/distcc_1.html: man/distcc.1
	troff2html -man man/distcc.1 > $@

man/distccd_1.html: man/distccd.1
	troff2html -man man/distccd.1 > $@

man/distccmon_text_1.html: man/distccmon-text.1
	troff2html -man man/distccmon-text.1 > $@


######################################################################
## CHECK targets

check_programs: $(check_PROGRAMS) $(bin_PROGRAMS)

# WARNING: This resets the path to avoid any confusion caused by
# having distcc masquerades already on the path.  If you have gcc
# installed elsewhere this won't work....
maintainer-check: check_programs
	if test x$(PYTHON) != x; then \
	$(PYTHON) -c 'import sys; print sys.version'; \
	PATH=`pwd`:/usr/local/bin:/bin:/usr/bin $(PYTHON) $(srcdir)/test/testdistcc.py; \
	else echo "WARNING: python not found; tests skipped"; \
	fi

# NB: This does not depend upon install; you might want to test another version.
maintainer-installcheck: check_programs
	if test x$(PYTHON) != x; then \
	$(PYTHON) -c 'import sys; print sys.version'; \
	PATH="$(bindir):`pwd`:$$PATH" $(PYTHON) $(srcdir)/test/testdistcc.py; \
	else echo "WARNING: python not found; tests skipped"; \
	fi

check:
	@echo Please try 'make maintainer-check' instead.
installcheck:
	@echo Please try 'make maintainer-check' instead.


######################################################################
## BENCHMARK targets
benchmark: 
	@echo "The distcc macro-benchmark uses your existing distcc installation"
	@if [ "$$DISTCC_HOSTS" ]; \
	then echo "DISTCC_HOSTS=\"$$DISTCC_HOSTS\""; \
	else echo "You must set up servers and set DISTCC_HOSTS before running the benchmark"; \
	exit 1; \
	fi
	@echo "This benchmark may download a lot of source files, and it takes a "
	@echo "long time to run.  Interrupt now if you want."
	@echo 
	@echo "Pass BENCH_ARGS to make to specify which benchmarks to run."
	@echo
	@sleep 5
	cd bench && $(PYTHON) benchmark.py $(BENCH_ARGS)


## CLEAN targets

# Also clean binaries which are optionally built
clean: clean-autoconf clean-lzo
	rm -f src/*.o popt/*.o 
	rm -f $(check_PROGRAMS) $(bin_PROGRAMS)
	rm -f distccmon-gnome
	rm -rf testtmp

clean-autoconf:
	rm -f config.cache config.log

clean-lzo:
	rm -f lzo/*.o lzo/testmini

maintainer-clean: distclean maintainer-clean-web  \
	maintainer-clean-autoconf clean

# configure and co are distributed, but not in CVS
maintainer-clean-autoconf:
	rm -f configure src/config.h.in

maintainer-clean-web: 
	rm -f $(latte_HTML)

distclean-autoconf:
	rm -f Makefile src/config.h config.status config.cache config.log
	rm -rf autom4te.cache

distclean: distclean-autoconf clean


## MAINTAINER targets

upload-web: all-web
	rsync -avz web/ survey.txt \
		--exclude CVS --exclude '*~' --exclude '*.latte' \
		samba.org:/home/httpd/distcc/

upload-man: $(man_HTML)
	rsync -avz $(man_HTML) \
		--exclude CVS --exclude '*~' --exclude '*.latte' \
		samba.org:/home/httpd/distcc/man/

upload-dist:
	rsync -avP $(tarball_bz2) $(distnews) $(tarball_sig) samba.org:/home/ftp/pub/distcc/



### CVSPLOT

cvsplot:
	cvsplot -cvsdir . \
		-include '\.(c|h|py)$$' \
		-linedata /tmp/linedata.txt \
		-gnuplotlinedata web/cvslinedata.png \
		-filedata /tmp/filedata.txt \
		-gnuplotfiledata web/cvsfiledata.png



### INSTALL targets

# TODO: Allow root directory to be overridden for use in building
# packages.



showpaths:
	@echo "'make install' will install distcc as follows:"
	@echo "  man pages            $(DESTDIR)$(man1dir)"
	@echo "  documents            $(DESTDIR)$(docdir)"
	@echo "  programs             $(DESTDIR)$(bindir)"
	@echo "  system configuration $(DESTDIR)$(sysconfdir)"
	@echo "  shared data files    $(DESTDIR)$(pkgdatadir)"


# install-sh can't handle multiple arguments, but we don't need any
# tricky features so mkinstalldirs and cp will do

install: showpaths install-doc install-man install-programs install-example @INSTALL_GNOME@

install-programs: $(bin_PROGRAMS)
	$(mkinstalldirs) $(DESTDIR)$(bindir)
	for p in $^; do				\
	$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir) || exit 1;	\
	done

install-man: $(man1_MEN)
	$(mkinstalldirs) $(DESTDIR)$(man1dir)
	for p in $^; do				\
	$(INSTALL_DATA)	$$p $(DESTDIR)$(man1dir) || exit 1;	\
	done

install-doc: $(pkgdoc_DOCS)
	$(mkinstalldirs) $(DESTDIR)$(docdir)
	for p in $^; do				\
	$(INSTALL_DATA) $$p $(DESTDIR)$(docdir) || exit 1;	\
	done

install-example: $(example_DOCS)
	$(mkinstalldirs) $(DESTDIR)$(docdir)/example
	for p in $^; do				\
	$(INSTALL_DATA) $$p $(DESTDIR)$(docdir)/example || exit 1;	\
	done

install-gnome-data: $(gnome_data)
	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
	for p in $^; do				\
	$(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir) || exit 1;	\
	done

## LINBOT targets

# This target checks the website for broken links.  It's probably not
# very interesting unless you are a maintainer and therefore in a
# position to fix them.

linbot-run:
	mkdir -p linbot-report
	linbot -o linbot-report http://distcc.samba.org/

## ANALOG targets

# These are probably only interesting for maintainers
analog-all:
	$(MAKE) analog-download
	$(MAKE) analog-resolve
	$(MAKE) analog-run

analog-download:
	rsync -avz 'samba.org:/var/log/httpd/distcc/*_log*' analog/

analog-run:
	mkdir -p analog/report && cd analog && analog -G +gdistcc.analog

analog-resolve:
	cat analog/access_log_* analog/access_log | \
		jdresolve --recursive --database analog/jdresolve.db - \
		--progress --timeout 15 --sockets 512 --linecache 100000 \
		> analog/resolved_log