1 # *****************************************************************************
2 # * Copyright (c) 2004, 2008 IBM Corporation
3 # * All rights reserved.
4 # * This program and the accompanying materials
5 # * are made available under the terms of the BSD License
6 # * which accompanies this distribution, and is available at
7 # * http://www.opensource.org/licenses/bsd-license.php
10 # * IBM Corporation - initial implementation
11 # ****************************************************************************/
14 MAKEARG = BOARD=$(BOARD) PLATFORM=$(PLATFORM) FLAG=$(FLAG) TARG=$(TARG)
16 BUILDS = tools_build romfs_build
21 RELEASE=$(shell cat ../VERSION)
22 export DRIVER_NAME=$(shell cat ../VERSION | sed -e "s/-/./g" | awk -F . '{ printf("%s%02d%02d%1s%02s",$$1,$$2,$$3,$$4,$$5); }')
24 ifneq (,$(wildcard ../.git))
25 RELEASE=git-$(shell git rev-parse --short=16 HEAD)
27 ifneq (,$(shell cat ../VERSION))
28 RELEASE="$(USER)@$(HOSTNAME) release $(shell cat ../VERSION)"
29 export DRIVER_NAME=HEAD
31 RELEASE="$(USER)@$(HOSTNAME)(private build)"
32 export DRIVER_NAME=HEAD
38 DRVDATE=$(shell date +%Y-%h%d)
40 FLASH_SIZE_MB = `echo $$[ $(FLASH_SIZE)/1024/1024 ]`
46 $(MAKE) -C $(LLFWBRDDIR) stage1.dis stage2.dis stageS.dis
49 @echo " ====== Building clients ======"
50 $(MAKE) -C ../clients $(MAKEARG)
53 $(MAKE) -C ../other-licence $(MAKEARG)
59 $(MAKE) -C ../romfs/tools $(MAKEARG)
62 @echo "$(CC)" > ../build_info.img
63 @$(CC) -v >> ../build_info.img 2>&1
64 @$(LD) -V >> ../build_info.img 2>&1
67 @if [ -e dts/$(SUBBOARD).dts ]; then \
68 dtc -q -I dts -O dtb dts/$(SUBBOARD).dts > $@; \
71 boot_rom.bin: $(BUILDS) ../build_info.img ../$(SUBBOARD).dtb
72 @echo " ====== Building $@ ======"
73 @if [ -e $(ROMFSBRDDIR)/boot_rom.$(SUBBOARD).ffs ]; then \
74 cat $(ROMFSBRDDIR)/boot_rom.$(SUBBOARD).ffs > ../.boot_rom.ffs; \
76 cat $(ROMFSBRDDIR)/boot_rom.ffs > ../.boot_rom.ffs; \
78 @if [ -e $(PCDBRDDIR)/pcdfiles.ffs ]; then \
79 cat $(PCDBRDDIR)/pcdfiles.ffs >> ../.boot_rom.ffs; \
81 cat $(SLOFBRDDIR)/OF.ffs >> ../.boot_rom.ffs
82 @echo build_info.img build_info.img 0 0 >> ../.boot_rom.ffs
83 @if [ -e ../$(SUBBOARD).dtb ]; then \
84 echo dtb $(SUBBOARD).dtb $(DTB_ROMFS_FLAG) \
85 $(DTB_ROMFS_ADDR) >> ../.boot_rom.ffs; \
87 cd .. && ./romfs/tools/build_romfs $(ROMFS_OPTIONS) .boot_rom.ffs $@
88 cd .. && if [ -f $@.gz ]; then rm -f $@.gz; gzip -9 $@ ; fi
89 rm -f ../.boot_rom.*ffs
90 rm -f ../$(SUBBOARD).dtb
93 external_flasher: ../boot_rom.bin
94 ../tools/make-flasher-image.sh $(FLASH_SIZE) ../boot_rom.bin \
95 ../boot_rom-$(FLASH_SIZE_MB)MB-BigEndian.bin
98 @rm -rf ../driver-$(RELEASE)
99 @mkdir -p ../driver-$(RELEASE)/{rom,l2b,disassemblies}
102 @echo "Building driver "$(RELEASE)" for $(BOARD)"
104 copy_disassemblies: llfw_disassembly
105 cp $(LLFWBRDDIR)/stage1.dis \
106 ../driver-$(RELEASE)/disassemblies/$(RELEASE)-stage1.dis
107 cp $(LLFWBRDDIR)/stage2.dis \
108 ../driver-$(RELEASE)/disassemblies/$(RELEASE)-stage2.dis
109 cp $(LLFWBRDDIR)/stageS.dis \
110 ../driver-$(RELEASE)/disassemblies/$(RELEASE)-stageS.dis
111 cp $(LLFWBRDDIR)/meminit.dis \
112 ../driver-$(RELEASE)/disassemblies/$(RELEASE)-meminit.dis
113 @if [ -e ../clients/snk/client.dis ]; then cp ../clients/snk/client.dis \
114 ../driver-$(RELEASE)/disassemblies/$(RELEASE)-client.dis; fi
116 copy_driver: copy_disassemblies external_flasher
117 mv ../boot_rom-$(FLASH_SIZE_MB)MB-BigEndian.bin \
118 ../driver-$(RELEASE)/rom/$(RELEASE)-boot_rom-$(FLASH_SIZE_MB)MB-BigEndian.bin
120 ../driver-$(RELEASE)/rom/$(RELEASE)-boot_rom.bin
121 if [ -e ../boot_l2-dd2.ad ]; then \
122 mv ../boot_l2-dd2.ad ../driver-$(RELEASE)/l2b/; \
124 mv ../boot_l2.ad ../driver-$(RELEASE)/l2b/; \
126 mv ../boot_xdr.bin ../driver-$(RELEASE)/l2b/
127 cp ../VERSION ../driver-$(RELEASE)
128 cd ../driver-$(RELEASE) && md5sum rom/*.bin > md5sum.txt
131 @cp -a ../driver-$(RELEASE) ../driver-$(RELEASE)-$(DRVDATE)-devel
132 tar czf ../driver-$(RELEASE)-$(DRVDATE)-devel.tar.gz \
133 ../driver-$(RELEASE)-$(DRVDATE)-devel > /dev/null 2>&1
134 @rm -rf ../driver-$(RELEASE)-$(DRVDATE)-devel
135 @rm -rf ../driver-$(RELEASE)/disassemblies
136 @mv ../driver-$(RELEASE) ../driver-$(RELEASE)-$(DRVDATE)
137 tar czf ../driver-$(RELEASE)-$(DRVDATE).tar.gz \
138 ../driver-$(RELEASE)-$(DRVDATE) > /dev/null 2>&1
139 @rm -rf ../driver-$(RELEASE)-$(DRVDATE)
142 @rm -f ../build_info.img
144 @rm -f ../$(SUBBOARD).dtb
147 $(MAKE) -C ../romfs/tools BOARD=$(BOARD) clean
148 $(MAKE) -C ../tools clean
149 $(MAKE) -C ../other-licence clean
150 $(MAKE) -C ../clients clean
151 @for dir in $(COMMON_LIBS); do \
152 $(MAKE) -C ../lib/$$dir clean || exit 1; \
155 distclean_gen: clean_top
156 $(MAKE) -C ../romfs/tools BOARD=$(BOARD) distclean
157 $(MAKE) -C ../tools distclean
158 $(MAKE) -C ../other-licence distclean
159 $(MAKE) -C ../clients distclean
160 @for dir in $(COMMON_LIBS); do \
161 $(MAKE) -C ../lib/$$dir distclean || exit 1; \
165 @echo " ====== Building common libraries ======"
166 $(MAKE) -C $(LIBCMNDIR) $(COMMON_LIBS)
169 $(MAKE) -C lib $(MAKEARG)