[EMAIL PROTECTED] (Lars Gullik Bjønnes) writes:

| Angus Leeming <[EMAIL PROTECTED]> writes:
>
| | Lars Gullik Bjønnes wrote:
>>>>> Generated files generated in then wrong place?
>>>>
>>> | Exactly. pch.h.gch files are placed in the src tree not the build
>>> | trees. But I understand that there's no obvious fix?
>>> 
>>> Hmm, but if this is so... then a "make distcheck" should fail.
>>
| | Sorry, I don't see your point. Could you be more verbose?
>
| A make distcheck does a srcdir != builddir build where the srcdir is
| made read-only. So anything that tries to create something in the
| srcdir will fail.
>
| (requires a quite new automake)
>
| I am testing 'make distcheck' now. I think I have already found some
| small problems.

It really didn't work at all.... this patch seems to make it work as
it should for me. Also the spurious pch.h.gch files are now gone.

However ... make distcheck is very time consuming
and I will use a lot of time to verify that it is working correctly.
Some help would be great.

I have to test with and without pch and both srcdir != builddir and
srcdir == builddir.
With gcc supporting pch and gcc not supporting pch.

Currently I am testing with srcdir != builddir, gcc 4.0 make distcheck
After that I will do srcdir != builddir, gcc 4.0 make
srcdir == builddir, gcc 4.0 make distcheck
srcdir == builddir, gcc 4.0 make
(not in that order)

So if someone could do the same for gcc 3.3 that would be great.

Comment on the patch would also be nice... I am not really happy with
how it worked out. Especially the use of BUILT_SOURCES.

Index: boost/libs/filesystem/src/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/boost/libs/filesystem/src/Makefile.am,v
retrieving revision 1.6
diff -u -p -B -b -w -r1.6 Makefile.am
--- boost/libs/filesystem/src/Makefile.am	5 Dec 2004 17:10:56 -0000	1.6
+++ boost/libs/filesystem/src/Makefile.am	8 Mar 2005 17:27:40 -0000
@@ -1,5 +1,9 @@
 include $(top_srcdir)/config/common.am
 
+EXTRA_DIST = pch.h
+
+BUILT_SOURCES = $(PCH_FILE)
+
 noinst_LTLIBRARIES = libboost_filesystem.la
 
 AM_CPPFLAGS = \
Index: boost/libs/regex/src/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/boost/libs/regex/src/Makefile.am,v
retrieving revision 1.12
diff -u -p -B -b -w -r1.12 Makefile.am
--- boost/libs/regex/src/Makefile.am	5 Dec 2004 17:10:56 -0000	1.12
+++ boost/libs/regex/src/Makefile.am	8 Mar 2005 17:27:40 -0000
@@ -1,5 +1,9 @@
 include $(top_srcdir)/config/common.am
 
+EXTRA_DIST = pch.h
+
+BUILT_SOURCES = $(PCH_FILE)
+
 noinst_LTLIBRARIES = libboost_regex.la
 
 AM_CPPFLAGS = \
Index: boost/libs/signals/src/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/boost/libs/signals/src/Makefile.am,v
retrieving revision 1.7
diff -u -p -B -b -w -r1.7 Makefile.am
--- boost/libs/signals/src/Makefile.am	5 Dec 2004 17:10:56 -0000	1.7
+++ boost/libs/signals/src/Makefile.am	8 Mar 2005 17:27:40 -0000
@@ -1,5 +1,9 @@
 include $(top_srcdir)/config/common.am
 
+EXTRA_DIST = pch.h
+
+BUILT_SOURCES = $(PCH_FILE)
+
 noinst_LTLIBRARIES = libboost_signals.la
 
 AM_CPPFLAGS = \
Index: config/common.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/common.am,v
retrieving revision 1.14
diff -u -p -B -b -w -r1.14 common.am
--- config/common.am	20 Jan 2005 14:44:19 -0000	1.14
+++ config/common.am	8 Mar 2005 17:27:40 -0000
@@ -12,19 +12,21 @@ AM_ETAGSFLAGS = --lang=c++
 
 if LYX_BUILD_PCH
 PCH_SOURCE = $(srcdir)/pch.h
-PCH_FLAGS = -Winvalid-pch --include=$(PCH_SOURCE)
+PCH_FLAGS = -Winvalid-pch --include=./pch.h
 PCH_FILE = ./pch.h.gch
 sinclude ./pch.h.gch.dep
 
-*.C *.cpp: $(PCH_FILE)
-
 $(PCH_FILE): $(PCH_SOURCE)
 	$(MAKE) PCH_FLAGS= pch-file
 
 pch-file:
-	$(CXXCOMPILE) -x c++-header $(PCH_SOURCE) -MT $(PCH_FILE)  -MD -MP \
+	test "$(srcdir)" != "." && $(LN_S) -f $(srcdir)/pch.h .
+	$(CXXCOMPILE) -x c++-header ./pch.h -MT $(PCH_FILE)  -MD -MP \
         -MF "./$(PCH_FILE).Tdep" \
-	&& mv "./$(PCH_FILE).Tdep" "./$(PCH_FILE).dep" || rm "./$(PCH_FILE).Tdep"
+	&& mv "$(PCH_FILE).Tdep" "$(PCH_FILE).dep" || rm "$(PCH_FILE).Tdep"
+
+clean-local:
+	test "$(srcdir)" != "." && rm -f pch.h
 
 endif
 
Index: src/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/Makefile.am,v
retrieving revision 1.224
diff -u -p -B -b -w -r1.224 Makefile.am
--- src/Makefile.am	31 Jan 2005 10:42:17 -0000	1.224
+++ src/Makefile.am	8 Mar 2005 17:27:40 -0000
@@ -11,7 +11,8 @@ EXTRA_DIST = config.h.in stamp-h.in vers
 	Sectioning.C \
 	Variables.C \
 	Variables.h \
-	paper.h
+	paper.h \
+	pch.h
 
 LYX_PRE_LIBS = mathed/libmathed.la insets/libinsets.la \
 	frontends/libfrontends.la
@@ -47,7 +48,7 @@ lyx$(EXEEXT): $(FRONTENDS_PROGS)
 
 #lyx_LDFLAGS=-Wl,-O1
 
-BUILT_SOURCES = version.C
+BUILT_SOURCES = $(PCH_FILE) version.C
 
 AM_CPPFLAGS = $(PCH_FLAGS) $(BOOST_INCLUDES)
 
Index: src/client/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/client/Makefile.am,v
retrieving revision 1.9
diff -u -p -B -b -w -r1.9 Makefile.am
--- src/client/Makefile.am	25 Feb 2005 09:01:06 -0000	1.9
+++ src/client/Makefile.am	8 Mar 2005 17:27:40 -0000
@@ -2,7 +2,9 @@ include $(top_srcdir)/config/common.am
 
 CLEANFILES += $(man_MANS)
 
-EXTRA_DIST = lyxclient.man
+EXTRA_DIST = pch.h lyxclient.man
+
+BUILT_SOURCES = $(PCH_FILE)
 
 man_MANS = lyxclient.1
 
Index: src/frontends/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/Makefile.am,v
retrieving revision 1.65
diff -u -p -B -b -w -r1.65 Makefile.am
--- src/frontends/Makefile.am	6 Mar 2005 04:29:27 -0000	1.65
+++ src/frontends/Makefile.am	8 Mar 2005 17:27:40 -0000
@@ -4,6 +4,10 @@ SUBDIRS = controllers $(FRONTENDS_SUBDIR
 
 DIST_SUBDIRS = controllers xforms qt2 gtk
 
+EXTRA_DIST = pch.h
+
+BUILT_SOURCES = $(PCH_FILE)
+
 noinst_LTLIBRARIES = libfrontends.la
 
 AM_CPPFLAGS = $(PCH_FLAGS) -I$(srcdir)/..  $(BOOST_INCLUDES)
Index: src/frontends/controllers/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/Makefile.am,v
retrieving revision 1.70
diff -u -p -B -b -w -r1.70 Makefile.am
--- src/frontends/controllers/Makefile.am	4 Dec 2004 14:50:23 -0000	1.70
+++ src/frontends/controllers/Makefile.am	8 Mar 2005 17:27:40 -0000
@@ -1,6 +1,8 @@
 include $(top_srcdir)/config/common.am
 
-EXTRA_DIST = BCView.tmpl
+EXTRA_DIST = pch.h BCView.tmpl
+
+BUILT_SOURCES = $(PCH_FILE)
 
 noinst_LTLIBRARIES = libcontrollers.la
 
Index: src/frontends/gtk/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/Makefile.am,v
retrieving revision 1.38
diff -u -p -B -b -w -r1.38 Makefile.am
--- src/frontends/gtk/Makefile.am	7 Dec 2004 00:29:15 -0000	1.38
+++ src/frontends/gtk/Makefile.am	8 Mar 2005 17:27:40 -0000
@@ -2,6 +2,10 @@ include $(top_srcdir)/config/common.am
 
 SUBDIRS = gimages glade
 
+EXTRA_DIST = pch.h
+
+BUILT_SOURCES = $(PCH_FILE)
+
 noinst_LTLIBRARIES = libgtk.la
 
 AM_CPPFLAGS = \
Index: src/frontends/qt2/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/Makefile.am,v
retrieving revision 1.101
diff -u -p -B -b -w -r1.101 Makefile.am
--- src/frontends/qt2/Makefile.am	14 Dec 2004 10:41:06 -0000	1.101
+++ src/frontends/qt2/Makefile.am	8 Mar 2005 17:27:40 -0000
@@ -3,7 +3,9 @@ include $(srcdir)/Makefile.dialogs
 
 SUBDIRS = ui moc
 
-EXTRA_DIST = Makefile.dialogs
+EXTRA_DIST = pch.h Makefile.dialogs
+
+BUILT_SOURCES = $(PCH_FILE)
 
 noinst_LTLIBRARIES = libqt2.la
 
Index: src/frontends/qt2/moc/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/moc/Makefile.am,v
retrieving revision 1.31
diff -u -p -B -b -w -r1.31 Makefile.am
--- src/frontends/qt2/moc/Makefile.am	5 Jan 2005 15:35:41 -0000	1.31
+++ src/frontends/qt2/moc/Makefile.am	8 Mar 2005 17:27:41 -0000
@@ -3,6 +3,10 @@ include $(srcdir)/../Makefile.dialogs
 
 DISTCLEANFILES += *.C
 
+EXTRA_DIST = pch.h
+
+BUILT_SOURCES = $(PCH_FILE)
+
 AM_CPPFLAGS = -DQT_CLEAN_NAMESPACE -DQT_GENUINE_STR -DQT_NO_TRANSLATION \
 	$(PCH_FLAGS) \
 	-I$(top_srcdir)/src \
Index: src/frontends/qt2/ui/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ui/Makefile.am,v
retrieving revision 1.29
diff -u -p -B -b -w -r1.29 Makefile.am
--- src/frontends/qt2/ui/Makefile.am	15 Jan 2005 19:17:11 -0000	1.29
+++ src/frontends/qt2/ui/Makefile.am	8 Mar 2005 17:27:41 -0000
@@ -5,7 +5,9 @@ CLEANFILES += *.C *Base.h
 
 SUBDIRS = . moc
 
-EXTRA_DIST = QPreambleDialogBase.ui $(UIFILES)
+EXTRA_DIST = pch.h QPreambleDialogBase.ui $(UIFILES)
+
+BUILT_SOURCES = $(PCH_FILE)
 
 AM_CPPFLAGS = \
 	-DQT_CLEAN_NAMESPACE \
Index: src/frontends/qt2/ui/moc/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ui/moc/Makefile.am,v
retrieving revision 1.20
diff -u -p -B -b -w -r1.20 Makefile.am
--- src/frontends/qt2/ui/moc/Makefile.am	5 Jan 2005 15:35:41 -0000	1.20
+++ src/frontends/qt2/ui/moc/Makefile.am	8 Mar 2005 17:27:41 -0000
@@ -3,6 +3,10 @@ include $(srcdir)/../../Makefile.dialogs
 
 DISTCLEANFILES += $(UIFILES:.ui=_moc.C)
 
+EXTRA_DIST = pch.h
+
+BUILT_SOURCES = $(PCH_FILE)
+
 AM_CPPFLAGS = -DQT_CLEAN_NAMESPACE -DQT_GENUINE_STR -DQT_NO_TRANSLATION \
 	$(PCH_FLAGS) \
 	-I$(top_srcdir)/src \
Index: src/frontends/xforms/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/Makefile.am,v
retrieving revision 1.122
diff -u -p -B -b -w -r1.122 Makefile.am
--- src/frontends/xforms/Makefile.am	4 Dec 2004 14:50:24 -0000	1.122
+++ src/frontends/xforms/Makefile.am	8 Mar 2005 17:27:41 -0000
@@ -3,9 +3,10 @@ include $(top_srcdir)/config/common.am
 SUBDIRS = forms
 CLEANFILES += stamp-xpm stamp-forms
 DISTCLEANFILES += lyx_forms.h lyx_forms.h-tmp lyx_xpm.h lyx_xpm.h-tmp
-BUILT_SOURCES = lyx_forms.h lyx_xpm.h
 
-EXTRA_DIST = lyx_forms.h.in lyx_xpm.h.in
+BUILT_SOURCES = $(PCH_FILE) lyx_forms.h lyx_xpm.h
+
+EXTRA_DIST = pch.h lyx_forms.h.in lyx_xpm.h.in
 
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/images \
Index: src/frontends/xforms/forms/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/Makefile.am,v
retrieving revision 1.39
diff -u -p -B -b -w -r1.39 Makefile.am
--- src/frontends/xforms/forms/Makefile.am	5 Jan 2005 15:35:42 -0000	1.39
+++ src/frontends/xforms/forms/Makefile.am	8 Mar 2005 17:27:41 -0000
@@ -2,7 +2,9 @@ include $(top_srcdir)/config/common.am
 
 DISTCLEANFILES += $(SRCS:.fd=.C) $(SRCS:.fd=.h) $(SRCS:.fd=.c)
 
-EXTRA_DIST = fdfixc.sed fdfixh.sed fdfix.sh tmp_str.sed README $(SRCS)
+EXTRA_DIST = pch.h fdfixc.sed fdfixh.sed fdfix.sh tmp_str.sed README $(SRCS)
+
+BUILT_SOURCES = $(PCH_FILE)
 
 # For (forms_fwd.h, forms_gettext.h) and support/std_string.h, respectively.
 AM_CPPFLAGS = $(PCH_FLAGS) -I$(srcdir)/..  -I$(top_srcdir)/src -I..
Index: src/graphics/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/Makefile.am,v
retrieving revision 1.32
diff -u -p -B -b -w -r1.32 Makefile.am
--- src/graphics/Makefile.am	4 Dec 2004 14:50:24 -0000	1.32
+++ src/graphics/Makefile.am	8 Mar 2005 17:27:41 -0000
@@ -1,5 +1,9 @@
 include $(top_srcdir)/config/common.am
 
+EXTRA_DIST = pch.h
+
+BUILT_SOURCES = $(PCH_FILE)
+
 noinst_LTLIBRARIES = libgraphics.la
 
 AM_CPPFLAGS = $(PCH_FLAGS) -I$(srcdir)/.. $(BOOST_INCLUDES)
Index: src/insets/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/Makefile.am,v
retrieving revision 1.82
diff -u -p -B -b -w -r1.82 Makefile.am
--- src/insets/Makefile.am	14 Dec 2004 10:41:08 -0000	1.82
+++ src/insets/Makefile.am	8 Mar 2005 17:27:41 -0000
@@ -3,8 +3,11 @@ include $(top_srcdir)/config/common.am
 noinst_LTLIBRARIES = libinsets.la
 
 EXTRA_DIST = \
+	pch.h \
 	insettheorem.C \
 	insettheorem.h
+
+BUILT_SOURCES = $(PCH_FILE)
 
 AM_CPPFLAGS = $(PCH_FLAGS) -I$(srcdir)/.. $(BOOST_INCLUDES)
 
Index: src/mathed/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/Makefile.am,v
retrieving revision 1.140
diff -u -p -B -b -w -r1.140 Makefile.am
--- src/mathed/Makefile.am	14 Dec 2004 10:41:08 -0000	1.140
+++ src/mathed/Makefile.am	8 Mar 2005 17:27:41 -0000
@@ -1,6 +1,8 @@
 include $(top_srcdir)/config/common.am
 
-EXTRA_DIST = formulamacro.C
+EXTRA_DIST = pch.h formulamacro.C
+
+BUILT_SOURCES = $(PCH_FILE)
 
 noinst_LTLIBRARIES = libmathed.la
 
Index: src/support/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/Makefile.am,v
retrieving revision 1.90
diff -u -p -B -b -w -r1.90 Makefile.am
--- src/support/Makefile.am	25 Feb 2005 09:01:06 -0000	1.90
+++ src/support/Makefile.am	8 Mar 2005 17:27:41 -0000
@@ -4,7 +4,7 @@ SUBDIRS = . tests
 
 CLEANFILES += $(BUILT_SOURCES)
 
-EXTRA_DIST = package.C.in os_unix.C os_win32.C os_os2.C
+EXTRA_DIST = package.C.in pch.h os_unix.C os_win32.C os_os2.C
 
 noinst_LTLIBRARIES = libsupport.la
 
@@ -12,7 +12,7 @@ if USE_COMPRESSION
 COMPRESSION = gzstream.C gzstream.h
 endif
 
-BUILT_SOURCES = package.C
+BUILT_SOURCES = $(PCH_FILE) package.C
 
 AM_CPPFLAGS = $(PCH_FLAGS) -I$(srcdir)/.. $(BOOST_INCLUDES)
 
Index: src/support/tests/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/tests/Makefile.am,v
retrieving revision 1.3
diff -u -p -B -b -w -r1.3 Makefile.am
--- src/support/tests/Makefile.am	25 Feb 2005 09:01:06 -0000	1.3
+++ src/support/tests/Makefile.am	8 Mar 2005 17:27:41 -0000
@@ -1,6 +1,8 @@
 include $(top_srcdir)/config/common.am
 
-EXTRA_DIST = test_convert test_lstrings regfiles
+EXTRA_DIST = pch.h test_convert test_lstrings regfiles
+
+BUILT_SOURCES = $(PCH_FILE)
 
 TESTS = \
 	test_convert \
Index: src/tex2lyx/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/Makefile.am,v
retrieving revision 1.26
diff -u -p -B -b -w -r1.26 Makefile.am
--- src/tex2lyx/Makefile.am	3 Feb 2005 15:38:04 -0000	1.26
+++ src/tex2lyx/Makefile.am	8 Mar 2005 17:27:41 -0000
@@ -1,7 +1,8 @@
 include $(top_srcdir)/config/common.am
 
-EXTRA_DIST = test-structure.tex test-insets.tex
-DISTCLEANFILES += $(BUILT_SOURCES)
+EXTRA_DIST = pch.h test-structure.tex test-insets.tex
+
+DISTCLEANFILES += $(LINKED_SOURCES)
 
 #noinst_LTLIBRARIES = libtexparser.la
 #
@@ -21,7 +22,7 @@ if USE_COMPRESSION
 COMPRESSIONLIB = -lz
 endif
 
-BUILT_SOURCES = \
+LINKED_SOURCES = \
 	FloatList.C \
 	Floating.C \
 	counters.C \
@@ -32,8 +33,10 @@ BUILT_SOURCES = \
 	lyxlex.C \
 	lyxlex_pimpl.C
 
+BUILT_SOURCES = $(PCH_FILE) $(LINKED_SOURCES)
+
 tex2lyx_SOURCES = \
-	$(BUILT_SOURCES) \
+	$(LINKED_SOURCES) \
 	Spacing.h \
 	boost.C \
 	context.C \
@@ -56,9 +59,9 @@ tex2lyx_LDADD = \
 	$(top_builddir)/src/support/libsupport.la \
 	$(BOOST_LIBS) $(COMPRESSIONLIB)
 
-$(BUILT_SOURCES) :
+$(LINKED_SOURCES) :
 	@rm -f $@ ; \
 	$(LN_S) $(top_srcdir)/src/$@ .
 
 rm_link_files:
-	rm -f $(BUILT_SOURCES)
+	rm -f $(LINKED_SOURCES)
-- 
        Lgb

Reply via email to