1: #Makefile for the C part of Gforth
2:
3: #Copyright (C) 1995,1996,1997,1998,2000,2003 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=gforth.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: # ------------- Utility programs
42:
43: SHELL = /bin/sh
44: RM = rm
45: RMTREE = rm -rf
46: CP = cp -p
47: TAR = tar cf -
48: GCC = @CC@
49: CC = $(GCC)
50: STRIP = strip
51:
52: FORTHPATH = .$(PATHSEP)$(libdir)/gforth/site-forth$(PATHSEP)$(datadir)/gforth/site-forth$(PATHSEP)$(libdir)/gforth/$(VERSION)$(PATHSEP)$(datadir)/gforth/$(VERSION)
53:
54: # ------------ Install Directorys
55:
56: VPATH = @srcdir@
57: prefix = @prefix@
58: exec_prefix = @exec_prefix@
59: srcdir = @srcdir@
60: bindir = $(exec_prefix)/bin
61: #read-only architecture-independent files
62: datadir = $(prefix)/share
63: #read-only architecture-dependent non-ascii files
64: libdir = $(prefix)/lib
65: infodir = $(prefix)/info
66: mandir = $(prefix)/man
67: man1dir= $(mandir)/man1
68: man1ext= .1
69:
70: # ------------- Compiler Flags
71:
72: XCFLAGS = @CFLAGS@
73: XDEFINES = @DEFS@
74: SWITCHES = $(XCFLAGS) $(XDEFINES)
75: #use -fno-inline to avoid register problems with asinh, atanh on gcc-3.3 on 386
76: ENGINE_FLAGS = @ENGINE_FLAGS@ -fno-defer-pop -fcaller-saves -fno-inline
77: DEBUGFLAG = @DEBUGFLAG@
78: CFLAGS = $(DEBUGFLAG) -I$(srcdir)/../arch/$(machine) -I. -Wall $(SWITCHES) -DDEFAULTPATH='"$(FORTHPATH)"'
79: CFLAGS2 = $(DEBUGFLAG) -I$(srcdir)/../arch/$(machine) -I. -Wall $(SWITCHES) -DDEFAULTPATH='"$(FORTHPATH)"'
80: FORTHKFLAGS= --die-on-signal -p "..$(PATHSEP)$(srcdir)" -i ../$(kernel_fi)
81: FORTHK = ../gforth $(FORTHKFLAGS)
82:
83: #John Wavrik should use -Xlinker -N to get a writable text (executable)
84: XLDFLAGS = @LDFLAGS@
85: LDFLAGS = $(DEBUGFLAG) $(XLDFLAGS)
86: LDLIBS = @LIBS@
87:
88: AOBJECTS = io.o signals.o support.o @LIBOBJS@
89:
90: OBJECTS = engine.o engine2.o main.o
91: OBJECTS_NATIVE = engine-native.o engine-native2.o engine-native3.o main-native.o
92: OBJECTS_FAST = engine-fast.o engine-fast2.o main-fast.o
93: OBJECTS_ITC = engine-itc.o main-itc.o
94: OBJECTS_DITC = engine-ditc.o main-ditc.o
95: OBJECTS_PROF = engine-prof.o main-prof.o
96: OBJECTS_FI = engine.o main-fi.o
97:
98: # In engine subdirectory there are (or should be) only files that belong to
99: # our engine, so we can make life easy
100: DEPS = config.h *.h $(srcdir)/../arch/$(machine)/*.[h]
101: ENGINE_DEPS = engine.c $(DEPS) prim_lab.i prim.i
102: MAIN_DEPS = main.c $(DEPS) prim_superend.i prim_num.i prim_grp.i costs.i super2.i
103:
104: #some makes don't do the -o $@ correctly, so we help them
105: .c.o:
106: $(GCC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
107:
108: support.o: support.c config.h forth.h
109:
110: gforth$(EXE): $(OBJECTS) $(AOBJECTS)
111: $(GCC) $(LDFLAGS) $(OBJECTS) $(AOBJECTS) $(LDLIBS) -o $@
112:
113: gforth-native$(EXE): $(OBJECTS_NATIVE) $(AOBJECTS)
114: $(GCC) $(LDFLAGS) $(OBJECTS_NATIVE) $(AOBJECTS) $(LDLIBS) -o $@
115:
116: gforth-fast$(EXE): $(OBJECTS_FAST) $(AOBJECTS)
117: $(GCC) $(LDFLAGS) $(OBJECTS_FAST) $(AOBJECTS) $(LDLIBS) -o $@
118:
119: gforth-itc$(EXE): $(OBJECTS_ITC) $(AOBJECTS)
120: $(GCC) $(LDFLAGS) $(OBJECTS_ITC) $(AOBJECTS) $(LDLIBS) -o $@
121:
122: gforth-ditc$(EXE): $(OBJECTS_DITC) $(AOBJECTS)
123: $(GCC) $(LDFLAGS) $(OBJECTS_DITC) $(AOBJECTS) $(LDLIBS) -o $@
124:
125: gforth-prof$(EXE): $(OBJECTS_PROF) $(AOBJECTS) profile.o
126: $(GCC) $(LDFLAGS) $(OBJECTS_PROF) $(AOBJECTS) profile.o $(LDLIBS) -o $@
127:
128: gforth-fi$(EXE): $(OBJECTS_FI) $(AOBJECTS)
129: $(GCC) $(LDFLAGS) $(OBJECTS_FI) $(AOBJECTS) $(LDLIBS) -o $@
130:
131: engine.s: $(ENGINE_DEPS)
132: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -S $(srcdir)/engine.c
133:
134: engine.o: $(ENGINE_DEPS)
135: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DGFORTH_DEBUGGING -o $@ -c $(srcdir)/engine.c
136:
137: engine2.o: $(ENGINE_DEPS)
138: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DGFORTH_DEBUGGING -DENGINE=2 -o $@ -c $(srcdir)/engine.c
139:
140: engine-native.o:$(ENGINE_DEPS)
141: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DNO_IP -o $@ -c $(srcdir)/engine.c
142:
143: engine-native2.o:$(ENGINE_DEPS)
144: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DNO_IP -DENGINE=2 -o $@ -c $(srcdir)/engine.c
145:
146: engine-native3.o:$(ENGINE_DEPS)
147: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DNO_IP -DENGINE=3 -o $@ -c $(srcdir)/engine.c
148:
149: engine-fast.o: $(ENGINE_DEPS)
150: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -o $@ -c $(srcdir)/engine.c
151:
152: engine-fast2.o: $(ENGINE_DEPS)
153: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DENGINE=2 -o $@ -c $(srcdir)/engine.c
154:
155: engine-itc.o: $(ENGINE_DEPS)
156: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DINDIRECT_THREADED -DGFORTH_DEBUGGING -o $@ -c $(srcdir)/engine.c
157:
158: engine-ditc.o: $(ENGINE_DEPS)
159: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DDOUBLY_INDIRECT -o $@ -c $(srcdir)/engine.c
160:
161: engine-prof.o: $(ENGINE_DEPS)
162: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DVM_PROFILING -o $@ -c $(srcdir)/engine.c
163:
164: main.o: $(MAIN_DEPS)
165: $(GCC) $(CFLAGS) -DGFORTH_DEBUGGING -o $@ -c $(srcdir)/main.c
166:
167: main-native.o: $(MAIN_DEPS)
168: $(GCC) $(CFLAGS) -DNO_IP -o $@ -c $(srcdir)/main.c
169:
170: main-fast.o: $(MAIN_DEPS)
171: $(GCC) $(CFLAGS) -o $@ -c $(srcdir)/main.c
172:
173: main-itc.o: $(MAIN_DEPS)
174: $(GCC) $(CFLAGS) -DINDIRECT_THREADED -DGFORTH_DEBUGGING -o $@ -c $(srcdir)/main.c
175:
176: main-ditc.o: $(MAIN_DEPS)
177: $(GCC) $(CFLAGS) -DDOUBLY_INDIRECT -o $@ -c $(srcdir)/main.c
178:
179: main-prof.o: $(MAIN_DEPS)
180: $(GCC) $(CFLAGS) -DVM_PROFILING -o $@ -c $(srcdir)/main.c
181:
182: main-fi.o: $(MAIN_DEPS)
183: $(GCC) $(CFLAGS) -DINCLUDE_IMAGE -o $@ -c $(srcdir)/main.c
184:
185: peephole.o: peephole.c peephole.i $(DEPS)
186: $(GCC) $(CFLAGS) -o $@ -c $(srcdir)/peephole.c
187:
188: profile.o: profile.c profile.i $(DEPS)
189: $(GCC) $(CFLAGS) -o $@ -c $(srcdir)/profile.c
190:
191: #The next two rules seem to be superfluous:
192:
193: # engine: $(OBJECTS) $(OBJECTS0) ;
194:
195: # engine_ditc: $(OBJECTS_DITC) $(OBJECTS0) ;
196:
197: #NeXTstep hack
198:
199: termios.o: /usr/lib/libposix.a
200: ar x /usr/lib/libposix.a termios.o
201:
202: #duplicated rules to avoid too many recursive make invocations
203: # !! No any forth stuff should be done in ../Makefile.
204: # !! I added the dependencies on prim.i and prim_lab.i in the main Makefile, jens
205:
206: #I commented out the following rules because they are no longer up-to-date. - anton
207:
208: #prim.i: ../prim.b ../prims2x.fs
209: # $(FORTHK) prims2x.fs -e "s\" ../prim.b\" ' output-c process-file bye" >$@-
210: # $(CP) $@- $@
211: # $(RM) $@-
212: #
213: #prim_lab.i: ../prim.b ../prims2x.fs
214: # $(FORTHK) prims2x.fs -e "s\" ../prim.b\" ' output-label process-file bye" >$@-
215: # $(CP) $@- $@
216: # $(RM) $@-
217:
218: config.h: stamp-h
219: stamp-h: config.h.in ../config.status
220: cd .. && CONFIG_FILES=$@ CONFIG_HEADERS=engine/config.h ./config.status
221: echo timestamp > stamp-h
222:
223: image.c: ../fi2c.fs ../$(include_fi)
224: $(FORTHK) fi2c.fs -e "s\" ../$(include_fi)\" fi2c bye" >$@
225:
226: ../$(include_fi): FORCE
227: cd .. && $(MAKE) $(include_fi)
228:
229: #phony targets depend on FORCE; this is more portable than .PHONY
230: FORCE:
231:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>