# Makefile - Don Yang (uguu.org)
#
# Note that ML version should not be build together with C version,
# because the C linker will be confused by the extra object generated
# by ocamlopt.
#
# 12/27/05

target = natsume
target_ml = natsume-ml

.SUFFIXES: .c .o

.c.o:
	gcc -c -Wall -O3 -finline-functions $< -o $@


all: $(target)

$(target): natsume.o hash.o md5.o path.o lines.o
	gcc $^ -o $@

natsume.o: natsume.c hash.h md5.h path.h lines.h

hash.o: hash.c hash.h

md5.o: md5.c md5.h

path.o: path.c path.h

lines.o: lines.c lines.h

$(target_ml): natsume.ml
	ocamlopt unix.cmxa $< -o $@


clean:
	-rm -f *.cmo *.cmi *.cmx *.o $(target) $(target_ml)

backup:
	-rm -f backup.tar.gz
	tar cf backup.tar *.c *.h *.pl *.ml *.py Makefile makefile.w32
	gzip -9 backup.tar
