]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - dts/Makefile
Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / dts / Makefile
index b1f47a19103f5f43f759fb36b74850240b483545..03e163ef0aecaa9af9ab0812e85a781187dfdb13 100644 (file)
@@ -27,17 +27,21 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)libdts.o
 
+ifeq ($(DEVICE_TREE),)
 $(if $(CONFIG_DEFAULT_DEVICE_TREE),,\
 $(error Please define CONFIG_DEFAULT_DEVICE_TREE in your board header file))
 DEVICE_TREE = $(subst ",,$(CONFIG_DEFAULT_DEVICE_TREE))
+endif
 
 $(if $(CONFIG_ARCH_DEVICE_TREE),,\
 $(error Your architecture does not have device tree support enabled. \
 Please define CONFIG_ARCH_DEVICE_TREE))
 
 # We preprocess the device tree file provide a useful define
-DTS_CPPFLAGS := -DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\" \
-               -DBOARD_DTS=\"$(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts/$(DEVICE_TREE).dts\"
+DTS_CPPFLAGS := -x assembler-with-cpp \
+               -DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\" \
+               -DBOARD_DTS=\"$(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts/$(DEVICE_TREE).dts\" \
+               -I$(SRCTREE)/board/$(VENDOR)/dts -I$(SRCTREE)/arch/$(ARCH)/dts
 
 all:   $(obj).depend $(LIB)
 
@@ -52,7 +56,7 @@ $(DT_BIN): $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
                { { $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} - 2>&1 ; \
                    echo $$? >&3 ; } | \
                  grep -v '^DTC: dts->dtb  on file' ; \
-               } 3>&1 ) ; \
+               } 3>&1 1>&2 ) ; \
        exit $$rc
 
 process_lds = \
@@ -67,8 +71,9 @@ $(obj)dt.o: $(DT_BIN)
        # We look in the LDSCRIPT first.
        # Then try the linker which should give us the answer.
        # Then check it worked.
-       oformat=`$(call process_lds,cat $(LDSCRIPT),FORMAT)` ;\
-       oarch=`$(call process_lds,cat $(LDSCRIPT),ARCH)` ;\
+       [ -n "$(LDSCRIPT)" ] && \
+               oformat=`$(call process_lds,cat $(LDSCRIPT),FORMAT)` && \
+               oarch=`$(call process_lds,cat $(LDSCRIPT),ARCH)` ;\
        \
        [ -z $${oformat} ] && \
                oformat=`$(call process_lds,$(GET_LDS),FORMAT)` ;\