GNOME Bugzilla – Bug 637505
[PATCH] Makefile does not work with make 3.82
Last modified: 2010-12-23 19:32:02 UTC
this occurs both on master and on gimp-help-2-6-0: $ make all [SRC] src/preface/authors.xml Making all in quickreference make[1]: Entering directory `/home/fordfrog/src/other/gimp-help-2/quickreference' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/home/fordfrog/src/other/gimp-help-2/quickreference' make[1]: Entering directory `/home/fordfrog/src/other/gimp-help-2' [SRC] src/preface/authors.xml make[1]: *** No rule to make target `pot/filters.pot', needed by `po/da/filters.po'. Stop. make[1]: Leaving directory `/home/fordfrog/src/other/gimp-help-2' make: *** [all-recursive] Error 1 it fails on da because it is first in the list, but i guess it would fail on any other language too.
Created attachment 176659 [details] [review] patch fixing building of pot files the attached patch fixes the problem. it is created on gimp-help-2-6-0 branch but applies to master too (but i guess should be applied to gimp-help-2-6-0 and then merged to master). the problem is caused by the fact that make was not able to find any rule for src/%.xml files: $ make pot/filters.pot --debug=i GNU Make 3.82 Built for x86_64-pc-linux-gnu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Reading makefiles... Updating goal targets.... File `pot/filters.pot' does not exist. Looking for an implicit rule for `pot/filters.pot'. Trying pattern rule with stem `filters'. Trying implicit prerequisite `src/filters/*.xml'. Trying pattern rule with stem `filters.pot'. Trying implicit prerequisite `pot/filters.pot,v'. Trying pattern rule with stem `filters.pot'. Trying implicit prerequisite `pot/RCS/filters.pot,v'. Trying pattern rule with stem `filters.pot'. Trying implicit prerequisite `pot/RCS/filters.pot'. Trying pattern rule with stem `filters.pot'. Trying implicit prerequisite `pot/s.filters.pot'. Trying pattern rule with stem `filters.pot'. Trying implicit prerequisite `pot/SCCS/s.filters.pot'. Trying pattern rule with stem `filters'. Trying implicit prerequisite `src/filters/*.xml'. Looking for a rule with intermediate file `src/filters/*.xml'. Avoiding implicit rule recursion. Trying pattern rule with stem `*.xml'. Trying implicit prerequisite `src/filters/*.xml,v'. Trying pattern rule with stem `*.xml'. Trying implicit prerequisite `src/filters/RCS/*.xml,v'. Trying pattern rule with stem `*.xml'. Trying implicit prerequisite `src/filters/RCS/*.xml'. Trying pattern rule with stem `*.xml'. Trying implicit prerequisite `src/filters/s.*.xml'. Trying pattern rule with stem `*.xml'. Trying implicit prerequisite `src/filters/SCCS/s.*.xml'. No implicit rule found for `pot/filters.pot'. Must remake target `pot/filters.pot'. make: *** No rule to make target `pot/filters.pot'. Stop.
It works for me, so most likely it's not a bug. Typically you get this error message if some of the prerequisites are missing, e.g. $ cat Makefile foo: bar baz @echo Making $@ baz: @echo Making $@ $ make make: *** No rule to make target `bar', needed by `foo'. Stop. $ touch bar $ make Making baz Making foo So please try $ ls -l src/filters/*.xml images/C/filters/*.* (this should list all prerequisites of pot/filters.pot) and $ make -n pot/filters.pot (to show what "make" would do if you tried to build just that pot file) and $ make -n -f Makefile.GNU pot/filters.pot (using the alternate Makefile). Additionally, you can also try to check po/da/filters.po this way, or omit the "-n" option and try to really build that file. Your patch doesn't help because the src files (e.g. src/*.xml or src/filters/*.xml) *must* exist, otherwise you can't make pot or po files.
to make it clear, i am using git repo, so i have everything in my system as others do, i just might have different version of make tool: $ make -v GNU Make 3.82 Built for x86_64-pc-linux-gnu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. here is output of suggested commands. $ make -n pot/filters.pot make: *** No rule to make target `pot/filters.pot'. Stop. $ make -n -f Makefile.GNU pot/filters.pot make: *** No rule to make target `pot/filters.pot'. Stop. if you have a look above at the output of $ make pot/filters.pot --debug=i you'll see that it is looking for rule for `src/filters/*.xml' but it fails to find any and fails. putting in the rule for src/%.xml files prevents the failure. Looking for a rule with intermediate file `src/filters/*.xml'. Avoiding implicit rule recursion. Trying pattern rule with stem `*.xml'. Trying implicit prerequisite `src/filters/*.xml,v'. Trying pattern rule with stem `*.xml'. Trying implicit prerequisite `src/filters/RCS/*.xml,v'. Trying pattern rule with stem `*.xml'. Trying implicit prerequisite `src/filters/RCS/*.xml'. Trying pattern rule with stem `*.xml'. Trying implicit prerequisite `src/filters/s.*.xml'. Trying pattern rule with stem `*.xml'. Trying implicit prerequisite `src/filters/SCCS/s.*.xml'. No implicit rule found for `pot/filters.pot'. what is also interesting is that running $ make pot/gimp.pot works (well, it works only if FORCE is filtered out, which it is not). what is weird that generally the files specification is quite similar, "$(srcdir)/src/*.xml" for gimp.pot compared to "$(srcdir)/src/%/*.xml" for other pot files. so, the resume it, on my system "make all" does not work, and the patch i submitted fixes that, but i do not claim the fix is correct, i just claim that it fixes my issue. and i am using latest copy of git repo so the problem is not in repo (if it works for you without problems) but probably in compatibility of the Makefile with make that i use.
Created attachment 176670 [details] [review] fixes running "make pot/gimp.pot" the attached patch fixes running "make pot/gimp.pot" command. without it i get this: $ make pot/gimp.pot [POT] pot/gimp.pot Traceback (most recent call last):
+ Trace 225176
main(sys.argv[1:])
xml2po_main.to_pot(filenames)
raise IOError("Unable to read file '%s'" % xmlfile)
ls: cannot access FORCE: Directory or file does not exist make: *** [pot/gimp.pot] Error 1
Do the source files really exist? My output of "make pot/filters.pot --debug=i" is completely different: GNU Make 3.81 ... Updating goal targets.... File `pot/filters.pot' does not exist. Looking for an implicit rule for `pot/filters.pot'. Trying pattern rule with stem `filters'. Trying implicit prerequisite `src/filters/alpha-to-logo.xml'. ... Trying implicit prerequisite `src/filters/web.xml'. Trying rule prerequisite `FORCE'. Found an implicit rule for `pot/filters.pot'. File `FORCE' does not exist. Must remake target `FORCE'. Successfully remade target file `FORCE'. Must remake target `pot/filters.pot'. [POT] pot/filters.pot Successfully remade target file `pot/filters.pot'. But when I rename src/ I get the same messages. What happens if you try $ git archive --format=tar --prefix=gimp-help-2/ HEAD | > (cd /tmp/ && tar -xf -) $ cd /tmp/gimp-help-2 $ ./autogen.sh --without-gimp $ make all # or: make pot/filters.pot
tried but the result is still the same: $ make pot/filters.pot ... make: *** No rule to make target `pot/filters.pot'. Stop. but when i downgraded to make 3.81, the make passes: $ make pot/filters.pot [POT] pot/filters.pot weird thing is that i am using gentoo linux which builds everything from sources and the only build that fails here because of make is gimp help. anyway, it seems it's either bug in make 3.82 or problem in the Makefile that arises only in make 3.82 and passes in lower versions.
when looking at the output of "make --debug=i pot/filters.pot" deeply, the difference is that in 3.81 "src/filters/*.xml" is expanded to file names before it is processed whereas in 3.82 it is not expanded and is being processed by make as it is, so as "src/filters/*.xml".
while googling for the issue, i found this: http://savannah.gnu.org/bugs/?31621 it's exactly the same case as here. unfortunatelly, there is no reaction from the devs.
Created attachment 176692 [details] [review] patch adjusting generating Makefile so it works with make 3.82 attached patch makes the expansion outside of the rule. tested with make 3.82 and 3.81 running "make html-de" and "make pot/filters.pot" and it works. also, while reading about the issue on the internet, it seems only 3.81 does the expansion when both % and * are used, what i understood is that 3.80 behaves similar to 3.82, but not exactly the same, anyway i did not play with make 3.80 at all to verify that.
Ok, I have installed make-3.82 for testing -- and it fails to build pot/filters.pot. :-( I'll have a look at your patches and the make manual...
here is another article that makes the issue more clear: http://old.nabble.com/-bug--31248--.SECONDEXPANSION%3A-Inconsistent-expansion-of-glob-patterns-in-pattern-rule-dependency-lines-td29882916.html
Hmm, maybe it's not so easy. Your POT_XML_FILES patch looked good and seemed to work, but when I added the following two innocent lines: $(msg) " $$^: $^" $(msg) " POT_XML_FILES: $(POT_XML_FILES)" to the Makefile it appeared that POT_XML_FILES is computed correctly, but the automatic make variable "$^" does not contain the correct list of prerequisites, and thus the dependency is broken. Using .SECONDEXPANSION didn't work, too. So meanwhile I think we have to use something like define MAKE_POT_RULES pot/$(1).pot: src/$(1)/*.xml $$(cmd) $$(call make_target_dir,$$@) $$(msg) "[POT] $$@" $$(cmd) $$(call xml2pot,$$(filter-out FORCE,$$^),$$@) endef $(foreach stem,$(subst src/,,$(filter-out src src/,$(SRC_DIRS))),\ $(eval $(call MAKE_POT_RULES,$(stem)))) but this is (once more) somewhat ugly... Sadly, I didn't find anything about mixing the various make features (implicit rules, globbing chars, functions) in the Make manual.
Created attachment 176783 [details] [review] patch adjusting generating Makefile so it works with make 3.82 while reading your report, you led me to have a look at that second expansion (i did not study that option before as my last patch worked, but i did not try to verify that $^ output). while reading through the documentation, one thing hit me: "Secondary Expansion of Static Pattern Rules Rules for secondary expansion of static pattern rules are identical to those for explicit rules, above, with one exception: for static pattern rules the $$* variable is set to the pattern stem. As with explicit rules, $$? is not available and expands to the empty string." see the attached patch. it works for me, but needs to be verified i did not omit anything important.
Created attachment 176784 [details] [review] patch adjusting generating Makefile so it works with make 3.82 (simplified) i'd bet i already tried this before but it did not work. now it works, weird. anyway, i simplified the patch so it does not even need second expansion.
Created attachment 176785 [details] [review] patch adjusting generating Makefile so it works with make 3.82 (simplified) sorry, by accident i attached old patch instead of the new one
Comment on attachment 176783 [details] [review] patch adjusting generating Makefile so it works with make 3.82 oh no, i take it back, the last patch does not contain valid $^ so only the version with second expansion is working. sorry for spam.
Comment on attachment 176785 [details] [review] patch adjusting generating Makefile so it works with make 3.82 (simplified) does not contain valid $^
Created attachment 176862 [details] [review] Final patch(?) Aaargh, I didn't notice the part with "$$*" in the Secondary Expansion chapter. I have slightly modified your patch and will push it if you don't see any problems.
it looks good to me. and definitely better documented than from me :-) i still have no idea why second expansion of $$* works but using just $* does not work (the stem gets replaced with nothing, so the result is "src//*.xml" and it grabs completely different files), but it worked for me so i agree it can be pushed to repo.
fixed in http://git.gnome.org/browse/gimp-help-2/commit/?id=9790a3787067697db454d244a60042fe7ed2c469
As far as I understand it: 1. In the 'target-pattern: prerequisite-pattern' line "%" is replaced with the matching string, and "$$" is replaced with "$" (or "$$*" with "$*"). The automatic variables like "$^", "$*" etc. are not set and not valid in this line (standard make behaviour?). 2. Then the automatic variables, especially "$*", are set and can be used for the shell commands. 3. When Secondary Expansion is enabled, these automatic variables keep their values within the scope of the rule; and now, when reading the "target: prereqisite" line again, "$*" is expanded to that value.
yes, but when there was '%', it was replaced with the stem AFTER '*' was expanded, which caused that it searched for prerequsity of string "src/filter/*.xml" (in fact "src/%/*.xml" matched no file so it was left as the original string with '*' not expanded at all). with make 3.81, '%' is replaced before '*' is expanded so it works fine. when using just $* (without second expansion), it is not set at the moment when prerequsity is being processed so it ends up as "src//*xml" which is expanded to xml files in src dir, which is not what it should do. with second expansion, $$* gets replaced correctly on second expansion and BEFORE '*' is expanded to files matching "src/filter/*.xml" and things work as they should. but why '%' is processed AFTER '*' expansion, and $$^ is processed BEFORE '*' expansion, that i do not understand. nor the fact that on first expansion, stem ($*) is not set yet though it is already known.
Created attachment 176930 [details] [review] patch fixing building of pot files when image has been changed if image has been changed, the image file is passed along with xml files to xml2po, which causes this error ([FILES] line contains content of $^, it is not part of standard output and was added there just for debug purpose): $ make pot [POT] pot/filters.pot [FILES] src/filters/blur.xml src/filters/alpha-to-logo.xml src/filters/light-and-shadow.xml src/filters/generic.xml src/filters/introduction.xml src/filters/combine.xml src/filters/web.xml src/filters/artistic.xml src/filters/edge-detect.xml src/filters/distort.xml src/filters/map.xml src/filters/render.xml src/filters/decor.xml src/filters/noise.xml src/filters/animation.xml src/filters/enhance.xml images/C/filters/preview-submenu.png Traceback (most recent call last):
+ Trace 225228
self.current_mode.preProcessXml(doc.doc, self.msg)
root = doc.getRootElement()
if ret is None:raise treeError('xmlDocGetRootElement() failed')
make: *** [pot/filters.pot] Error 1 the attached patch filters out all files that are do not match %.xml so only .xml files are passed to xml2po.
(In reply to comment #22) > yes, but when there was '%', it was replaced with the stem AFTER '*' was > expanded, which caused that it searched for prerequsity of string > "src/filter/*.xml" (in fact "src/%/*.xml" matched no file so it was left as the > original string with '*' not expanded at all). with make 3.81, '%' is replaced > before '*' is expanded so it works fine. Mixing '%' with wildcards in pattern rules is not documented, so it might be that this is just not considered valid by the 'make' developers. Maybe we just playd Russian roulette when we mixed these two features? > when using just $* (without second expansion), it is not set at the moment when > prerequsity is being processed so it ends up as "src//*xml" which is expanded > to xml files in src dir, which is not what it should do. > > with second expansion, $$* gets replaced correctly on second expansion and > BEFORE '*' is expanded to files matching "src/filter/*.xml" and things work as > they should. This is probably analogous to the standard behaviour of simple rules (pattern rules are GNU-specific, not standard): foo.ext: bar $@ $^ $* $? @echo "Making $@ ($^)" "make foo.ext" requires "bar", nothing else. > but why '%' is processed AFTER '*' expansion, and $$^ is processed BEFORE '*' > expansion, that i do not understand. nor the fact that on first expansion, stem > ($*) is not set yet though it is already known. Obviously "$*" is *not* set (known) when parsing the first line of the rule (target: prerequisite). All automatic variables are set *after" parsing the first line, maybe even with the same routine for every type of rule. (cf. The GNU Make Manual, 10.5.3 Automatic Variables) And apparently whether or not (or if or when) wildcards ("*") are expanded just depends on the internal routines the developers use to parse that line.
Created attachment 176947 [details] [review] patch fixing building of pot files when image has been changed this just simplifies the patch as there is no need to filter out FORCE anymore when the filter allows only .xml files
It worked fine for me -- because I always use Makefile.GNU, which used a different "xml2pot" macro. Moving the filter call into the xml2pot macro should fix the bug.