Difference between revisions of "Talk:Writing Makefiles"

From Apertium
Jump to navigation Jump to search
(Created page with '==Avoid duplicating install="yes" (modes.xml) in Makefile.am== Most language pairs have lines like <pre> $(INSTALL_DATA) $(PREFIX1).mode $(DESTDIR)$(apertium_modesdir) rm $(PRE…')
 
(pre)
Line 8: Line 8:


To actually install on install="yes", we might do something like this (untested and probably wrong makefile syntax):
To actually install on install="yes", we might do something like this (untested and probably wrong makefile syntax):
<pre>

install-data-local:
install-data-local:
mv modes modes.bak
mv modes modes.bak
Line 18: Line 18:
$(INSTALL_DATA) $files $(DESTDIR)$(apertium_modesdir)
$(INSTALL_DATA) $files $(DESTDIR)$(apertium_modesdir)
rm $files
rm $files
</pre>

Revision as of 07:45, 24 October 2013

Avoid duplicating install="yes" (modes.xml) in Makefile.am

Most language pairs have lines like

	$(INSTALL_DATA) $(PREFIX1).mode $(DESTDIR)$(apertium_modesdir)
	rm $(PREFIX1).mode

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):

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