2 # "WikiReaderMakefile" - a Makefile for setting up Wiki Reader
4 # (C) Copyright 2008, 2009 OpenMoko, Inc.
5 # Author: xiangfu liu <xiangfu@openmoko.org>
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # version 3 as published by the Free Software Foundation.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 # Boston, MA 02110-1301, USA
21 BOOTLOADER_TTY ?
= $(shell echo
-n
/dev
/ttyUSB
&& [ -e
/dev
/ttyUSB1
] && echo
1 || echo
0)
23 # ----- Toolchain configuration data --------------------------------------
26 GCC_PACKAGE
=gcc-
$(GCC_VERSION
).
tar.gz
27 GCC_URL
=ftp
://ftp.gnu.org
/gnu
/gcc
/$(GCC_PACKAGE
)
29 BINUTILS_VERSION
=2.10.1
30 BINUTILS_PACKAGE
=binutils-
$(BINUTILS_VERSION
).
tar.gz
32 ftp
://ftp.gnu.org
/gnu
/binutils
/$(BINUTILS_PACKAGE
)
35 export PATH
:=$(PWD
)/install/bin
:$(PATH
)
37 # ----- configuration data --------------------------------------
48 bootloader
:mini-libc fatfs
52 bootloader232
:mini-libc fatfs
53 $(MAKE
) -C bootloader bootloader232
56 toppers
: mini-libc fatfs
59 $(MAKE
) -C wikireader
&& \
60 cp wikireader
/sample1.elf ..
/KERNEL.toppers
)
63 kernel
: mini-libc fatfs
66 cp mahatma.elf ..
/KERNEL
)
69 mahatma
: mini-libc fatfs
71 cp
-p kernel
/mahatma.elf KERNEL
73 # ----- lib stuff -------------------------------------------
76 $(MAKE
) -C toolchain
/mini-libc
/
83 # ----- toolchain stuff --------------------------------------
86 wget
-c
-O
$(DL
)/$(GCC_PACKAGE
) $(GCC_URL
)
91 wget
-c
-O
$(DL
)/$(BINUTILS_PACKAGE
) $(BINUTILS_URL
)
94 binutils-patch
: binutils-download
96 rm -rf toolchain
/binutils-
$(BINUTILS_PACKAGE
)
97 tar -xvzf
$(DL
)/$(BINUTILS_PACKAGE
) -C toolchain
/
99 cd binutils-
$(BINUTILS_VERSION
) && \
100 cat ..
/patches
/0001-binutils-EPSON-changes-to-binutils.patch | patch
-p1
&& \
101 cat ..
/patches
/0002-binutils-EPSON-make-it-compile-hack-for-recent-gcc.patch | patch
-p1
)
104 binutils
: binutils-patch
106 cd binutils-
$(BINUTILS_VERSION
) && \
109 CPPFLAGS
="-D_FORTIFY_SOURCE=0" ..
/configure
--prefix $(PWD
)/install --target
=c33-epson-elf
&& \
110 CPPFLAGS
="-D_FORTIFY_SOURCE=0" $(MAKE
) && \
114 gcc-patch
: gcc-download
116 tar -xvzf
$(DL
)/$(GCC_PACKAGE
) -C toolchain
/
118 cd gcc-
$(GCC_VERSION
) && \
119 cat ..
/patches
/0001-gcc-EPSON-modified-sources.patch | patch
-p1
&& \
120 cat ..
/patches
/0002-gcc-Force-that-the-assembly-of-libgcc-complies-wit.patch | patch
-p1
&& \
121 cat ..
/patches
/0003-gcc-Use-the-C-implementations-for-division-and-mod.patch | patch
-p1
)
124 gcc
: binutils gcc-patch
126 export PATH
=$(PWD
)/install/bin
:$(PATH
) && \
127 cd gcc-
$(GCC_VERSION
) && \
130 CPPFLAGS
="-D_FORTIFY_SOURCE=0" ..
/configure
--prefix $(PWD
)/install --target
=c33-epson-elf
--enable-languages
=c
&& \
131 CPPFLAGS
="-D_FORTIFY_SOURCE=0" $(MAKE
) && \
135 .PHONY
: simulator-qt4
137 ( cd host-tools
/simulator
/Qt4
/WikiSim
&& qmake-qt4
&& $(MAKE
) )
139 .PHONY
: simulator-console
141 ( cd host-tools
/simulator
/console
&& $(MAKE
) )
143 # ----- wiki Dump and Algorithm --------------------------------------
146 wget http
://download.wikimedia.org
/enwiki
/latest
/enwiki-latest-pages-articles.xml.bz2
150 svn
co -r
41057 http
://svn.webkit.org
/repository
/webkit
/trunk webkit
152 patch_path
="../host-tools/rendering/patches/"; for file in
`ls $$patch_path`; do echo
"processing file: $$file"; patch
-p1
< $$patch_path/$$file; done
&& \
153 .
/WebKitTools
/Scripts
/build-webkit
--gtk
--release
)
155 .PHONY
: flash-bootloader
156 flash-bootloader
: fatfs
157 $(MAKE
) -C bootloader BOOTLOADER_TTY
="${BOOTLOADER_TTY}" flash-bootloader
159 .PHONY
: print-flash-config
161 @echo BOOTLOADER_TTY
= "${BOOTLOADER_TTY}"
163 # ----- forth -----------------------------------------------
176 $(MAKE
) -C mbr mbr-rs232
180 $(MAKE
) -C bootloader rs232 e07load
/e07load
181 $(MAKE
) -C mbr BOOTLOADER_TTY
="${BOOTLOADER_TTY}" $@
183 # ----- clean and help --------------------------------------
184 .PHONY
: complete-clean
185 complete-clean
: clean clean-toolchain
188 clean: clean-sim-qt4 clean-sim-console
189 $(MAKE
) clean -C bootloader
190 $(MAKE
) clean -C toolchain
/mini-libc
191 $(MAKE
) clean -C fatfs
193 $(MAKE
) clean -C forth
194 $(MAKE
) clean -C kernel
195 cd jsp
&& $(MAKE
) clean -C wikireader
197 .PHONY
: clean-toolchain
199 rm -rf toolchain
/gcc-
$(GCC_VERSION
)
200 rm -rf toolchain
/binutils-
$(BINUTILS_VERSION
)
201 rm -f binutils-download binutils-patch binutils
202 rm -f gcc-download gcc-patch gcc
204 .PHONY
: clean-sim-qt4
206 (cd host-tools
/simulator
/Qt4
/WikiSim
; $(MAKE
) distclean || true
)
208 .PHONY
: clean-sim-console
210 $(MAKE
) clean -C host-tools
/simulator
/console
215 all: compile all the source.\n\
216 setup: get all the source we need.\n\
217 bootloader: compile bootloader.\n\
218 toppers: compile a toppers kernel.\n\
219 binutils: compile binutils.\n\
221 mini-libc: compile mini-libc (libc.a).\n\
222 flash-bootloader: flash bootloader to you E07 board\n\
223 -make sure the serial console is /dev/ttyUSB0.\n\
224 simulator-qt4 compile the Qt4 simulator\n\
225 simulator-console compile the console simulator\n\
231 $(MAKE
) --print-data-base
--question | \
232 awk
'/^[^.%][-A-Za-z0-9_]*:/ \
233 { print substr($$1, 1, length($$1)-1) }' | \
235 pr
--omit-pagination
--width
=80 --columns
=1