# makefile for halstead utilities

BIN=../bin
TEST=../testfiles

#LDFLAGS=	-i -s
LDFLAGS=

CFLAGS=	-O

PROGS= halstead c_halsfilt

all: 	$(PROGS)
	

halstead:	halstead.sh
	cp halstead.sh halstead
	chmod u+x halstead

# if you have lex problems, "cp c_halsfilt_c c_halsfilt.c"
c_halsfilt:	c_halsfilt.l
	$(LEX) c_halsfilt.l
	mv lex.yy.c c_halsfilt.c
	$(CC) $(LDFLAGS) c_halsfilt.c -o c_halsfilt -ll


install:	all
	mv halstead $(BIN)/halstead
	chmod 755 $(BIN)/halstead

	mv c_halsfilt $(BIN)/c_halsfilt
	chmod 755 $(BIN)/c_halsfilt

clean:
	-rm -f $(PROGS)  core  *.o c_halsfilt.c _test
	
test:
	@echo results of this command should be the same as test.result
	@echo see halstead/README for systems with known differences
	@cp $(TEST)/test1.c $(TEST)/test2.y $(TEST)/test3.c .
	halstead test1.c test2.y test3.c > _test
	diff _test test.result
	@/bin/rm -f test1.c test2.y test3.c
