Difference between revisions of "Talk:Writing Makefiles"

From Apertium
Jump to navigation Jump to search
(pre)
(works)
Line 1: Line 1:
==Avoid duplicating install="yes" (modes.xml) in Makefile.am==
 
Most language pairs have lines like
 
<pre>
 
$(INSTALL_DATA) $(PREFIX1).mode $(DESTDIR)$(apertium_modesdir)
 
rm $(PREFIX1).mode
 
</pre>
 
for every mode that has install="yes" in modes.xml. So setting install="yes" doesn't actually install the mode, it just creates an installable mode. This is redundant and confusing.
 
 
To actually install on install="yes", we might do something like this (untested and probably wrong makefile syntax):
 
<pre>
 
install-data-local:
 
mv modes modes.bak
 
apertium-gen-modes modes.xml $(BASENAME)
 
rm -rf modes
 
mv modes.bak modes
 
test -d $(DESTDIR)$(apertium_modesdir) || mkdir $(DESTDIR)$(apertium_modesdir)
 
files=`xmllint --xpath '//mode[@install="yes"]/@name' modes.xml | sed 's/ *name="\([^"]*\)"/\1.mode /g' `
 
$(INSTALL_DATA) $files $(DESTDIR)$(apertium_modesdir)
 
rm $files
 
</pre>
 

Revision as of 08:13, 24 October 2013