test: all
	echo "Running the executable, log to: $@"
	EXPAND=yes RECOMB=yes ./treedecode -c conf > $@ 2>&1
	echo "Finished, this is the log: $@"


CPPFLAGS=-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
all: cmd.o dictionary.o mfstream.o htable.o lmtable.o mempool.o ngramcache.o n_gram.o util.o irstlm_cint.o point.o posix_workarounds.o cdb_findnext.o cdb_find.o cdb_hash.o cdb_init.o cdb_make_add.o cdb_make.o cdb_make_put.o cdb_seek.o cdb_seq.o cdb_unpack.o
	mmc --make --use-grade-subdirs treedecode --c-debug --grade asm_fast.gc \
	  --ld-flags -lgdbm --ld-flags -lz --c-include-directory /usr/lib/R/include --c-include-directory /usr/share/R/include/ --link-object cmd.o --link-object dictionary.o --link-object mfstream.o --link-object htable.o --link-object lmtable.o --link-object mempool.o --link-object ngramcache.o --link-object n_gram.o --link-object util.o --link-object irstlm_cint.o --link-object point.o --link-object posix_workarounds.o --link-object cdb_findnext.o --link-object cdb_find.o --link-object cdb_hash.o --link-object cdb_init.o --link-object cdb_make_add.o --link-object cdb_make.o --link-object cdb_make_put.o --link-object cdb_seek.o --link-object cdb_seq.o --link-object cdb_unpack.o --link-executable-command=g++ --no-ansi-c
clean:
	rm -rf *.o *.mh MCFLAGS Mercury *.err treedecode models cache
