Date:2010-08-02 18:27:10 (13 years 7 months ago)
Author:David Kühling
Commit:915bd101722435e175e15565ac58afe842dc4e09
Message:Make Gforth's built-in assembler/disassembler work on non-mips architectures. Added comments about how builds for 64-bit targets may currently fail.

Files: gforth/Makefile (8 diffs)

Change Details

gforth/Makefile
1818PKG_NAME:=gforth
1919PKG_SNAPSHOT_DATE=20100725
2020PKG_VERSION=0.7.0-$(PKG_SNAPSHOT_DATE)
21PKG_RELEASE:=10
21PKG_RELEASE:=11
2222
2323PKG_BUILD_DEPENDS:= gforth/host libltdl/host
2424PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
...... 
9292    $(call Host/Install/Default)
9393endef
9494
95# todo: skipcode=
96# todo: compiler options / tuning (openwrt sets bad defaults?)
97# todo: either gcc 3.4 or -Os makes primitives use doubly-indirect dispatch :(
98
9995## Configuration of the target gforth
10096FORTHSIZES=--dictionary-size=1M \
10197    --data-stack-size=16k \
...... 
110106## Here we call configure, then patch the cross-GForth source tree to replace
111107## the 'preforth' script with a script that calls our host-compiled GForth.
112108## We also extract the name of the GForth kernel image used for the target
113## architecture.
109## architecture, and the source files used by GForth for implementing the
110## assembler/disassembler for the target architecture.
114111define Build/Configure
115112    $(call Build/Configure/Default,)
116113    echo "@kernel_fi@" > $(PKG_BUILD_DIR)/kernel_fi.in
117114    cd $(PKG_BUILD_DIR) && ./config.status --file kernel_fi
115    echo "@asm_fs@ @disasm_fs@" > $(PKG_BUILD_DIR)/asm_fs.in
116    cd $(PKG_BUILD_DIR) && ./config.status --file asm_fs
118117    echo "#!/bin/sh" > $(CROSS_PREFORTH)
119118    echo "export LD_LIBRARY_PATH=$(STAGING_DIR_HOST)/lib;" >> $(CROSS_PREFORTH)
120119    echo '$(STAGING_DIR_HOST)/bin/gforth -i $(STAGING_DIR_HOST)/lib/gforth/$(PKG_VERSION)/gforth.fi "$$$$@"' >> $(CROSS_PREFORTH)
...... 
126125## compilation, then running the GForth binary through unit-tests. This won't
127126## work with a cross-compile environment.
128127##
129## todo: find out the correct kernel image and rename it 'kernel.fi', so we
130## can find it without adapting postinst script.
128## Todo: we currently always build the -ll-reg version of the engine. On
129## 64-bit architectures this might not work? Damn it, why is the check for
130## 'long long' in the Gforth Makefile, not the configure script?
131## Todo: develop a clean upstream patch to configure/Makefile
131132define Build/Compile
132133    $(MAKE) -C $(PKG_BUILD_DIR) kernel/version.fs gforth-ditc \
133134        engine/prim-fast.i engine/prim_lab-fast.i engine/prim_names-fast.i \
...... 
145146## define lists of GForth's sources to package for loading in the target system
146147##
147148
148STARTUP = exboot.fs startup.fs arch/mips/asm.fs arch/mips/disasm.fs
149
150149GFORTH_FI_SRC = \
151150    assert.fs \
152151    backtrac.fs \
...... 
192191    vt100.fs \
193192    vt100key.fs \
194193    wordinfo.fs \
194    arch/386/asm.fs arch/386/disasm.fs \
195    arch/amd64/asm.fs arch/amd64/disasm.fs \
196    arch/alpha/asm.fs arch/alpha/disasm.fs arch/alpha/testasm.fs\
197    arch/arm/asm.fs arch/arm/disasm.fs \
198    arch/arm/testdisasm.fs arch/arm/testdisasm.out arch/arm/Makefile \
195199    arch/mips/asm.fs arch/mips/disasm.fs arch/mips/insts.fs \
196    arch/mips/testasm.fs arch/mips/testdisasm.fs
200    arch/mips/testasm.fs arch/mips/testdisasm.fs \
201    arch/power/asm.fs arch/power/disasm.fs arch/power/inst.fs
197202
198203LIBCC_SRC = cstr.fs unix/socket.fs
199204LIBCC_DIST_SRC = libffi.fs fflib.fs $(LIBCC_SRC)
...... 
247252
248253FORTHKFLAGS= --die-on-signal -i kernel.fi
249254
255## make sure this is never evaluated before the configure step ran, else
256## $(shell) below is going to fail! We use the $(shell) to use the correct
257## Gforth assembler implementation that was chosen by gforth's configure
258## script, when building the forth image.
259STARTUP = exboot.fs startup.fs $(shell cat $(PKG_BUILD_DIR)/asm_fs)
260
250261## Directly after installation load the source once and generate a
251262## corresponding interpreter image. GForth needs that for quick startup.
252263define Package/gforth/postinst
...... 
263274
264275$(eval $(call HostBuild))
265276$(eval $(call BuildPackage,gforth))
277
278# The following comments configure the Emacs editor. Just ignore them.
279# Local Variables:
280# compile-command: "make -C ~/h/src/qi/openwrt-xburst package/gforth/compile -j2 V=99"
281# End:

Archive Download the corresponding diff file



interactive