Fix header file dependencies.
Move dependency includes into a new spdk.deps.mk file, then include it at the end of Makefiles that build source files. Also add a test to autobuild.sh to confirm that binaries are regenerated if we make after touching a header file. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: If6a1905706a840f92cbdf3ace7fbdb27fe2de213
This commit is contained in:
parent
c2fdcfdd9b
commit
1d90157262
12
autobuild.sh
12
autobuild.sh
@ -21,6 +21,18 @@ make $MAKEFLAGS clean
|
|||||||
fail=0
|
fail=0
|
||||||
time $scanbuild make $MAKEFLAGS DPDK_DIR=$DPDK_DIR || fail=1
|
time $scanbuild make $MAKEFLAGS DPDK_DIR=$DPDK_DIR || fail=1
|
||||||
|
|
||||||
|
# Check that header file dependencies are working correctly by
|
||||||
|
# capturing a binary's stat data before and after touching a
|
||||||
|
# header file and re-making.
|
||||||
|
STAT1=`stat examples/nvme/identify/identify`
|
||||||
|
touch lib/nvme/nvme_internal.h
|
||||||
|
make $MAKEFLAGS DPDK_DIR=$DPDK_DIR || fail=1
|
||||||
|
STAT2=`stat examples/nvme/identify/identify`
|
||||||
|
|
||||||
|
if [ "$STAT1" == "$STAT2" ]; then
|
||||||
|
fail=1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d $out/scan-build-tmp ]; then
|
if [ -d $out/scan-build-tmp ]; then
|
||||||
scanoutput=$(ls -1 $out/scan-build-tmp/)
|
scanoutput=$(ls -1 $out/scan-build-tmp/)
|
||||||
mv $out/scan-build-tmp/$scanoutput $out/scan-build
|
mv $out/scan-build-tmp/$scanoutput $out/scan-build
|
||||||
|
@ -58,5 +58,4 @@ $(APP) : $(OBJS) $(SPDK_LIBS)
|
|||||||
clean :
|
clean :
|
||||||
$(Q)rm -f $(OBJS) *.d $(APP)
|
$(Q)rm -f $(OBJS) *.d $(APP)
|
||||||
|
|
||||||
|
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
|
||||||
|
|
||||||
|
@ -58,4 +58,4 @@ $(APP) : $(OBJS) $(SPDK_LIBS)
|
|||||||
clean :
|
clean :
|
||||||
$(Q)rm -f $(OBJS) *.d $(APP)
|
$(Q)rm -f $(OBJS) *.d $(APP)
|
||||||
|
|
||||||
|
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
|
||||||
|
@ -53,3 +53,4 @@ clean :
|
|||||||
$(LIB) : $(OBJS)
|
$(LIB) : $(OBJS)
|
||||||
$(Q)ar crDs $(LIB) $(OBJS)
|
$(Q)ar crDs $(LIB) $(OBJS)
|
||||||
|
|
||||||
|
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
|
||||||
|
@ -51,3 +51,4 @@ clean :
|
|||||||
libspdk_nvme.a : $(OBJS)
|
libspdk_nvme.a : $(OBJS)
|
||||||
$(Q)ar crDs libspdk_nvme.a $(OBJS)
|
$(Q)ar crDs libspdk_nvme.a $(OBJS)
|
||||||
|
|
||||||
|
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
|
||||||
|
@ -51,3 +51,4 @@ clean :
|
|||||||
libspdk_util.a : $(OBJS)
|
libspdk_util.a : $(OBJS)
|
||||||
$(Q)ar crDs libspdk_util.a $(OBJS)
|
$(Q)ar crDs libspdk_util.a $(OBJS)
|
||||||
|
|
||||||
|
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
|
||||||
|
@ -64,3 +64,5 @@ clean:
|
|||||||
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
|
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
|
||||||
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
|
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
|
||||||
@rm -f $*.d.tmp
|
@rm -f $*.d.tmp
|
||||||
|
|
||||||
|
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
|
||||||
|
@ -60,10 +60,6 @@ CFLAGS += $(COMMON_CFLAGS) -Wno-pointer-sign -std=gnu11
|
|||||||
|
|
||||||
MAKEFLAGS += --no-print-directory
|
MAKEFLAGS += --no-print-directory
|
||||||
|
|
||||||
.PRECIOUS: $(OBJS)
|
|
||||||
|
|
||||||
-include $(OBJS:.o=.d)
|
|
||||||
|
|
||||||
%.o : %.c
|
%.o : %.c
|
||||||
@echo " CC $@"
|
@echo " CC $@"
|
||||||
$(Q)$(CC) $(CFLAGS) -c $<
|
$(Q)$(CC) $(CFLAGS) -c $<
|
||||||
|
3
mk/spdk.deps.mk
Normal file
3
mk/spdk.deps.mk
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.PRECIOUS: $(OBJS)
|
||||||
|
|
||||||
|
-include $(OBJS:.o=.d)
|
@ -46,3 +46,5 @@ vtophys: vtophys.o $(OBJS)
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(Q)rm -f vtophys vtophys.o *.d
|
$(Q)rm -f vtophys vtophys.o *.d
|
||||||
|
|
||||||
|
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
|
||||||
|
@ -57,3 +57,5 @@ $(APP) : $(OBJS) $(SPDK_LIBS)
|
|||||||
|
|
||||||
clean :
|
clean :
|
||||||
$(Q)rm -f $(OBJS) *.d $(APP)
|
$(Q)rm -f $(OBJS) *.d $(APP)
|
||||||
|
|
||||||
|
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
|
||||||
|
Loading…
Reference in New Issue
Block a user