#!/usr/bin/make
# file: ttcp/Makefile

# ====================================================================
# environment definitions;
# --------------------------------------------------------------------

include ../make.def

# ====================================================================
#
# --------------------------------------------------------------------

TRASH=*~ t t.* *.[0-9][0-9][0-9]
TOOLS=ttcp
PAGES=ttcp.7
FILES=Makefile *.mak *.sh *.txt *.c *.h *.xml *.css

# ====================================================================
# targets;
# --------------------------------------------------------------------

.PHONY: all compile compact install scripts manuals uninstall library clean fresh

# ====================================================================
# targets;
# --------------------------------------------------------------------

all compile: ${TOOLS}
compact: compile
	if [ ! -z ${STRIP} ]; then ${STRIP} ${TOOLS}; fi
	if [ -x /usr/local/bin/upx ]; then upx --best ${TOOLS}; fi
library:
	install -m 0755  -d ${BIN}
scripts:
install: compile library
	install -m 4555  -s ${TOOLS} ${BIN}
uninstall:
	cd ${BIN}; rm -f ${TOOLS}
manuals:
	install -m 0444  ${PAGES} ${MAN}
fresh: clean compile
clean:
	rm -f ${TRASH} ${TOOLS} 
%.o: %.c
	${CC} ${CFLAGS} -c ${<} 
%: %.o
	${CC} -o ${@} ${^} ${LFLAGS}

