Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
FLUAVERSION = 0.03
FLUAVERSIONTGZ = flua-$(FLUAVERSION).tar.gz
FLUAVERSIONOUTTGZ = flua-$(FLUAVERSION).out.tar.gz

#DEMOLIBS = -lm
#DEMOLIBS = -lm -ldl -llua -llualib
DEMOLIBS = -lm -ldl -llua -llualib -ldllua
GCCFLAGS = -g

ETCFILES = Makefile README
LUAFILES = inc.lua flua-comp.lua flua-prims.lua flua.lua
SKELFILES = skel.bytecode.asm skel.engine.c
DBG=-1

# (find-node "(make)Text Functions")
# DEMOS	= demo1 demo2 demo3 demo4 demo5 demo6 demo7
DEMOS	= demo1 demo2 demo3 demo4 demo6 demo7
DEMO_SOURCES = $(DEMOS:%=%.flua) demo6-lib demo7-lib
ENGINES	= $(DEMOS:%=%.engine.c)
ASMS	= $(DEMOS:%=%.bytecode.asm)
LSTS	= $(DEMOS:%=%.bytecode.lst)
DBGOUTS	= $(DEMOS:%=%.dbg.out)
OUTS	= $(ENGINES) $(ASMS) $(LSTS) $(DBGOUTS)

RUNS	= $(DEMOS:%=%.run)
RUNVS	= $(DEMOS:%=%.run-verbose)
CLEANS	= $(DEMOS:%=%.clean)


# (find-node "(make)Chained Rules")
.PRECIOUS: demo%.engine.c

default: Demos-run

tgz: $(FLUAVERSIONTGZ)
$(FLUAVERSIONTGZ): $(ETCFILES) $(LUAFILES) $(SKELFILES) $(DEMO_SOURCES)
	tar -cvzf $@ $^

# «upload-tgz»
upload-tgz:
	$(MAKE) $(FLUAVERSIONTGZ)
	anonftp angg.twu.net \
	  'cd ~/slow_html/LUA/'   'put $(FLUAVERSIONTGZ)' \
	  'cd ~/public_html/LUA/' 'put $(FLUAVERSIONTGZ)' \
	  quit

out.tgz: $(FLUAVERSIONOUTTGZ)
$(FLUAVERSIONOUTTGZ): $(OUTS)
	tar -cvzf $@ $^

# «run_flua.lua»
# (find-flua "flua.lua")
demo%.engine.c demo%.bytecode.asm: demo%.flua $(LUAFILES) $(SKELFILES)
	lua -f flua.lua 'do_demo(arg[2])' demo$*

demo%.bytecode.o demo%.bytecode.lst: demo%.bytecode.asm
	nasm -f elf -o demo$*.bytecode.o -l demo$*.bytecode.lst $<

demo%: demo%.engine.c demo%.bytecode.o
	gcc $(GCCFLAGS) $(DEMOLIBS) -o $@ $^

demo%.dbg.out: demo%
	-./demo$* $(DBG) > $@

demo%.run: demo%
	-./demo$*
demo%.run-verbose: demo%
	-./demo$* $(DBG)

demo%.clean:
	rm -fv demo$*.engine.c demo$*.bytecode.asm demo$*.bytecode.lst \
	       demo$*.bytecode.o demo$* demo$*.dbg.out
clean: $(CLEANS)


Demos: $(DEMOS)
Demos-run: $(RUNS)
	# To run the demos verbosely, do "make v" or "make v DBG=3".

Demos.dbg.out: $(DBGOUTS)

v: Demos-run-verbose
Demos-run-verbose: $(DEMOS) $(DBGOUTS) $(RUNVS)