#-----------------------------------------------------------------------------
# Choose a compiler & its options
#--------------------------------------------------------------------------

CC   = gcc
OPTS = -std=c99 -MMD -W -O3

#--------------------------------------------------------------------
# Put all together
#--------------------------------------------------------------------
SRCS=digit-count.c
SUBDIRS = . 
INCLUDE = $(addprefix -I,$(SUBDIRS))
OBJS=${SRCS:.c=.o}
LIB = 
CFLAGS   = $(OPTS) $(INCLUDE)
TARGET = dc

all: $(TARGET)

#--------------------------------------------------------------------	
objs: ${OBJS}
#--------------------------------------------------------------------

$(TARGET): objs 
	${CC} ${CFLAGS} -o $@ $(OBJS) $(LIB)

clean:
	rm -f *.o $(OBJS) $(TARGET) Dependencies 

#--------------------------------------------------------------------
.SUFFIXES: .c

.c.o:
	${CC} ${CFLAGS} -c $< -o $@
	cat $*.d >> Dependencies
	rm -f $*.d 

Dependencies:
	touch Dependencies

include Dependencies
