yochju / latex-makefile

Automatically exported from code.google.com/p/latex-makefile
Other
0 stars 0 forks source link

Makefile.ini user target is first target in Makefile (thus std. target) #121

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

first of all: Great work. I love the features and easy setup. Now the problem:
I am having a:
.PHONY: spell
spell:
       ispell $(onlysources.tex)

however now when I'm trying to run make it only runs this target (since it's 
the first one). Sure I can edit your Makefile and append it to the end but I 
like to not having to worry about that stuff when I update it.

Thanks!

Original issue reported on code.google.com by andre.r...@gmail.com on 28 Mar 2011 at 10:38

GoogleCodeExporter commented 9 years ago
We should probably make a wiki entry for this, as it is a thorny problem.  I 
can't move the main target above Makefile.ini for various reasons (it used to 
be there, stuff broke, it got moved back).

Not only does "all" not work implicitly anymore, but $(onlysources.tex) is not 
defined, yet, so spell won't work properly, either.

I wonder if we should have a special Makefile.extratargets or something...

Original comment by shiblon on 6 Apr 2011 at 6:16

GoogleCodeExporter commented 9 years ago
Actually, I just looked at this in more depth, and there is a way around the 
default target issue, but not the variables-not-yet-specified issue.

So, here's the proposal, and it's implemented in the attached file for you to 
fiddle with: we load files called "Targets.ini" and 
$(HOME)/.latex-makefile/Targets.ini (either or both, as they happen to exist), 
and we do that after all main targets and variables are specified.

Let me know how the attached file works for you.  If you like it, I'll push it.

Original comment by shiblon on 6 Apr 2011 at 6:28

Attachments:

GoogleCodeExporter commented 9 years ago
Hi!

Thx for the update. I actually digged a little bit into the issue and found 
this:
http://www.gnu.org/software/make/manual/make.html#index-processing-a-makefile-27

So if you set this:
.DEFAULT_GOAL := all

in you Makefile then the all will still be the default target and my ispell 
stuff doesnt brake it. Personally I think the Variables.ini, Targets.ini is 
cleaner but since most users will likely not run into this issue it might be a 
better idea to just stick with the Makefile.ini approach (IMHO).

Actually setting the .DEFAULT_GOAL variable in the Makefile.ini also solves the 
problem. So maybe even a wiki entry is enough. (I would include it in the 
Makefile however).

Thanks again for you effort!

Original comment by andre.r...@gmail.com on 6 Apr 2011 at 7:28

GoogleCodeExporter commented 9 years ago
Thinking a little about it:
I think the most sens makes a 
.DEFAULT_GOAL ?= all

since then someone who actually wants the default goal to be the first target 
can overwrite it in the Makefile.ini. But the most other ppl can easily extend 
it w/o having to know about .DEFAULT_GOAL.

Original comment by andre.r...@gmail.com on 6 Apr 2011 at 7:31

GoogleCodeExporter commented 9 years ago
Cool.  I'll add that.  Can you verify that ?= does the right thing in your 
file?  If so, I'll commit this change.

Original comment by shiblon on 6 Apr 2011 at 7:49

GoogleCodeExporter commented 9 years ago
Ughh, good that you checked :)
'?=' doesnt work on this special variable. But this worked:
right after your version:
[...]
version     := 2.2.0-rc13
.DEFAULT_GOAL := all
[...]
-include Makefile.ini

And if I want to have a target in Makefile.ini as the default then I can still 
write a:
.DEFAULT_GOAL := spell
in my Makefile.ini which overwrite the `all`...

Original comment by andre.r...@gmail.com on 6 Apr 2011 at 7:57

GoogleCodeExporter commented 9 years ago
Excellent.  I've attached my current makefile for you to try out with these 
fixes.

Original comment by shiblon on 6 Apr 2011 at 8:00

Attachments:

GoogleCodeExporter commented 9 years ago
Works perfectly! Thx

Original comment by andre.r...@gmail.com on 6 Apr 2011 at 8:01

GoogleCodeExporter commented 9 years ago
OK.  re61108523ef5 has this change committed.  Pushing rc14 now.

Original comment by shiblon on 6 Apr 2011 at 8:04