#
# Makefile.c - Makefile Templates for C
# 
#
#

SRC		:= $(wildcard *.c)
OBJ		:= $(patsubst %.c, %.o, $(SRC))
BIN		:= $(patsubst %.o, %,   $(OBJ))
ALL		:= $(BIN)

# to allow for profiling with gprof, uncomment these lines
# profiling requires linking to a static library not a dynamic library
#PROFILE_FLAGS = -pg 
#PROFILE_STATIC_FLAG = -static

DEBUG_FLAGS	= $(PROFILE_STATIC_FLAG) -Wall -g -DDEBUG 
CC_FLAGS 	= -m32

#INCLUDE		= -I../include 
INCLUDE		= -I/usr/include/agilent

SHELL		= /bin/sh
CC		= gcc $(CC_FLAGS)
CFLAGS		= -O2 $(DEBUG_FLAGS) $(INCLUDE)
LDFLAGS		= -L../lib/i386 -lM918X -lm
ARFLAGS		=

.SUFFIXES:
.SUFFIXES: .c .o
.PHONY: all check clean install uninstall

all: .depend $(ALL)

$(ALL): Makefile

.depend:
	@echo "make .depend ..."
	-$(CC) -MM $(INCLUDE) $(SRC) > .depend
	@echo "make .depend ... OK"

$(filter %.o, $(OBJ)): %.o: %.c
	$(CC) -c $(CFLAGS) $< -o $@ $(PROFILE_FLAGS)

$(filter %, $(BIN)): %: %.o
	$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@ $(PROFILE_FLAGS)

check:
	@echo "make check ..."
	@echo "make check ... OK"

install:
	@echo "make install ..."
	@echo "make install ... OK"

uninstall:
	@echo "make uninstall ..."
	@echo "make uninstall ... OK"

clean:
	@echo "make clean ..."
	-$(RM) .depend
	-$(RM) $(OBJ)
	-$(RM) $(BIN)
	@echo "make clean ... OK"


include .depend
