Root/gforth/Makefile

Source at commit c3604e02b2df9f8d6a806ebcf457438053c78298 created 13 years 8 months ago.
By David Kuehling, imported current gforth package from http://mosquito.dyndns.tv/freesvn/trunk/openwrt/gforth
1# Makefile for OpenWRT for cross-compiling GForth
2#
3# Copyright (C) 2010 David Kühling. License: GPLv2+
4
5include $(TOPDIR)/rules.mk
6
7PKG_NAME:=gforth
8PKG_VERSION:=0.7.0-20100725
9PKG_RELEASE:=3
10
11PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
12PKG_SOURCE_URL:=http://mosquito.dyndns.tv/~spock/
13PKG_MD5SUM:=f030bdfe42a9be32889d5b4c8cb37856
14
15PKG_BUILD_DEPENDS:= gforth/host libldtl/host
16PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
17
18include $(INCLUDE_DIR)/package.mk
19include $(INCLUDE_DIR)/host-build.mk
20
21# for now: override download and use local gforth sources
22# remove the prepare.stamp if updating tgz
23# define Build/Prepare
24# mkdir -p $(PKG_BUILD_DIR)
25# (cd $(PKG_BUILD_DIR)/.. && tar -xzvf -) < ~/forth/gforth/$(PKG_SOURCE)
26# endef
27# define Host/Prepare
28# mkdir -p $(HOST_BUILD_DIR)
29# (cd $(HOST_BUILD_DIR)/.. && tar -xzvf -) < ~/forth/gforth/$(PKG_SOURCE)
30# endef
31
32define Package/gforth
33  SECTION:=lang
34  CATEGORY:=Languages
35  TITLE:=GForth
36  DEPENDS:= +libltdl
37  URL:=http://www.gnu.org/software/gforth/
38endef
39
40define Package/gforth/description
41  Gforth is a fast and portable implementation of the ANS Forth
42  language.
43endef
44
45HOST_CONFIGURE_VARS += LTDL_LIBRARY_PATH=$(STAGING_DIR_HOST)/lib
46
47# found this in the libtool Makefile. does it help us?
48#export GLOBAL_LIBDIR=$(STAGING_DIR)/usr/lib
49
50define Host/Configure
51    export LD_LIBRARY_PATH=$(STAGING_DIR_HOST)/lib; $(call Host/Configure/Default)
52endef
53
54# define Host/Compile
55# $(MAKE) -C $(HOST_BUILD_DIR)
56# endef
57
58# define Host/Install
59# $(MAKE) -C $(HOST_BUILD_DIR) \
60# DESTDIR="$(STAGING_DIR_HOST)" \
61# install
62# endef
63
64# todo: skipcode=
65# todo: compiler options / tuning (openwrt sets bad defaults?)
66
67define Build/Configure
68    $(call Build/Configure/Default,)
69    echo "#!/bin/sh" > $(PKG_BUILD_DIR)/preforth
70    echo '$(STAGING_DIR_HOST)/bin/gforth -i $(STAGING_DIR_HOST)/lib/gforth/$(PKG_VERSION)/gforth.fi "$$$$@"' >> $(PKG_BUILD_DIR)/preforth
71    chmod a+x $(PKG_BUILD_DIR)/preforth
72endef
73
74define Build/Compile
75    $(MAKE) -C $(PKG_BUILD_DIR) kernel/version.fs gforth-ditc \
76        engine/prim-fast.i engine/prim_lab-fast.i engine/prim_names-fast.i \
77        engine/prim_superend-fast.i engine/profile-fast.i \
78        engine/prim_num-fast.i engine/prim_grp-fast.i \
79        engine/costs-fast.i engine/super2-fast.i
80    $(MAKE) -C $(PKG_BUILD_DIR)/engine gforth-fast-ll-reg gforth-ll-reg \
81        OPT=-ll-reg OPTDEFINES="-DFORCE_LL -DFORCE_REG" OPTOBJECTS=
82    cd $(PKG_BUILD_DIR) && \
83            cp engine/gforth-ll-reg ./gforth && \
84        cp engine/gforth-fast-ll-reg ./gforth-fast
85endef
86
87STARTUP = exboot.fs startup.fs arch/mips/asm.fs arch/mips/disasm.fs
88
89GFORTH_FI_SRC = \
90    assert.fs \
91    backtrac.fs \
92    blocked.fb \
93    blocks.fs \
94    bufio.fs \
95    code.fs \
96    debug.fs \
97    debugs.fs \
98    dis-gdb.fs \
99    ekey.fs \
100    envos.fs \
101    savesys.fs \
102    environ.fs \
103    errors.fs \
104    exboot.fs \
105    except.fs \
106    extend.fs \
107    float.fs \
108    glocals.fs \
109    hash.fs \
110    history.fs \
111    intcomp.fs \
112    mkdir.fs \
113    libcc.fs \
114    locals.fs \
115    look.fs \
116    mkdir.fs \
117    prelude.fs \
118    quotes.fs \
119    search.fs \
120    see.fs \
121    see-ext.fs \
122    simp-see.fs \
123    source.fs \
124    startup.fs \
125    struct.fs \
126    struct0x.fs \
127    stuff.fs \
128    tasker.fs \
129    termsize.fs \
130    utf-8.fs \
131    vt100.fs \
132    vt100key.fs \
133    wordinfo.fs \
134    arch/mips/asm.fs arch/mips/disasm.fs arch/mips/insts.fs \
135    arch/mips/testasm.fs arch/mips/testdisasm.fs
136
137LIBCC_SRC = cstr.fs unix/socket.fs
138LIBCC_DIST_SRC = libffi.fs fflib.fs $(LIBCC_SRC)
139
140# todo: strip down
141FORTH_SRC = $(GFORTH_FI_SRC) $(LIBCC_DIST_SRC) \
142    ans-report.fs ansi.fs answords.fs \
143    colorize.fs comp-i.fs complex.fs \
144    depth-changes.fs dosekey.fs doskey.fs ds2texi.fs \
145    envos.dos envos.os2 etags.fs fft.fs filedump.fs fi2c.fs \
146    fsl-util.4th glosgen.fs gray.fs httpd.fs install-tags.fs \
147    make-app.fs doc/makedoc.fs locate.fs more.fs onebench.fs \
148    other.fs prims2x.fs prims2x0.6.2.fs proxy.fs random.fs \
149    regexp.fs sokoban.fs string.fs table.fs tags.fs \
150    tt.fs \
151    unbuffer.fs wordsets.fs xwords.fs \
152    test/tester.fs test/ttester.fs \
153    test/coretest.fs test/postpone.fs test/dbltest.fs \
154    test/string.fs test/float.fs test/search.fs test/gforth.fs \
155    test/other.fs test/signals.fs test/checkans.fs \
156    test/primtest.fs test/coreext.fs test/deferred.fs \
157    test/coremore.fs test/gforth-nofast.fs test/libcc.fs \
158    test/macros.fs \
159    compat/strcomp.fs \
160    bubble.fs siev.fs matrix.fs fib.fs \
161    oof.fs oofsampl.fs objects.fs objexamp.fs mini-oof.fs moof-exm.fs \
162    moofglos.fs fixpath.fs \
163    add.fs lib.fs oldlib.fs sieve.fs \
164    endtry-iferror.fs recover-endtry.fs
165
166FS_INSTALL_DIR=/usr/share/gforth/$(PKG_VERSION)
167
168define Package/gforth/install
169    $(INSTALL_DIR) $(1)/usr/bin
170    $(INSTALL_DIR) $(1)/usr/lib/gforth
171    $(INSTALL_DIR) $(1)/$(FS_INSTALL_DIR)
172    $(INSTALL_DIR) $(1)/usr/share/gforth/site-forth
173    $(INSTALL_BIN) $(PKG_BUILD_DIR)/gforth-fast $(1)/usr/bin/gforth-fast-bin
174    $(INSTALL_BIN) $(PKG_BUILD_DIR)/gforth $(1)/usr/bin/gforth-bin
175    $(INSTALL_BIN) files/gforth $(1)/usr/bin/gforth
176    $(INSTALL_BIN) files/gforth $(1)/usr/bin/gforth-fast
177    $(INSTALL_DATA) $(PKG_BUILD_DIR)/kernl32l.fi $(1)/$(FS_INSTALL_DIR)
178    $(INSTALL_DATA) $(PKG_BUILD_DIR)/siteinit.fs $(1)/usr/share/gforth/site-forth
179    $(call pkg_install_files,$(FORTH_SRC),$(PKG_BUILD_DIR),$(1)/$(FS_INSTALL_DIR))
180endef
181
182$(eval $(call HostBuild))
183$(eval $(call BuildPackage,gforth))
184

Archive Download this file



interactive