#============================================================================
#  Name:
#    Makefile
#
#  Description:
#    Makefile for the Advanced CUnit Test(ACT) library
#
#  The following nmake targets are available in this makefile:
#
#     all           - make .elf and .mod image files (default)
#     clean         - delete object directory and image files
#     new           - clean and make
#     filename.o    - make object file
#
#   The above targets can be made with the following command:
#
#     make [-f Makefile] [target]
#
#  Assumptions:
#    1. The version of gcc is 3.3 or above.
#    2. The version of GNU make is 3.80 or above.
#
#  Notes:
#    None.
#
#============================================================================

#------------------------------------------------------------------------------
# Software tool and Options
#------------------------------------------------------------------------------
CC = gcc
CFLAGS = -O
AR = ar
ARFLAGS = ru
RANLIB = ranlib
RM = rm

#------------------------------------------------------------------------------
# Path and Object Files
#------------------------------------------------------------------------------

OUTPUT = ../../../lib/
TARGET = libact.a

ALL_PATHS = ../include ../../../include

ALL_INCLUDES = $(addprefix -I, $(ALL_PATHS))

SRCSDIR = ../src/

OBJECTS = \
	actassertimpl.o \
	actstdlib.o \
	acttestcaller.o \
	acttestcase.o \
	acttestfixture.o \
	acttestfixturelist.o \
	acttestlist.o \
	acttestrepeat.o \
	acttestresult.o \
	acttestrunner.o \
	acttestsuite.o \
	 
OBJS = $(addprefix $(SRCSDIR), $(OBJECTS))

#------------------------------------------------------------------------------
# Target
#------------------------------------------------------------------------------

all: $(TARGET)

$(TARGET): $(OBJS)
	$(AR) $(ARFLAGS) $(OUTPUT)$@ $(OBJECTS)
	$(RANLIB) $(OUTPUT)$@

.c.o:	
	$(CC) $(CFLAGS) $(ALL_INCLUDES) $(INCLUDES) -c $<


clean:
	-$(RM) $(OBJECTS) $(OUTPUT)$(TARGET)

new:
	$(MAKE) clean
	$(MAKE)

.PHONY: clean all

#------------------------------------------------------------------------------
# Dependencies
#------------------------------------------------------------------------------
