#****************************************************************************
#
# Copyright (c) 2010 - 2013 Integrated Device Technology, Inc.
#     All Rights Reserved
#
# Distribution of source code or binaries derived from this file is not
# permitted except as specifically allowed for in the Integrated Device
# Technology Software License agreement.  All copies of this source code
# modified or unmodified must retain this entire copyright notice and
# comment as is.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# Description : SSD manufacturing utility.
# $RCSfile: Makefile,v $
# $Revision: 1.6 $
# $Date: 2013/01/10 19:43:33 $
# $Author: chackney $
# Release : $Name: IDT_EFC_1_6_0 $
#
#****************************************************************************/

#
# Enable Bug Workaroud Code
#
BUGS = \
    -D BUG_ZB_23177 \

CSRC := $(wildcard *.c)
OBJS := $(CSRC:.c=.o)
EXE_NAME := writeFlash
ifeq ($(UNAME_S),FreeBSD)
CFLAGS := -W -Wall $(BUGS) -I/usr/local/include
LDFLAGS := -L/usr/local/lib
else
CFLAGS := -W -Wall $(BUGS)
LDFLAGS :=
endif

.PHONY: all clean

all: $(EXE_NAME)

clean:
	rm -f $(EXE_NAME) *.[od]

$(EXE_NAME): $(OBJS)
	@echo "Linking $@"
	@$(CC) $(LDFLAGS) $(OBJS) -o $@ -lpci -lz

%.o: %.c Makefile
	@echo "Compiling $<"
	@$(CC) $(CFLAGS) -c $< -o $@

DEPS := $(OBJS:.o=.d)
-include $(DEPS)
