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 --------------------------------------
47 bootloader
:mini-libc fatfs
51 bootloader232
:mini-libc fatfs
52 $(MAKE
) -C bootloader bootloader232
55 toppers
: mini-libc fatfs
58 $(MAKE
) -C wikireader
&& \
59 cp wikireader
/sample1.elf ..
/KERNEL.toppers
)
62 kernel
: mini-libc fatfs
65 cp mahatma.elf ..
/KERNEL
)
68 mahatma
: mini-libc fatfs
70 cp
-p kernel
/mahatma.elf KERNEL
72 # ----- lib stuff -------------------------------------------
75 $(MAKE
) -C toolchain
/mini-libc
/
82 # ----- toolchain stuff --------------------------------------
85 wget
-c
-O
$(DL
)/$(GCC_PACKAGE
) $(GCC_URL
)
90 wget
-c
-O
$(DL
)/$(BINUTILS_PACKAGE
) $(BINUTILS_URL
)
93 binutils-patch
: binutils-download
95 rm -rf toolchain
/binutils-
$(BINUTILS_PACKAGE
)
96 tar -xvzf
$(DL
)/$(BINUTILS_PACKAGE
) -C toolchain
/
98 cd binutils-
$(BINUTILS_VERSION
) && \
99 cat ..
/patches
/0001-binutils-EPSON-changes-to-binutils.patch | patch
-p1
&& \
100 cat ..
/patches
/0002-binutils-EPSON-make-it-compile-hack-for-recent-gcc.patch | patch
-p1
)
103 binutils
: binutils-patch
105 cd binutils-
$(BINUTILS_VERSION
) && \
108 CPPFLAGS
="-D_FORTIFY_SOURCE=0" ..
/configure
--prefix $(PWD
)/install --target
=c33-epson-elf
&& \
109 CPPFLAGS
="-D_FORTIFY_SOURCE=0" $(MAKE
) && \
113 gcc-patch
: gcc-download
115 tar -xvzf
$(DL
)/$(GCC_PACKAGE
) -C toolchain
/
117 cd gcc-
$(GCC_VERSION
) && \
118 cat ..
/patches
/0001-gcc-EPSON-modified-sources.patch | patch
-p1
&& \
119 cat ..
/patches
/0002-gcc-Force-that-the-assembly-of-libgcc-complies-wit.patch | patch
-p1
&& \
120 cat ..
/patches
/0003-gcc-Use-the-C-implementations-for-division-and-mod.patch | patch
-p1
)
123 gcc
: binutils gcc-patch
125 export PATH
=$(PWD
)/install/bin
:$(PATH
) && \
126 cd gcc-
$(GCC_VERSION
) && \
129 CPPFLAGS
="-D_FORTIFY_SOURCE=0" ..
/configure
--prefix $(PWD
)/install --target
=c33-epson-elf
--enable-languages
=c
&& \
130 CPPFLAGS
="-D_FORTIFY_SOURCE=0" $(MAKE
) && \
134 .PHONY
: simulator-qt4
136 ( cd host-tools
/simulator
/SimulatorQt4
&& qmake-qt4
&& $(MAKE
) )
138 # ----- wiki Dump and Algorithm --------------------------------------
141 wget http
://download.wikimedia.org
/enwiki
/latest
/enwiki-latest-pages-articles.xml.bz2
145 svn
co -r
41057 http
://svn.webkit.org
/repository
/webkit
/trunk webkit
147 patch_path
="../host-tools/rendering/patches/"; for file in
`ls $$patch_path`; do echo
"processing file: $$file"; patch
-p1
< $$patch_path/$$file; done
&& \
148 .
/WebKitTools
/Scripts
/build-webkit
--gtk
--release
)
150 .PHONY
: flash-bootloader
151 flash-bootloader
: fatfs
152 $(MAKE
) -C bootloader BOOTLOADER_TTY
="${BOOTLOADER_TTY}" flash-bootloader
154 .PHONY
: print-flash-config
156 @echo BOOTLOADER_TTY
= "${BOOTLOADER_TTY}"
158 # ----- forth -----------------------------------------------
171 $(MAKE
) -C mbr mbr-rs232
175 $(MAKE
) -C bootloader rs232 e07load
/e07load
176 $(MAKE
) -C mbr BOOTLOADER_TTY
="${BOOTLOADER_TTY}" $@
178 # ----- clean and help --------------------------------------
179 .PHONY
: complete-clean
180 complete-clean
: clean clean-toolchain
184 $(MAKE
) clean -C bootloader
185 $(MAKE
) clean -C toolchain
/mini-libc
186 $(MAKE
) clean -C fatfs
188 $(MAKE
) clean -C forth
189 $(MAKE
) clean -C kernel
190 cd jsp
&& $(MAKE
) clean -C wikireader
192 .PHONY
: clean-toolchain
194 rm -rf toolchain
/gcc-
$(GCC_VERSION
)
195 rm -rf toolchain
/binutils-
$(BINUTILS_VERSION
)
196 rm -f binutils-download binutils-patch binutils
197 rm -f gcc-download gcc-patch gcc
199 .PHONY
: clean-sim-qt4
201 (cd host-tools
/simulator
/Qt4
/WikiSim
; $(MAKE
) distclean || true
)
206 all: compile all the source.\n\
207 setup: get all the source we need.\n\
208 bootloader: compile bootloader.\n\
209 toppers: compile a toppers kernel.\n\
210 binutils: compile binutils.\n\
212 mini-libc: compile mini-libc (libc.a).\n\
213 flash-bootloader: flash bootloader to you E07 board\n\
214 -make sure the serial console is /dev/ttyUSB0.\n\
215 simulator-qt4 compile the Qt4 simulator\n\
221 $(MAKE
) --print-data-base
--question | \
222 awk
'/^[^.%][-A-Za-z0-9_]*:/ \
223 { print substr($$1, 1, length($$1)-1) }' | \
225 pr
--omit-pagination
--width
=80 --columns
=1