Blog 1

Random Talk on Random Thoughts

Testing Online Code Syntax Highlighters for Blogs (5): Embedding Makefiles to a Web Page

| Comments |

Note: This post won’t make sense here. Refer to the original post.

In my previous post titled Fast Compilation and Execution of Source Code, I included a makefile. After I’ve been familiar with SyntaxHighlighter, I changed the code of the makefile so that the new tool is used. However, as I’ve written in my earlier post, SyntaxHighlighter has no makefile support, while highlight.js and google-code-prettify have that feature.123

I think, therefore I am.

Réné Descartes (1596--1650)

In order to be sure about their claims, I’ve done a test and the results are as follow.

highlight.js:

1
2
3
4
hello: hello.c
	gcc -o hello hello.c
clean:
	rm -f hello

Maybe my makefile is too simple that it lacks some typical features for the automatic language recognition of highlight.js. Let’s see the sample code copied from the official demo.

1
2
3
4
5
6
7
8
9
10
11
12
13
# Makefile

BUILDDIR      = _build
EXTRAS       ?= $(BUILDDIR)/extras

.PHONY: main clean

main:
	@echo "Building main facility..."
	build_main $(BUILDDIR)

clean:
	rm -rf $(BUILDDIR)/*

google-code-prettify

1
2
3
4
hello: hello.c
	gcc -o hello hello.c
clean:
	rm -f hello

Let’s see a real one.

1
2
3
4
5
6
7
8
9
10
11
12
13
# Makefile

BUILDDIR      = _build
EXTRAS       ?= $(BUILDDIR)/extras

.PHONY: main clean

main:
	@echo "Building main facility..."
	build_main $(BUILDDIR)

clean:
	rm -rf $(BUILDDIR)/*

Unluckily, I can’t figure out the way to include a tab, instead of whitespaces, for makefiles. Anyways, one who use makefiles will know that after running make on the first day.


Comments