1# Process this file with automake to produce Makefile.in (in this,
2# and all subdirectories).
3# Makefile for the top-level directory of GNU hello.
4#
5# Copyright 1997, 1998, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013,
6# 2014 Free Software Foundation, Inc.
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 3, or (at your option)
11# any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
21# Find gnulib headers.
22ACLOCAL_AMFLAGS = -I m4
23
24AM_CPPFLAGS = -Ilib -I$(top_srcdir)/lib -Isrc -I$(top_srcdir)/src
25
26# Additional files to distribute.
27EXTRA_DIST = \
28	README-dev \
29	ChangeLog.O \
30	m4/gnulib-cache.m4 \
31	man/hello.x \
32	contrib/de_franconian_po.txt \
33	contrib/evolution.txt
34
35# Subdirectories to descend into.
36SUBDIRS = po
37
38bin_PROGRAMS = hello
39hello_SOURCES = src/hello.c src/system.h
40
41hello_LDADD = $(LIBINTL) $(top_builddir)/lib/lib$(PACKAGE).a
42
43localedir = $(datadir)/locale
44DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
45
46CLEANFILES =
47
48if !GIT_CROSS_COMPILING
49man_MANS = hello.1
50EXTRA_DIST += $(man_MANS)
51endif
52
53if BUILD_FROM_GIT
54hello.1: hello
55	$(HELP2MAN) --include=$(top_srcdir)/man/hello.x $(top_builddir)/hello -o $@-t
56	chmod a=r $@-t
57	mv -f $@-t $@
58
59CLEANFILES += $(man_MANS)
60endif
61
62TESTS = \
63	tests/greeting-1 \
64	tests/greeting-2 \
65	tests/hello-1 \
66	tests/last-1 \
67	tests/traditional-1
68
69EXTRA_DIST += $(TESTS)
70
71noinst_LIBRARIES =
72MOSTLYCLEANFILES =
73MOSTLYCLEANDIRS =
74BUILT_SOURCES =
75
76LOG_COMPILER = $(SHELL)
77
78TESTS_ENVIRONMENT = \
79  top_srcdir=$(top_srcdir) \
80  PATH=.$(PATH_SEPARATOR)$(PATH_SEPARATOR)$$PATH \
81  HELLO=`echo hello | sed '$(transform)'`; \
82  export HELLO PATH top_srcdir;
83
84# Verify that all source files using _() are listed in po/POTFILES.in.
85# The idea is to run this before making pretests, as well as official
86# releases, so that translators will be sure to have all the messages.
87# (From coreutils.)
88po-check:
89	if test -f po/POTFILES.in; then					\
90	  grep -E -v '^(#|$$)' po/POTFILES.in				\
91	    | grep -v '^src/false\.c$$' | sort > $@-1;			\
92	  files=;							\
93	  for file in $$($(CVS_LIST_EXCEPT)) `find * -name '*.[ch]'`; do \
94	    case $$file in						\
95	    gnulib/* | man/*) continue;;				\
96	    esac;							\
97	    case $$file in						\
98	    *.[ch])							\
99	      base=`expr " $$file" : ' \(.*\)\..'`;			\
100	      { test -f $$base.l || test -f $$base.y; } && continue;;	\
101	    esac;							\
102	    files="$$files $$file";					\
103	  done;								\
104	  grep -E -l '\b(N?_|gettext *)\([^)"]*("|$$)' $$files		\
105	    | sort -u > $@-2;						\
106	  diff -u $@-1 $@-2 || exit 1;					\
107	  rm -f $@-1 $@-2;						\
108	fi
109
110
111# Example of updating the online web pages for the documentation
112# with the gendocs.sh script; see
113# http://www.gnu.org/prep/maintain/html_node/Invoking-gendocs_002esh.html
114#
115gendocs = build-aux/gendocs.sh
116gendocs_envvars = GENDOCS_TEMPLATE_DIR=doc
117#
118manual = hello
119manual_title=Hello, GNU World
120email = $(PACKAGE_BUGREPORT)
121gendocs_args = --email $(email) $(manual) $(manual_title)
122#
123www_target = $(HOME)/gnu/www/hello/manual
124#
125doctemp = doc/wwwtemp
126wwwdoc:
127	rm -rf $(doctemp) && mkdir $(doctemp)
128	cd $(doctemp) \
129	&& ln -s ../*.texi . \
130	&& env $(gendocs_envvars) $(gendocs) $(gendocs_args)
131	cp -arf $(doctemp)/manual/. $(www_target)
132	ls -ltu $(www_target)/html_node | tail  # $VCS rm -f obsolete files
133# followed by $VCS add of new files and cvs commit.
134
135include $(top_srcdir)/lib/local.mk
136include $(top_srcdir)/doc/local.mk
137
138dist-hook: gen-ChangeLog
139
140gen_start_date = 2011-12-17
141.PHONY: gen-ChangeLog
142gen-ChangeLog:
143	$(AM_V_GEN)if test -d .git; then				\
144	  log_fix="$(srcdir)/build-aux/git-log-fix";			\
145	  test -e "$$log_fix"						\
146	    && amend_git_log="--amend=$$log_fix"			\
147	    || amend_git_log=;						\
148	  $(top_srcdir)/build-aux/gitlog-to-changelog			\
149	    $$amend_git_log --since=$(gen_start_date) > $(distdir)/cl-t && \
150	    { rm -f $(distdir)/ChangeLog &&				\
151	      mv $(distdir)/cl-t $(distdir)/ChangeLog; }		\
152	fi
153