Makefile and standard includes

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 or

Any clues?


%.html :
   cat "$(MYINC)/" >> $@
   cat $<                         >> $@
   cat "$(MYINC)/" >> $@ : %.txt
   /usr/local/bin/ $< > $@

Thanks in advance.
Who is Participating?
Duncan RoeConnect With a Mentor Software DeveloperCommented:
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 
all: ee50.html$
%.html : $(MYINC)/ $(MYINC)/$
^Icat "$(MYINC)/" >> $@$
^Icat $<                         >> $@$
^Icat "$(MYINC)/" >> $@$
$ : %.txt$
^I/usr/local/bin/ $< > $@$
20:08:49$ make -f xxx.html
make: *** No rule to make target `xxx.html'.  Stop.

Open in new window

- %.html :
+ %.html : $(MYINC)/ $(MYINC)/
will not work?
chris_sleeAuthor Commented:
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 :" with no other dependencies listed. This is despite 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'. "
A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Duncan RoeSoftware DeveloperCommented:
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

chris_sleeAuthor Commented:
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.
> "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)/ $(MYINC)/
%.html :
chris_sleeAuthor Commented:
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.
So that's it? Correcting the typo fixed Your problem?
chris_sleeAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.