# 
# This is the makefile for the Linux trace utility daemon and
# data interpreter.
# 
# Date : 3/1999 K.Y.
#

# Support
# If 1, will support RTAI (www.rtai.org) traces 
SUPP_RTAI = 1

# Definitions
PREFIX      = /usr
EXEC_PREFIX = $(PREFIX)
CC          = gcc
DEFFLAGS    = -DSUPP_RTAI=$(SUPP_RTAI)
CFLAGS      = -O2 -Wall $(DEFFLAGS)

# Files
INCLUDES    = TraceDaemon.h
INCLUDEDIRS = -I../Include
OBJS_TRACE  = TraceDaemon.o
EXEC_NAME   = tracedaemon
SCRIPT_DIR  = ./Scripts
INSTALL_DIR = /usr/sbin
INSTALL     = install

# Rules
all: TraceDaemon

.depend:
	@echo "Building dependencies"
	rm -rf .depend
	touch .depend
	makedepend -f .depend $(DEFFLAGS) $(INCLUDEDIRS) *.c
	@echo "Dependencies built"

.c.o: ${INCLUDES}
	$(CC) $(CFLAGS) $(INCLUDEDIRS) -c $<

TraceDaemon: ${OBJS_TRACE}
	$(CC) -o $(EXEC_NAME) ${OBJS_TRACE}

install: TraceDaemon
	test -d $(INSTALL_DIR) || $(INSTALL) -d -m 755 $(INSTALL_DIR)
	$(INSTALL) -m 755 $(EXEC_NAME) $(INSTALL_DIR)
	$(INSTALL) -m 755 $(SCRIPT_DIR)/* $(INSTALL_DIR)

clean: 
	rm -rf *.o tracedaemon core

distclean:
	rm -rf *~
	rm -rf .depend .depend.bak
	rm -rf *.o tracedaemon  core

-include .depend
