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