Talk:Writing Makefiles

From Apertium
Revision as of 07:45, 24 October 2013 by Unhammer (talk | contribs) (pre)
Jump to navigation Jump to search

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