XilFlash: Fix makefile issues

Fix makefile issues related to incremental build.

Signed-off-by: Anirudha Sarangi <anirudh@xilinx.com>
Reviewed-by: Punnaiah Choudary Kalluri <punnaia@xilinx.com>
This commit is contained in:
Anirudha Sarangi 2015-09-03 20:55:23 +05:30 committed by Nava kishore Manne
parent 072e9699c4
commit 51aeb5446b

View file

@ -1,6 +1,6 @@
############################################################################### ###############################################################################
# #
# Copyright (C) 2007 - 2014 Xilinx, Inc. All rights reserved. # Copyright (C) 2007 - 2015 Xilinx, Inc. All rights reserved.
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@ -35,54 +35,42 @@ ARCHIVER=
CP=cp CP=cp
COMPILER_FLAGS= COMPILER_FLAGS=
EXTRA_COMPILER_FLAGS= EXTRA_COMPILER_FLAGS=
EXTRA_ARCHIVE_FLAGS=rc
LIB=libxilflash.a
RELEASEDIR=../../../lib RELEASEDIR=../../../lib
INCLUDEDIR=../../../include INCLUDEDIR=../../../include
INCLUDES=-I${INCLUDEDIR} INCLUDES=-I./. -I${INCLUDEDIR}
ISF_DIR = .
EXPORT_INCLUDE_FILES = $(ISF_DIR)/include/xilflash.h \ XILFLASH_DIR = .
$(ISF_DIR)/include/xilflash_cfi.h \ OUTS = *.o
$(ISF_DIR)/include/xilflash_intel.h \
$(ISF_DIR)/include/xilflash_properties.h \
$(ISF_DIR)/include/xilflash_amd.h
LIB_SRCS = $(ISF_DIR)/xilflash.c \ XILFLASH_SRCS := $(wildcard *.c)
$(ISF_DIR)/xilflash_cfi.c \ XILFLASH_OBJS = $(addprefix $(XILFLASH_DIR)/, $(XILFLASH_SRCS:%.c=%.o))
$(ISF_DIR)/xilflash_intel.c \
$(ISF_DIR)/xilflash_amd.c
INCLUDEFILES=$(XILFLASH_DIR)/include/xilflash.h \
# create ISF_SRCS based on configured options $(XILFLASH_DIR)/include/xilflash_cfi.h \
$(XILFLASH_DIR)/include/xilflash_intel.h \
ISF_SRCS = $(LIB_SRCS) $(XILFLASH_DIR)/include/xilflash_properties.h \
$(XILFLASH_DIR)/include/xilflash_amd.h
ISF_OBJS = $(ISF_SRCS:%.c=%.o)
libs: libxilflash.a libs: libxilflash.a
cp libxilflash.a $(RELEASEDIR)
make clean
include: libxilflash.a: print_msg_xilflash $(XILFLASH_OBJS)
@for i in $(EXPORT_INCLUDE_FILES); do \ $(ARCHIVER) $(EXTRA_ARCHIVE_FLAGS) ${RELEASEDIR}/${LIB} ${OUTS}
echo ${CP} -r $$i ${INCLUDEDIR}; \
${CP} -r $$i ${INCLUDEDIR}; \ print_msg_xilflash:
done @echo "Compiling XilFlash Library"
.PHONY: include
include: libxilflash_includes
libxilflash_includes:
${CP} ${INCLUDEFILES} ${INCLUDEDIR}
clean: clean:
rm -rf obj/*.o rm -rf $(XILFLASH_DIR)/${OUTS}
rmdir obj rm -rf ${RELEASEDIR}/${LIB}
rm libxilflash.a
libxilflash.a: obj_dir print_msg_flash_base $(ISF_OBJS) $(XILFLASH_DIR)/%.o: $(XILFLASH_DIR)/%.c $(INCLUDEFILES)
@echo "Creating archive $@" $(COMPILER) $(COMPILER_FLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) -c $< -o $@
$(ARCHIVER) rc $@ obj/*.o
obj_dir:
mkdir obj
print_msg_flash_base:
@echo "Compiling XilFlash Library:"
.c.o:
$(COMPILER) $(COMPILER_FLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) -c $< -o obj/$(@F)