Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Makefile and standard includes

Posted on 2009-06-30
9
Medium Priority
?
423 Views
Last Modified: 2013-11-13
Mornin' All

I'm sure this is dead easy but I can't figure it out. I use MarkDown to convert content text to html but MarkDown does not provide the appropriate "<html><head>...</head><body>" and "</body></html>" tags. A perfect automation job for make, thinks I.

Here's the make file I have at the moment. It works fine to build the final html file in general. The problem is that it doesn't trigger a rebuild when I change html_header.inc or html_footer.inc.

Any clues?

MYINC=$(HOME)\etc
VPATH=.:$(MYINC)

%.html : %.inc
   cat "$(MYINC)/html_header.inc" >> $@
   cat $<                         >> $@
   cat "$(MYINC)/html_footer.inc" >> $@

%.inc : %.txt
   /usr/local/bin/markdown.pl $< > $@

Thanks in advance.
0
Comment
Question by:chris_slee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 43

Expert Comment

by:ravenpl
ID: 24755203
- %.html : %.inc
+ %.html : %.inc $(MYINC)/html_header.inc $(MYINC)/html_footer.inc
will not work?
0
 

Author Comment

by:chris_slee
ID: 24757836
I figured that for the solution as well but, no, it doesn't work. make throws up this error:

"mixed implicit and static pattern rules. Stop.'"

My understanding is that implicit rules (whether built-in or user defined) must be of the format "%.html : %.inc" with no other dependencies listed. This is despite http://gnu.huihoo.org/make-3.77/html_chapter/make_10.html which says:

"%.o: %.c foo.h
        $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<

which tells how to make `.o' files from `.c' files, and makes all `.o' files using this pattern rule also depend on `foo.h'. "
0
 
LVL 35

Expert Comment

by:Duncan Roe
ID: 24758740
What are your targets? Can you please post the entire Makefile (if very long, post as file e.g. Makefile.txt)
The problem with that line may be that the same file can match both kinds of patterns.
I tried guessing a target but can't reproduce the error you see

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:chris_slee
ID: 24759003
That is the entire makefile. That what puzzles me. I call it as

% make filename.html

and expect that it looks for filename.txt, checks whether it's newer then filename.html (if it exists) and builds as required.
Makefile.txt
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 24760937
> "mixed implicit and static pattern rules. Stop.'"
what OS and make You use - it works perfectly at my side, try also (dependencies should summarize)

*.html : $(MYINC)/html_header.inc $(MYINC)/html_footer.inc
%.html : %.inc
...
0
 
LVL 35

Accepted Solution

by:
Duncan Roe earned 200 total points
ID: 24761787
Why do you have a backslash on line 1? $(HOME)\etc is not the same as =$(HOME)/etc which is a normal Unix pathname
20:09:29$ cat -A ee50.mf 
MYINC=$(HOME)$
VPATH=.:$(MYINC)$
$
all: ee50.html$
$
%.html : %.inc $(MYINC)/html_header.inc $(MYINC)/html_footer.inc$
^Icat "$(MYINC)/html_header.inc" >> $@$
^Icat $<                         >> $@$
^Icat "$(MYINC)/html_footer.inc" >> $@$
$
%.inc : %.txt$
^I/usr/local/bin/markdown.pl $< > $@$
20:08:49$ make -f ee50.mf xxx.html
make: *** No rule to make target `xxx.html'.  Stop.

Open in new window

0
 

Author Closing Comment

by:chris_slee
ID: 31598621
Holy cow! I've been looking at this for a week and have only seen this after it was pointed out. That's what you get for working in a mixed linux/Windows environment. Thank you very much. Works perfectly now.
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 24770384
So that's it? Correcting the typo fixed Your problem?
0
 

Author Comment

by:chris_slee
ID: 24770412
You can't imagine what an idiot I feel or how much time I've sunk into this but, yes, correcting the typo fixed it. I've been in this game a long time and to be stumped by something this dumb is ... is .... well, I find it hard to believe. I really don't know how to apologise for wasting your time on something I should have been able to see at first glance.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question