111569Sgabor.dozsa@arm.com# Copyright (c) 2015-2016 ARM Limited
211348Sandreas.sandberg@arm.com# All rights reserved.
311348Sandreas.sandberg@arm.com#
411348Sandreas.sandberg@arm.com# Redistribution and use in source and binary forms, with or without
511348Sandreas.sandberg@arm.com# modification, are permitted provided that the following conditions are
611348Sandreas.sandberg@arm.com# met: redistributions of source code must retain the above copyright
711348Sandreas.sandberg@arm.com# notice, this list of conditions and the following disclaimer;
811348Sandreas.sandberg@arm.com# redistributions in binary form must reproduce the above copyright
911348Sandreas.sandberg@arm.com# notice, this list of conditions and the following disclaimer in the
1011348Sandreas.sandberg@arm.com# documentation and/or other materials provided with the distribution;
1111348Sandreas.sandberg@arm.com# neither the name of the copyright holders nor the names of its
1211348Sandreas.sandberg@arm.com# contributors may be used to endorse or promote products derived from
1311348Sandreas.sandberg@arm.com# this software without specific prior written permission.
1411348Sandreas.sandberg@arm.com#
1511348Sandreas.sandberg@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1611348Sandreas.sandberg@arm.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1711348Sandreas.sandberg@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1811348Sandreas.sandberg@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1911348Sandreas.sandberg@arm.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2011348Sandreas.sandberg@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2111348Sandreas.sandberg@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2211348Sandreas.sandberg@arm.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2311348Sandreas.sandberg@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2411348Sandreas.sandberg@arm.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2511348Sandreas.sandberg@arm.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2611348Sandreas.sandberg@arm.com#
2711348Sandreas.sandberg@arm.com# Authors: Andreas Sandberg
2811348Sandreas.sandberg@arm.com
2911348Sandreas.sandberg@arm.comCPP?=cpp
3011348Sandreas.sandberg@arm.comDTC?=dtc
3111348Sandreas.sandberg@arm.com
3211348Sandreas.sandberg@arm.comDTC_CPP_FLAGS=-nostdinc -undef
3311348Sandreas.sandberg@arm.com
3414146Schunchenhsu@google.com# $(1) is the prefix of DTB files
3514146Schunchenhsu@google.comNUM_CPUS := 1 2 4 8 16
3614146Schunchenhsu@google.comCREATE_TARGET=$(foreach n, $(NUM_CPUS), $(1)_$(n)cpu.dtb)
3714146Schunchenhsu@google.com
3814146Schunchenhsu@google.comTARGET_PREFIX=\
3914146Schunchenhsu@google.com	armv7_gem5_v1 \
4014146Schunchenhsu@google.com	armv8_gem5_v1 \
4114146Schunchenhsu@google.com	armv8_gem5_v2
4214146Schunchenhsu@google.com
4311348Sandreas.sandberg@arm.comTARGETS=\
4414146Schunchenhsu@google.com	$(foreach prefix, $(TARGET_PREFIX), $(call CREATE_TARGET, $(prefix))) \
4511569Sgabor.dozsa@arm.com	armv8_gem5_v1_big_little_2_2.dtb \
4614146Schunchenhsu@google.com	armv8_gem5_v1_big_little_2_4.dtb
4711348Sandreas.sandberg@arm.com
4813668Skevin.brodsky@arm.comVEXPRESS_GEM5_V1_DTSIS=\
4913668Skevin.brodsky@arm.com	platforms/vexpress_gem5_v1.dtsi \
5013668Skevin.brodsky@arm.com	platforms/vexpress_gem5_v1_base.dtsi
5113668Skevin.brodsky@arm.com
5213668Skevin.brodsky@arm.comVEXPRESS_GEM5_V2_DTSIS=\
5313668Skevin.brodsky@arm.com	platforms/vexpress_gem5_v2.dtsi \
5413668Skevin.brodsky@arm.com	platforms/vexpress_gem5_v2_base.dtsi
5513668Skevin.brodsky@arm.com
5611348Sandreas.sandberg@arm.comGEN_DTS=mkdir -p .gen; \
5711348Sandreas.sandberg@arm.com	$(CPP) -x assembler-with-cpp \
5811348Sandreas.sandberg@arm.com		$(DTC_CPP_FLAGS) \
5911348Sandreas.sandberg@arm.com		-DCONF_PLATFORM=\"platforms/$(1)\" \
6011348Sandreas.sandberg@arm.com		-DCONF_CPUS=$(2) \
6111348Sandreas.sandberg@arm.com		-o $@ $<
6211348Sandreas.sandberg@arm.com
6311348Sandreas.sandberg@arm.comall: $(TARGETS)
6411348Sandreas.sandberg@arm.com
6513668Skevin.brodsky@arm.com.gen/armv7_gem5_v1_%cpu.dts: armv7.dts $(VEXPRESS_GEM5_V1_DTSIS)
6611348Sandreas.sandberg@arm.com	$(call GEN_DTS,vexpress_gem5_v1.dtsi,$*)
6711348Sandreas.sandberg@arm.com
6813668Skevin.brodsky@arm.com.gen/armv8_gem5_v1_%cpu.dts: armv8.dts $(VEXPRESS_GEM5_V1_DTSIS)
6911348Sandreas.sandberg@arm.com	$(call GEN_DTS,vexpress_gem5_v1.dtsi,$*)
7011348Sandreas.sandberg@arm.com
7113668Skevin.brodsky@arm.com.gen/armv8_gem5_v2_%cpu.dts: armv8.dts $(VEXPRESS_GEM5_V2_DTSIS)
7213510Sjairo.balart@metempsy.com	$(call GEN_DTS,vexpress_gem5_v2.dtsi,$*)
7313510Sjairo.balart@metempsy.com
7411569Sgabor.dozsa@arm.com.gen/armv8_gem5_v1_big_little%.dts: armv8_big_little.dts \
7513668Skevin.brodsky@arm.com	$(VEXPRESS_GEM5_V1_DTSIS)
7611569Sgabor.dozsa@arm.com	$(call GEN_DTS,vexpress_gem5_v1.dtsi,$*)
7711569Sgabor.dozsa@arm.com
7811348Sandreas.sandberg@arm.com%.dtb: .gen/%.dts
7911348Sandreas.sandberg@arm.com	$(DTC) -I dts -O dtb -o $@ $<
8011348Sandreas.sandberg@arm.com
8111348Sandreas.sandberg@arm.com
8211348Sandreas.sandberg@arm.comclean:
8311348Sandreas.sandberg@arm.com	$(RM) -r .gen
8411348Sandreas.sandberg@arm.com	$(RM) *.dtb
85