1: #Makefile for the C part of Gforth
2:
3: #Copyright (C) 1995,1996,1997,1998,2000,2003,2006 Free Software Foundation, Inc.
4:
5: #This file is part of Gforth.
6:
7: #Gforth is free software; you can redistribute it and/or
8: #modify it under the terms of the GNU General Public License
9: #as published by the Free Software Foundation; either version 2
10: #of the License, or (at your option) any later version.
11:
12: #This program is distributed in the hope that it will be useful,
13: #but WITHOUT ANY WARRANTY; without even the implied warranty of
14: #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.#See the
15: #GNU General Public License for more details.
16:
17: #You should have received a copy of the GNU General Public License
18: #along with this program; if not, write to the Free Software
19: #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
20:
21: # ------------- gforth version
22:
23: VERSION =@PACKAGE_VERSION@
24: DOSVERSION=`echo $VERSION|sed 's/\.//g'`
25: EXE=@EXEEXT@
26:
27: # ------------- System specific variables
28:
29: machine=@machine@
30: kernel_fi = @kernel_fi@
31: include_fi = @include_fi@
32: # this is the type of machine
33: # used to extend the include path with ./arch/$machine
34: # so we could include a machine specific
35: # machine.h file
36:
37: PATHSEP = @PATHSEP@
38:
39: osclass = @OSCLASS@
40:
41: EC = @EC@
42:
43: # ------------- Utility programs
44:
45: SHELL = /bin/sh
46: RM = rm
47: RMTREE = rm -rf
48: CP = cp -p
49: TAR = tar cf -
50: GCC = @CC@
51: CC = $(GCC)
52: STRIP = strip
53:
54: FORTHPATH = .$(PATHSEP)$(libdir)/gforth/site-forth$(PATHSEP)$(datadir)/gforth/site-forth$(PATHSEP)$(libdir)/gforth/$(VERSION)$(PATHSEP)$(datadir)/gforth/$(VERSION)
55:
56: # ------------ Install Directorys
57:
58: VPATH = @srcdir@
59: prefix = @prefix@
60: exec_prefix = @exec_prefix@
61: srcdir = @srcdir@
62: bindir = $(exec_prefix)/bin
63: #read-only architecture-independent files
64: datadir = $(prefix)/share
65: #read-only architecture-dependent non-ascii files
66: libdir = $(prefix)/lib
67: infodir = $(prefix)/info
68: mandir = $(prefix)/man
69: man1dir= $(mandir)/man1
70: man1ext= .1
71:
72: # ------------- Compiler Flags
73:
74: XCFLAGS = @CFLAGS@
75: XDEFINES = @DEFS@
76: SWITCHES = $(XCFLAGS) $(XDEFINES)
77: #use -fno-inline to avoid register problems with asinh, atanh on gcc-3.3 on 386
78: ENGINE_FLAGS = @ENGINE_FLAGS@ -fno-defer-pop -fcaller-saves -fno-inline
79: DEBUGFLAG = @DEBUGFLAG@
80: CFLAGS = $(DEBUGFLAG) -I$(srcdir)/../arch/$(machine) -I. -Wall $(SWITCHES) -DDEFAULTPATH='"$(FORTHPATH)"'
81: CFLAGS2 = $(DEBUGFLAG) -I$(srcdir)/../arch/$(machine) -I. -Wall $(SWITCHES) -DDEFAULTPATH='"$(FORTHPATH)"'
82: FORTHKFLAGS= --die-on-signal -p "..$(PATHSEP)$(srcdir)" -i ../$(kernel_fi)
83: FORTHK = ../gforth $(FORTHKFLAGS)
84: FORTH = ../gforth --die-on-signal -p "..$(PATHSEP)$(srcdir)" -i ../gforth.fi
85:
86: #John Wavrik should use -Xlinker -N to get a writable text (executable)
87: XLDFLAGS = @LDFLAGS@
88: LDFLAGS = $(DEBUGFLAG) $(XLDFLAGS)
89: LDLIBS = @LIBS@
90:
91: AOBJECTS = io.o signals.o support.o @LIBOBJS@
92:
93: OBJECTS = engine.o @engine2@ main.o
94: OBJECTS_NATIVE = engine-native.o engine-native2.o engine-native3.o main-native.o
95: OBJECTS_FAST = engine-fast.o @engine_fast2@ main-fast.o
96: OBJECTS_ITC = engine-itc.o main-itc.o
97: OBJECTS_DITC = engine-ditc.o main-ditc.o
98: OBJECTS_PROF = engine-prof.o main-prof.o
99: OBJECTS_FI = engine.o main-fi.o
100:
101: # In engine subdirectory there are (or should be) only files that belong to
102: # our engine, so we can make life easy
103: DEPS = config.h *.h $(srcdir)/../arch/$(machine)/*.[h]
104: ENGINE_DEPS = engine.c $(DEPS) prim_lab.i prim.i @image_i@
105: MAIN_DEPS = main.c $(DEPS) prim_superend.i prim_num.i prim_grp.i costs.i super2.i
106: ENGINE_FAST_DEPS = engine.c $(DEPS) prim_lab-fast.i prim-fast.i
107: MAIN_FAST_DEPS = main.c $(DEPS) prim_superend-fast.i prim_num-fast.i prim_grp-fast.i costs-fast.i super2-fast.i
108:
109: #some makes don't do the -o $@ correctly, so we help them
110: .c.o:
111: $(GCC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
112:
113: support.o: support.c config.h forth.h longlong.h
114:
115: gforth$(EC)$(EXE): $(OBJECTS) $(AOBJECTS)
116: $(GCC) $(LDFLAGS) $(OBJECTS) $(AOBJECTS) $(LDLIBS) -o $@
117:
118: gforth-native$(EC)$(EXE): $(OBJECTS_NATIVE) $(AOBJECTS)
119: $(GCC) $(LDFLAGS) $(OBJECTS_NATIVE) $(AOBJECTS) $(LDLIBS) -o $@
120:
121: gforth-fast$(EC)$(EXE): $(OBJECTS_FAST) $(AOBJECTS)
122: $(GCC) $(LDFLAGS) $(OBJECTS_FAST) $(AOBJECTS) $(LDLIBS) -o $@
123:
124: gforth-itc$(EC)$(EXE): $(OBJECTS_ITC) $(AOBJECTS)
125: $(GCC) $(LDFLAGS) $(OBJECTS_ITC) $(AOBJECTS) $(LDLIBS) -o $@
126:
127: gforth-ditc$(EC)$(EXE): $(OBJECTS_DITC) $(AOBJECTS)
128: $(GCC) $(LDFLAGS) $(OBJECTS_DITC) $(AOBJECTS) $(LDLIBS) -o $@
129:
130: gforth-prof$(EC)$(EXE): $(OBJECTS_PROF) $(AOBJECTS) profile.o
131: $(GCC) $(LDFLAGS) $(OBJECTS_PROF) $(AOBJECTS) profile.o $(LDLIBS) -o $@
132:
133: gforth-fi$(EC)$(EXE): $(OBJECTS_FI) $(AOBJECTS)
134: $(GCC) $(LDFLAGS) $(OBJECTS_FI) $(AOBJECTS) $(LDLIBS) -o $@
135:
136: engine.s: $(ENGINE_FAST_DEPS)
137: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -S $(srcdir)/engine.c
138:
139: engine.o: $(ENGINE_DEPS)
140: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DGFORTH_DEBUGGING -o $@ -c $(srcdir)/engine.c
141:
142: engine2.o: $(ENGINE_DEPS)
143: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DGFORTH_DEBUGGING -DENGINE=2 -o $@ -c $(srcdir)/engine.c
144:
145: engine-native.o:$(ENGINE_FAST_DEPS)
146: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DNO_IP -o $@ -c $(srcdir)/engine.c
147:
148: engine-native2.o:$(ENGINE_FAST_DEPS)
149: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DNO_IP -DENGINE=2 -o $@ -c $(srcdir)/engine.c
150:
151: engine-native3.o:$(ENGINE_FAST_DEPS)
152: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DNO_IP -DENGINE=3 -o $@ -c $(srcdir)/engine.c
153:
154: engine-fast.o: $(ENGINE_FAST_DEPS)
155: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -o $@ -c $(srcdir)/engine.c
156:
157: engine-fast2.o: $(ENGINE_FAST_DEPS)
158: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DENGINE=2 -o $@ -c $(srcdir)/engine.c
159:
160: engine-itc.o: $(ENGINE_DEPS)
161: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DINDIRECT_THREADED -DGFORTH_DEBUGGING -o $@ -c $(srcdir)/engine.c
162:
163: engine-ditc.o: $(ENGINE_DEPS)
164: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DDOUBLY_INDIRECT -o $@ -c $(srcdir)/engine.c
165:
166: engine-prof.o: $(ENGINE_DEPS)
167: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DVM_PROFILING -o $@ -c $(srcdir)/engine.c
168:
169: main.o: $(MAIN_DEPS)
170: $(GCC) $(CFLAGS) -DGFORTH_DEBUGGING @no_dynamic@ -o $@ -c $(srcdir)/main.c
171:
172: main-native.o: $(MAIN_FAST_DEPS)
173: $(GCC) $(CFLAGS) -DNO_IP -o $@ -c $(srcdir)/main.c
174:
175: main-fast.o: $(MAIN_FAST_DEPS)
176: $(GCC) $(CFLAGS) -o $@ -c $(srcdir)/main.c
177:
178: main-itc.o: $(MAIN_DEPS)
179: $(GCC) $(CFLAGS) -DINDIRECT_THREADED -DGFORTH_DEBUGGING -o $@ -c $(srcdir)/main.c
180:
181: main-ditc.o: $(MAIN_DEPS)
182: $(GCC) $(CFLAGS) -DDOUBLY_INDIRECT -o $@ -c $(srcdir)/main.c
183:
184: main-prof.o: $(MAIN_DEPS)
185: $(GCC) $(CFLAGS) -DVM_PROFILING -o $@ -c $(srcdir)/main.c
186:
187: main-fi.o: $(MAIN_DEPS)
188: $(GCC) $(CFLAGS) -DINCLUDE_IMAGE -o $@ -c $(srcdir)/main.c
189:
190: peephole.o: peephole.c peephole.i $(DEPS)
191: $(GCC) $(CFLAGS) -o $@ -c $(srcdir)/peephole.c
192:
193: profile.o: profile.c profile.i $(DEPS)
194: $(GCC) $(CFLAGS) -o $@ -c $(srcdir)/profile.c
195:
196: #The next two rules seem to be superfluous:
197:
198: # engine: $(OBJECTS) $(OBJECTS0) ;
199:
200: # engine_ditc: $(OBJECTS_DITC) $(OBJECTS0) ;
201:
202: #NeXTstep hack
203:
204: termios.o: /usr/lib/libposix.a
205: ar x /usr/lib/libposix.a termios.o
206:
207: #duplicated rules to avoid too many recursive make invocations
208: # !! No any forth stuff should be done in ../Makefile.
209: # !! I added the dependencies on prim.i and prim_lab.i in the main Makefile, jens
210:
211: #I commented out the following rules because they are no longer up-to-date. - anton
212:
213: #prim.i: ../prim.b ../prims2x.fs
214: # $(FORTHK) prims2x.fs -e "s\" ../prim.b\" ' output-c process-file bye" >$@-
215: # $(CP) $@- $@
216: # $(RM) $@-
217: #
218: #prim_lab.i: ../prim.b ../prims2x.fs
219: # $(FORTHK) prims2x.fs -e "s\" ../prim.b\" ' output-label process-file bye" >$@-
220: # $(CP) $@- $@
221: # $(RM) $@-
222:
223: config.h: stamp-h
224: stamp-h: config.h.in ../config.status ../stamp-h.in
225: cd .. && CONFIG_FILES=$@ CONFIG_HEADERS=engine/config.h ./config.status
226: echo timestamp > stamp-h
227:
228: image.i: ../fi2c.fs ../$(include_fi)
229: $(FORTH) fi2c.fs -e "s\" ../$(include_fi)\" fi2c bye" >$@
230:
231: ../$(include_fi): FORCE
232: cd .. && $(MAKE) $(include_fi)
233:
234: #phony targets depend on FORCE; this is more portable than .PHONY
235: FORCE:
236:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>