mk: fix driver build with installed SDK
[dpdk.git] / mk / internal / rte.compile-pre.mk
index 8bffc21..87d2d93 100644 (file)
@@ -1,12 +1,12 @@
 #   BSD LICENSE
-# 
+#
 #   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
 #   All rights reserved.
-# 
+#
 #   Redistribution and use in source and binary forms, with or without
 #   modification, are permitted provided that the following conditions
 #   are met:
-# 
+#
 #     * Redistributions of source code must retain the above copyright
 #       notice, this list of conditions and the following disclaimer.
 #     * Redistributions in binary form must reproduce the above copyright
@@ -16,7 +16,7 @@
 #     * Neither the name of Intel Corporation nor the names of its
 #       contributors may be used to endorse or promote products derived
 #       from this software without specific prior written permission.
-# 
+#
 #   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 #   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 #   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -88,10 +88,24 @@ C_TO_O_CMD = 'cmd_$@ = $(C_TO_O_STR)'
 C_TO_O_DO = @set -e; \
        echo $(C_TO_O_DISP); \
        $(C_TO_O) && \
+       sh -c "grep -q \"PMD_REGISTER_DRIVER(.*)\" $<; \
+       if [ \$$? -eq 0 ]; then \
+               echo \"  PMDINFOGEN\" $@; \
+               OBJF=`readlink -f $@`; \
+               $(RTE_SDK_BIN)/app/pmdinfogen \$$OBJF \$$OBJF.pmd.c; \
+               if [ \$$? -eq 0 ]; \
+               then \
+                       echo \"  PMDINFOBUILD\" $@; \
+                       $(CC) $(CFLAGS) -c -o \$$OBJF.pmd.o \$$OBJF.pmd.c; \
+                       $(CROSS)ld $(LDFLAGS) -r -o \$$OBJF.o \$$OBJF.pmd.o \$$OBJF; \
+                       mv -f \$$OBJF.o \$$OBJF; \
+               fi; \
+       fi;" && \
        echo $(C_TO_O_CMD) > $(call obj2cmd,$(@)) && \
        sed 's,'$@':,dep_'$@' =,' $(call obj2dep,$(@)).tmp > $(call obj2dep,$(@)) && \
        rm -f $(call obj2dep,$(@)).tmp
 
+
 # return an empty string if string are equal
 compare = $(strip $(subst $(1),,$(2)) $(subst $(2),,$(1)))