On Sun, 12 Aug 2012, Daniel Veillard wrote:

Is there a reason why libxml2-py.c doesn't go into the distribution tarball? (It's specified as nodist_libxml2mod_la_SOURCES in python/Makefile.am.) I didn't address this earlier, but if the dist were to bundle everything in $(GENERATED)---and I don't see a reason why not---end users who download a tarball wouldn't have to generate files at all, and this kind of problem wouldn't come up in the first place.

 I'm fine adding it to the tarball if people think it's better for
portability !

Okay, I've re-worked python/Makefile.am---see attached.

With this, the makefile bundles all generated files into the distribution, so end users building the Python module don't need to regenerate any source files.

There's some clean-up in there, too.


--Daniel


--
Daniel Richard G. || [email protected] || Software Developer
Teragram Linguistic Technologies (a division of SAS)
http://www.teragram.com/
diff --git a/python/Makefile.am b/python/Makefile.am
index f34aa98..4a8b5d5 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -1,67 +1,54 @@
 # Makefile for libxml2 python library
 AUTOMAKE_OPTIONS = 1.4 foreign
 
-SUBDIRS= . tests
-
-INCLUDES = \
-	-I$(PYTHON_INCLUDES) \
-	-I$(top_srcdir)/include	\
-	-I$(top_builddir)/include \
-	-I$(top_builddir)/$(subdir)
+SUBDIRS = . tests
 
 docsdir = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)
-# libxml2class.txt is generated
 dist_docs_DATA = TODO
 
 EXTRA_DIST = 			\
 	setup.py		\
-	setup.py.in		\
 	generator.py		\
-	libxml_wrap.h		\
 	libxml.py		\
-	libxml2-python-api.xml
-
-libxml2mod_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) -module -avoid-version
+	libxml2-export.c	\
+	libxml2-python-api.xml	\
+	libxml2class.py		\
+	libxml2class.txt
 
 if WITH_PYTHON
-mylibs = \
-	$(top_builddir)/libxml2.la
+AM_CPPFLAGS = \
+	-I$(top_builddir)/include \
+	-I$(top_srcdir)/include	\
+	-I$(PYTHON_INCLUDES)
 
 python_LTLIBRARIES = libxml2mod.la
 
-libxml2mod_la_SOURCES = $(srcdir)/libxml.c $(srcdir)/types.c
-nodist_libxml2mod_la_SOURCES = libxml2-py.c
-libxml2mod_la_LIBADD = $(mylibs) $(CYGWIN_EXTRA_PYTHON_LIBADD) $(WIN32_EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS) -lpython$(PYTHON_VERSION)
+libxml2mod_la_SOURCES = libxml.c libxml_wrap.h libxml2-py.h libxml2-py.c types.c
+libxml2mod_la_LIBADD  = $(top_builddir)/libxml2.la $(CYGWIN_EXTRA_PYTHON_LIBADD) $(WIN32_EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS) -lpython$(PYTHON_VERSION)
+libxml2mod_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) -module -avoid-version
 
-$(srcdir)/libxml.c: libxml2-py.h # to generate before to compile
+BUILT_SOURCES = libxml2-export.c libxml2-py.h libxml2-py.c
 
+# libxml.c #includes libxml2-export.c
+libxml.$(OBJEXT): libxml2-export.c
 
 libxml2.py: $(srcdir)/libxml.py libxml2class.py
-	cat $(srcdir)/libxml.py libxml2class.py > $@
-
-python_DATA = \
-	libxml2.py
+	cat $(srcdir)/libxml.py `test -f libxml2class.py || echo $(srcdir)/`libxml2class.py > $@
 
 dist_python_DATA = \
-	drv_libxml2.py
+	drv_libxml2.py \
+	libxml2.py
 	
-GENERATE = generator.py
-API_DESC = $(top_srcdir)/doc/libxml2-api.xml $(srcdir)/libxml2-python-api.xml
-GENERATED= libxml2class.py \
-           libxml2-export.c \
-           libxml2class.txt \
-	   libxml2-py.c \
-	   libxml2-py.h
+CLEANFILES = *.pyc
 
-CLEANFILES = $(GENERATED) gen_prog libxml2.py *.pyc
+MAINTAINERCLEANFILES = libxml2.py libxml2class.*
 
-$(GENERATED): gen_prog
+API_DESC = $(top_srcdir)/doc/libxml2-api.xml $(srcdir)/libxml2-python-api.xml
+GENERATED = libxml2class.py libxml2class.txt $(BUILT_SOURCES)
 
-gen_prog: $(srcdir)/$(GENERATE) $(API_DESC)
-	$(PYTHON) $(srcdir)/$(GENERATE) $(srcdir)
-	touch gen_prog
+$(GENERATED): $(srcdir)/generator.py $(API_DESC)
+	$(PYTHON) $(srcdir)/generator.py $(srcdir)
 endif
 
 tests test: all
 	cd tests && $(MAKE) tests
-
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
https://mail.gnome.org/mailman/listinfo/xml

Reply via email to