tock-mirror/Makefile
Adam Sampson 6047836456 Add a first shot at the assembly analyser, and make GenerateC use it.
This does about the minimum necessary for assembly analysis to work. It assumes
that any function it hasn't been able to analyse itself needs 512 bytes (most
need far less); it doesn't do any flow analysis; it doesn't do a lot of sanity
checking. However, it produces sensible numbers, and works with the demos I've
tried so far.

I was originally going to make this a separate tool, but there are a number of
bits of the code can be nicely reused, so it's a separate "operating mode" in
the existing program (as is parse-only mode now).
2007-08-08 19:39:47 +00:00

57 lines
1.2 KiB
Makefile

targets = tock tocktest
all: $(targets)
sources = $(wildcard *.hs)
# profile_opts = -prof -auto-all
ghc_opts = \
-fglasgow-exts \
-fallow-undecidable-instances \
-fwarn-unused-binds \
$(profile_opts)
tock: $(sources)
ghc $(ghc_opts) -o tock --make Main
tocktest: $(sources)
ghc $(ghc_opts) -o tocktest -main-is TestMain --make TestMain
CFLAGS = \
-O2 \
-g -Wall \
-std=gnu99 -fgnu89-inline \
`kroc --cflags` `kroc --ccincpath`
%.tock.c: %.occ tock
./tock -v -o $@ $<
indent -kr -pcs $@
%.tock.post.c: %.tock.c tock
$(CC) $(CFLAGS) -S -o $(patsubst %.c,%.s,$<) $<
./tock -vv --mode=post-c -o $@ $(patsubst %.c,%.s,$<)
%: %.tock.o %.tock.post.o tock_support.h kroc-wrapper-c.o kroc-wrapper.occ
kroc -o $@ kroc-wrapper.occ $< $(patsubst %.o,%.post.o,$<) kroc-wrapper-c.o -lcif
cgtests = $(wildcard cgtests/cgtest??.occ)
cgtests_targets = $(patsubst %.occ,%,$(cgtests))
get-cgtests:
svn co https://subversion.frmb.org/svn/cgtests/trunk cgtests
all-cgtests: $(cgtests_targets)
clean-cgtests:
rm -f cgtests/cgtest?? cgtests/*.tock.*
haddock:
@mkdir -p doc
haddock -o doc --html $(sources)
clean:
rm -f $(targets) *.o *.hi
# Don't delete intermediate files.
.SECONDARY: